1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Add ability to import video with youtube-dl

This commit is contained in:
Chocobozzz 2018-08-02 15:34:09 +02:00
parent 5e319fb789
commit fbad87b047
42 changed files with 1507 additions and 446 deletions

View file

@ -8,6 +8,7 @@ import { VideoPrivacy } from '../../shared/models/videos'
import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
import { invert } from 'lodash'
import { VideoImportState } from '../../shared/models/videos/video-import-state.enum'
// Use a variable to reload the configuration if we need
let config: IConfig = require('config')
@ -85,6 +86,7 @@ const JOB_ATTEMPTS: { [ id in JobType ]: number } = {
'activitypub-follow': 5,
'video-file-import': 1,
'video-file': 1,
'video-import': 1,
'email': 5
}
const JOB_CONCURRENCY: { [ id in JobType ]: number } = {
@ -94,6 +96,7 @@ const JOB_CONCURRENCY: { [ id in JobType ]: number } = {
'activitypub-follow': 3,
'video-file-import': 1,
'video-file': 1,
'video-import': 1,
'email': 5
}
const BROADCAST_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-http-broadcast job
@ -248,6 +251,9 @@ const CONSTRAINTS_FIELDS = {
}
}
},
VIDEO_IMPORTS: {
URL: { min: 3, max: 2000 } // Length
},
VIDEOS: {
NAME: { min: 3, max: 120 }, // Length
LANGUAGE: { min: 1, max: 10 }, // Length
@ -262,7 +268,7 @@ const CONSTRAINTS_FIELDS = {
},
EXTNAME: [ '.mp4', '.ogv', '.webm' ],
INFO_HASH: { min: 40, max: 40 }, // Length, info hash is 20 bytes length but we represent it in hexadecimal so 20 * 2
DURATION: { min: 1 }, // Number
DURATION: { min: 0 }, // Number
TAGS: { min: 0, max: 5 }, // Number of total tags
TAG: { min: 2, max: 30 }, // Length
THUMBNAIL: { min: 2, max: 30 },
@ -363,7 +369,14 @@ const VIDEO_PRIVACIES = {
const VIDEO_STATES = {
[VideoState.PUBLISHED]: 'Published',
[VideoState.TO_TRANSCODE]: 'To transcode'
[VideoState.TO_TRANSCODE]: 'To transcode',
[VideoState.TO_IMPORT]: 'To import'
}
const VIDEO_IMPORT_STATES = {
[VideoImportState.FAILED]: 'Failed',
[VideoImportState.PENDING]: 'Pending',
[VideoImportState.SUCCESS]: 'Success'
}
const VIDEO_MIMETYPE_EXT = {
@ -585,6 +598,7 @@ export {
RATES_LIMIT,
VIDEO_EXT_MIMETYPE,
JOB_COMPLETED_LIFETIME,
VIDEO_IMPORT_STATES,
VIDEO_VIEW_LIFETIME,
buildLanguages
}