aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/constants.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-12 19:02:00 +0200
committerChocobozzz <me@florianbigard.com>2018-07-16 11:50:08 +0200
commit40e87e9ecc54e3513fb586928330a7855eb192c6 (patch)
treeaf1111ecba85f9cd8286811ff332a67cf21be2f6 /server/initializers/constants.ts
parentd4557fd3ecc8d4ed4fb0e5c868929bc36c959ed2 (diff)
downloadPeerTube-40e87e9ecc54e3513fb586928330a7855eb192c6.tar.gz
PeerTube-40e87e9ecc54e3513fb586928330a7855eb192c6.tar.zst
PeerTube-40e87e9ecc54e3513fb586928330a7855eb192c6.zip
Implement captions/subtitles
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r--server/initializers/constants.ts23
1 files changed, 21 insertions, 2 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index c5bc886d8..49809e64c 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -138,6 +138,7 @@ const CONFIG = {
138 VIDEOS_DIR: buildPath(config.get<string>('storage.videos')), 138 VIDEOS_DIR: buildPath(config.get<string>('storage.videos')),
139 THUMBNAILS_DIR: buildPath(config.get<string>('storage.thumbnails')), 139 THUMBNAILS_DIR: buildPath(config.get<string>('storage.thumbnails')),
140 PREVIEWS_DIR: buildPath(config.get<string>('storage.previews')), 140 PREVIEWS_DIR: buildPath(config.get<string>('storage.previews')),
141 CAPTIONS_DIR: buildPath(config.get<string>('storage.captions')),
141 TORRENTS_DIR: buildPath(config.get<string>('storage.torrents')), 142 TORRENTS_DIR: buildPath(config.get<string>('storage.torrents')),
142 CACHE_DIR: buildPath(config.get<string>('storage.cache')) 143 CACHE_DIR: buildPath(config.get<string>('storage.cache'))
143 }, 144 },
@@ -183,6 +184,9 @@ const CONFIG = {
183 CACHE: { 184 CACHE: {
184 PREVIEWS: { 185 PREVIEWS: {
185 get SIZE () { return config.get<number>('cache.previews.size') } 186 get SIZE () { return config.get<number>('cache.previews.size') }
187 },
188 VIDEO_CAPTIONS: {
189 get SIZE () { return config.get<number>('cache.captions.size') }
186 } 190 }
187 }, 191 },
188 INSTANCE: { 192 INSTANCE: {
@@ -225,6 +229,14 @@ const CONSTRAINTS_FIELDS = {
225 SUPPORT: { min: 3, max: 500 }, // Length 229 SUPPORT: { min: 3, max: 500 }, // Length
226 URL: { min: 3, max: 2000 } // Length 230 URL: { min: 3, max: 2000 } // Length
227 }, 231 },
232 VIDEO_CAPTIONS: {
233 CAPTION_FILE: {
234 EXTNAME: [ '.vtt' ],
235 FILE_SIZE: {
236 max: 2 * 1024 * 1024 // 2MB
237 }
238 }
239 },
228 VIDEOS: { 240 VIDEOS: {
229 NAME: { min: 3, max: 120 }, // Length 241 NAME: { min: 3, max: 120 }, // Length
230 LANGUAGE: { min: 1, max: 10 }, // Length 242 LANGUAGE: { min: 1, max: 10 }, // Length
@@ -351,6 +363,10 @@ const IMAGE_MIMETYPE_EXT = {
351 'image/jpeg': '.jpg' 363 'image/jpeg': '.jpg'
352} 364}
353 365
366const VIDEO_CAPTIONS_MIMETYPE_EXT = {
367 'text/vtt': '.vtt'
368}
369
354// --------------------------------------------------------------------------- 370// ---------------------------------------------------------------------------
355 371
356const SERVER_ACTOR_NAME = 'peertube' 372const SERVER_ACTOR_NAME = 'peertube'
@@ -403,7 +419,8 @@ const STATIC_PATHS = {
403 THUMBNAILS: '/static/thumbnails/', 419 THUMBNAILS: '/static/thumbnails/',
404 TORRENTS: '/static/torrents/', 420 TORRENTS: '/static/torrents/',
405 WEBSEED: '/static/webseed/', 421 WEBSEED: '/static/webseed/',
406 AVATARS: '/static/avatars/' 422 AVATARS: '/static/avatars/',
423 VIDEO_CAPTIONS: '/static/video-captions/'
407} 424}
408const STATIC_DOWNLOAD_PATHS = { 425const STATIC_DOWNLOAD_PATHS = {
409 TORRENTS: '/download/torrents/', 426 TORRENTS: '/download/torrents/',
@@ -435,7 +452,8 @@ const EMBED_SIZE = {
435// Sub folders of cache directory 452// Sub folders of cache directory
436const CACHE = { 453const CACHE = {
437 DIRECTORIES: { 454 DIRECTORIES: {
438 PREVIEWS: join(CONFIG.STORAGE.CACHE_DIR, 'previews') 455 PREVIEWS: join(CONFIG.STORAGE.CACHE_DIR, 'previews'),
456 VIDEO_CAPTIONS: join(CONFIG.STORAGE.CACHE_DIR, 'video-captions')
439 } 457 }
440} 458}
441 459
@@ -490,6 +508,7 @@ updateWebserverConfig()
490 508
491export { 509export {
492 API_VERSION, 510 API_VERSION,
511 VIDEO_CAPTIONS_MIMETYPE_EXT,
493 AVATARS_SIZE, 512 AVATARS_SIZE,
494 ACCEPT_HEADERS, 513 ACCEPT_HEADERS,
495 BCRYPT_SALT_SIZE, 514 BCRYPT_SALT_SIZE,