diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-02 15:34:09 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-06 11:19:16 +0200 |
commit | fbad87b0472f574409f7aa3ae7f8b54927d0cdd6 (patch) | |
tree | 197b4209e75d57dabae7cdd6f2da5f765e427023 /server/initializers/constants.ts | |
parent | 5e319fb7898fd0482c399cc3ae9dcfc20d274a58 (diff) | |
download | PeerTube-fbad87b0472f574409f7aa3ae7f8b54927d0cdd6.tar.gz PeerTube-fbad87b0472f574409f7aa3ae7f8b54927d0cdd6.tar.zst PeerTube-fbad87b0472f574409f7aa3ae7f8b54927d0cdd6.zip |
Add ability to import video with youtube-dl
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r-- | server/initializers/constants.ts | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index bec343bb7..fdd772d84 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -8,6 +8,7 @@ import { VideoPrivacy } from '../../shared/models/videos' | |||
8 | import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' | 8 | import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' |
9 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' | 9 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' |
10 | import { invert } from 'lodash' | 10 | import { invert } from 'lodash' |
11 | import { VideoImportState } from '../../shared/models/videos/video-import-state.enum' | ||
11 | 12 | ||
12 | // Use a variable to reload the configuration if we need | 13 | // Use a variable to reload the configuration if we need |
13 | let config: IConfig = require('config') | 14 | let config: IConfig = require('config') |
@@ -85,6 +86,7 @@ const JOB_ATTEMPTS: { [ id in JobType ]: number } = { | |||
85 | 'activitypub-follow': 5, | 86 | 'activitypub-follow': 5, |
86 | 'video-file-import': 1, | 87 | 'video-file-import': 1, |
87 | 'video-file': 1, | 88 | 'video-file': 1, |
89 | 'video-import': 1, | ||
88 | 'email': 5 | 90 | 'email': 5 |
89 | } | 91 | } |
90 | const JOB_CONCURRENCY: { [ id in JobType ]: number } = { | 92 | const JOB_CONCURRENCY: { [ id in JobType ]: number } = { |
@@ -94,6 +96,7 @@ const JOB_CONCURRENCY: { [ id in JobType ]: number } = { | |||
94 | 'activitypub-follow': 3, | 96 | 'activitypub-follow': 3, |
95 | 'video-file-import': 1, | 97 | 'video-file-import': 1, |
96 | 'video-file': 1, | 98 | 'video-file': 1, |
99 | 'video-import': 1, | ||
97 | 'email': 5 | 100 | 'email': 5 |
98 | } | 101 | } |
99 | const BROADCAST_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-http-broadcast job | 102 | const BROADCAST_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-http-broadcast job |
@@ -248,6 +251,9 @@ const CONSTRAINTS_FIELDS = { | |||
248 | } | 251 | } |
249 | } | 252 | } |
250 | }, | 253 | }, |
254 | VIDEO_IMPORTS: { | ||
255 | URL: { min: 3, max: 2000 } // Length | ||
256 | }, | ||
251 | VIDEOS: { | 257 | VIDEOS: { |
252 | NAME: { min: 3, max: 120 }, // Length | 258 | NAME: { min: 3, max: 120 }, // Length |
253 | LANGUAGE: { min: 1, max: 10 }, // Length | 259 | LANGUAGE: { min: 1, max: 10 }, // Length |
@@ -262,7 +268,7 @@ const CONSTRAINTS_FIELDS = { | |||
262 | }, | 268 | }, |
263 | EXTNAME: [ '.mp4', '.ogv', '.webm' ], | 269 | EXTNAME: [ '.mp4', '.ogv', '.webm' ], |
264 | INFO_HASH: { min: 40, max: 40 }, // Length, info hash is 20 bytes length but we represent it in hexadecimal so 20 * 2 | 270 | INFO_HASH: { min: 40, max: 40 }, // Length, info hash is 20 bytes length but we represent it in hexadecimal so 20 * 2 |
265 | DURATION: { min: 1 }, // Number | 271 | DURATION: { min: 0 }, // Number |
266 | TAGS: { min: 0, max: 5 }, // Number of total tags | 272 | TAGS: { min: 0, max: 5 }, // Number of total tags |
267 | TAG: { min: 2, max: 30 }, // Length | 273 | TAG: { min: 2, max: 30 }, // Length |
268 | THUMBNAIL: { min: 2, max: 30 }, | 274 | THUMBNAIL: { min: 2, max: 30 }, |
@@ -363,7 +369,14 @@ const VIDEO_PRIVACIES = { | |||
363 | 369 | ||
364 | const VIDEO_STATES = { | 370 | const VIDEO_STATES = { |
365 | [VideoState.PUBLISHED]: 'Published', | 371 | [VideoState.PUBLISHED]: 'Published', |
366 | [VideoState.TO_TRANSCODE]: 'To transcode' | 372 | [VideoState.TO_TRANSCODE]: 'To transcode', |
373 | [VideoState.TO_IMPORT]: 'To import' | ||
374 | } | ||
375 | |||
376 | const VIDEO_IMPORT_STATES = { | ||
377 | [VideoImportState.FAILED]: 'Failed', | ||
378 | [VideoImportState.PENDING]: 'Pending', | ||
379 | [VideoImportState.SUCCESS]: 'Success' | ||
367 | } | 380 | } |
368 | 381 | ||
369 | const VIDEO_MIMETYPE_EXT = { | 382 | const VIDEO_MIMETYPE_EXT = { |
@@ -585,6 +598,7 @@ export { | |||
585 | RATES_LIMIT, | 598 | RATES_LIMIT, |
586 | VIDEO_EXT_MIMETYPE, | 599 | VIDEO_EXT_MIMETYPE, |
587 | JOB_COMPLETED_LIFETIME, | 600 | JOB_COMPLETED_LIFETIME, |
601 | VIDEO_IMPORT_STATES, | ||
588 | VIDEO_VIEW_LIFETIME, | 602 | VIDEO_VIEW_LIFETIME, |
589 | buildLanguages | 603 | buildLanguages |
590 | } | 604 | } |