diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-16 14:22:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-16 14:31:40 +0200 |
commit | f4001cf408a99049d01a356bfb20a62342de06ea (patch) | |
tree | 421776dfe64335dca2725ac3ac5f3b3e6b7564c6 /server/initializers/constants.ts | |
parent | 16f7022b06fb76c0b00c23c970bc8df605b0ec63 (diff) | |
download | PeerTube-f4001cf408a99049d01a356bfb20a62342de06ea.tar.gz PeerTube-f4001cf408a99049d01a356bfb20a62342de06ea.tar.zst PeerTube-f4001cf408a99049d01a356bfb20a62342de06ea.zip |
Handle .srt subtitles
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r-- | server/initializers/constants.ts | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 49809e64c..3837f7062 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -231,7 +231,7 @@ const CONSTRAINTS_FIELDS = { | |||
231 | }, | 231 | }, |
232 | VIDEO_CAPTIONS: { | 232 | VIDEO_CAPTIONS: { |
233 | CAPTION_FILE: { | 233 | CAPTION_FILE: { |
234 | EXTNAME: [ '.vtt' ], | 234 | EXTNAME: [ '.vtt', '.srt' ], |
235 | FILE_SIZE: { | 235 | FILE_SIZE: { |
236 | max: 2 * 1024 * 1024 // 2MB | 236 | max: 2 * 1024 * 1024 // 2MB |
237 | } | 237 | } |
@@ -364,7 +364,8 @@ const IMAGE_MIMETYPE_EXT = { | |||
364 | } | 364 | } |
365 | 365 | ||
366 | const VIDEO_CAPTIONS_MIMETYPE_EXT = { | 366 | const VIDEO_CAPTIONS_MIMETYPE_EXT = { |
367 | 'text/vtt': '.vtt' | 367 | 'text/vtt': '.vtt', |
368 | 'application/x-subrip': '.srt' | ||
368 | } | 369 | } |
369 | 370 | ||
370 | // --------------------------------------------------------------------------- | 371 | // --------------------------------------------------------------------------- |
@@ -451,9 +452,13 @@ const EMBED_SIZE = { | |||
451 | 452 | ||
452 | // Sub folders of cache directory | 453 | // Sub folders of cache directory |
453 | const CACHE = { | 454 | const CACHE = { |
454 | DIRECTORIES: { | 455 | PREVIEWS: { |
455 | PREVIEWS: join(CONFIG.STORAGE.CACHE_DIR, 'previews'), | 456 | DIRECTORY: join(CONFIG.STORAGE.CACHE_DIR, 'previews'), |
456 | VIDEO_CAPTIONS: join(CONFIG.STORAGE.CACHE_DIR, 'video-captions') | 457 | MAX_AGE: 1000 * 3600 * 3 // 3 hours |
458 | }, | ||
459 | VIDEO_CAPTIONS: { | ||
460 | DIRECTORY: join(CONFIG.STORAGE.CACHE_DIR, 'video-captions'), | ||
461 | MAX_AGE: 1000 * 3600 * 3 // 3 hours | ||
457 | } | 462 | } |
458 | } | 463 | } |
459 | 464 | ||
@@ -500,6 +505,8 @@ if (isTestInstance() === true) { | |||
500 | VIDEO_VIEW_LIFETIME = 1000 // 1 second | 505 | VIDEO_VIEW_LIFETIME = 1000 // 1 second |
501 | 506 | ||
502 | JOB_ATTEMPTS['email'] = 1 | 507 | JOB_ATTEMPTS['email'] = 1 |
508 | |||
509 | CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000 | ||
503 | } | 510 | } |
504 | 511 | ||
505 | updateWebserverConfig() | 512 | updateWebserverConfig() |