feat: add core

This commit is contained in:
Karl-Philipp Wulfert
2018-11-29 16:22:57 +01:00
commit 2d770dde44
131 changed files with 41268 additions and 0 deletions

155
src/core/things/Video.ts Normal file
View File

@@ -0,0 +1,155 @@
/*
* Copyright (C) 2018 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCCreativeWork, SCCreativeWorkWithoutReferences} from '../base/CreativeWork';
import {SCThingMeta} from '../Thing';
import {SCLanguage} from '../types/i18n';
import {SCISO8601Duration} from '../types/Time';
import {SCPersonWithoutReferences} from './Person';
/**
* Type of a video
*/
export type SCVideoType = 'video';
/**
* A video without references
*/
export interface SCVideoWithoutReferences extends SCCreativeWorkWithoutReferences {
/**
* The Duration of the Video
*/
duration?: SCISO8601Duration;
/**
* Downloadable/Streamable Files of the Video
*/
sources?: SCVideoSource[];
/**
* URLs to a thumbnails for the Video
*/
thumbnails?: string[];
/**
* Track Files for the Video
*/
tracks?: SCVideoTrack;
/**
* A Transcript of the Video
*/
transcript?: string;
/**
* Type of an Video
*/
type: SCVideoType;
}
export interface SCVideoSource {
/**
* Pixel Height of the Video
*/
height?: number;
/**
* MIME-Type of the source File
*/
mimeType: SCVideoMimeType;
/**
* Size of the Video File in bytes
*/
size?: number;
/**
* URL to the Video File
*/
url: string;
/**
* Pixel Width of the Video
*/
width?: number;
}
export interface SCVideoTrack {
/**
* Language of the Subtitle
*/
language: SCLanguage;
/**
* Content Type of the Track File
*/
type: SCVideoTrackTypes;
/**
* URL to the Track File
*/
url: string;
}
/**
* A video
*/
export interface SCVideo extends SCCreativeWork, SCVideoWithoutReferences {
/**
* Persons acting in the Video
*/
actors?: SCPersonWithoutReferences[];
/**
* Type of a video
*/
type: SCVideoType;
}
export class SCVideoMeta extends SCThingMeta {
static fieldValueTranslations = {
...SCThingMeta.fieldValueTranslations,
de: {
actors: 'Darsteller',
duration: 'Länge',
height: 'Höhe',
language: 'Sprache',
size: 'Größe',
sources: 'Quellen',
transcript: 'Abschrift',
type: 'Video',
width: 'Breite',
},
};
}
/**
* Video Encoding Formats
*/
export type SCVideoMimeType =
'video/mp4'
| 'video/ogg'
| 'video/webm'
| 'application/vnd.apple.mpegurl'
| 'application/dash+xml';
/**
* Video Track Types
*/
export type SCVideoTrackTypes =
'captions'
| 'chapters'
| 'description'
| 'metadata'
| 'subtitles';