diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/config.ts | 12 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/video-import.ts | 7 | ||||
-rw-r--r-- | server/lib/schedulers/youtube-dl-update-scheduler.ts | 6 | ||||
-rw-r--r-- | server/lib/video-transcoding.ts | 13 |
4 files changed, 20 insertions, 18 deletions
diff --git a/server/lib/config.ts b/server/lib/config.ts index b4c4c9299..eb4510680 100644 --- a/server/lib/config.ts +++ b/server/lib/config.ts | |||
@@ -6,7 +6,6 @@ import { RegisteredExternalAuthConfig, RegisteredIdAndPassAuthConfig, ServerConf | |||
6 | import { Hooks } from './plugins/hooks' | 6 | import { Hooks } from './plugins/hooks' |
7 | import { PluginManager } from './plugins/plugin-manager' | 7 | import { PluginManager } from './plugins/plugin-manager' |
8 | import { getThemeOrDefault } from './plugins/theme-utils' | 8 | import { getThemeOrDefault } from './plugins/theme-utils' |
9 | import { getEnabledResolutions } from './video-transcoding' | ||
10 | import { VideoTranscodingProfilesManager } from './video-transcoding-profiles' | 9 | import { VideoTranscodingProfilesManager } from './video-transcoding-profiles' |
11 | 10 | ||
12 | let serverCommit: string | 11 | let serverCommit: string |
@@ -208,11 +207,22 @@ function getRegisteredPlugins () { | |||
208 | })) | 207 | })) |
209 | } | 208 | } |
210 | 209 | ||
210 | function getEnabledResolutions (type: 'vod' | 'live') { | ||
211 | const transcoding = type === 'vod' | ||
212 | ? CONFIG.TRANSCODING | ||
213 | : CONFIG.LIVE.TRANSCODING | ||
214 | |||
215 | return Object.keys(transcoding.RESOLUTIONS) | ||
216 | .filter(key => transcoding.ENABLED && transcoding.RESOLUTIONS[key] === true) | ||
217 | .map(r => parseInt(r, 10)) | ||
218 | } | ||
219 | |||
211 | // --------------------------------------------------------------------------- | 220 | // --------------------------------------------------------------------------- |
212 | 221 | ||
213 | export { | 222 | export { |
214 | getServerConfig, | 223 | getServerConfig, |
215 | getRegisteredThemes, | 224 | getRegisteredThemes, |
225 | getEnabledResolutions, | ||
216 | getRegisteredPlugins | 226 | getRegisteredPlugins |
217 | } | 227 | } |
218 | 228 | ||
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index ed2c5eac0..3067ce214 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts | |||
@@ -23,7 +23,6 @@ import { getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } fro | |||
23 | import { logger } from '../../../helpers/logger' | 23 | import { logger } from '../../../helpers/logger' |
24 | import { getSecureTorrentName } from '../../../helpers/utils' | 24 | import { getSecureTorrentName } from '../../../helpers/utils' |
25 | import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent' | 25 | import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent' |
26 | import { downloadYoutubeDLVideo } from '../../../helpers/youtube-dl' | ||
27 | import { CONFIG } from '../../../initializers/config' | 26 | import { CONFIG } from '../../../initializers/config' |
28 | import { VIDEO_IMPORT_TIMEOUT } from '../../../initializers/constants' | 27 | import { VIDEO_IMPORT_TIMEOUT } from '../../../initializers/constants' |
29 | import { sequelizeTypescript } from '../../../initializers/database' | 28 | import { sequelizeTypescript } from '../../../initializers/database' |
@@ -34,6 +33,8 @@ import { MThumbnail } from '../../../types/models/video/thumbnail' | |||
34 | import { federateVideoIfNeeded } from '../../activitypub/videos' | 33 | import { federateVideoIfNeeded } from '../../activitypub/videos' |
35 | import { Notifier } from '../../notifier' | 34 | import { Notifier } from '../../notifier' |
36 | import { generateVideoMiniature } from '../../thumbnail' | 35 | import { generateVideoMiniature } from '../../thumbnail' |
36 | import { YoutubeDL } from '@server/helpers/youtube-dl' | ||
37 | import { getEnabledResolutions } from '@server/lib/config' | ||
37 | 38 | ||
38 | async function processVideoImport (job: Bull.Job) { | 39 | async function processVideoImport (job: Bull.Job) { |
39 | const payload = job.data as VideoImportPayload | 40 | const payload = job.data as VideoImportPayload |
@@ -75,8 +76,10 @@ async function processYoutubeDLImport (job: Bull.Job, payload: VideoImportYoutub | |||
75 | videoImportId: videoImport.id | 76 | videoImportId: videoImport.id |
76 | } | 77 | } |
77 | 78 | ||
79 | const youtubeDL = new YoutubeDL(videoImport.targetUrl, getEnabledResolutions('vod')) | ||
80 | |||
78 | return processFile( | 81 | return processFile( |
79 | () => downloadYoutubeDLVideo(videoImport.targetUrl, payload.fileExt, VIDEO_IMPORT_TIMEOUT), | 82 | () => youtubeDL.downloadYoutubeDLVideo(payload.fileExt, VIDEO_IMPORT_TIMEOUT), |
80 | videoImport, | 83 | videoImport, |
81 | options | 84 | options |
82 | ) | 85 | ) |
diff --git a/server/lib/schedulers/youtube-dl-update-scheduler.ts b/server/lib/schedulers/youtube-dl-update-scheduler.ts index aefe6aba4..898691c13 100644 --- a/server/lib/schedulers/youtube-dl-update-scheduler.ts +++ b/server/lib/schedulers/youtube-dl-update-scheduler.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { AbstractScheduler } from './abstract-scheduler' | 1 | import { YoutubeDL } from '@server/helpers/youtube-dl' |
2 | import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants' | 2 | import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants' |
3 | import { updateYoutubeDLBinary } from '../../helpers/youtube-dl' | 3 | import { AbstractScheduler } from './abstract-scheduler' |
4 | 4 | ||
5 | export class YoutubeDlUpdateScheduler extends AbstractScheduler { | 5 | export class YoutubeDlUpdateScheduler extends AbstractScheduler { |
6 | 6 | ||
@@ -13,7 +13,7 @@ export class YoutubeDlUpdateScheduler extends AbstractScheduler { | |||
13 | } | 13 | } |
14 | 14 | ||
15 | protected internalExecute () { | 15 | protected internalExecute () { |
16 | return updateYoutubeDLBinary() | 16 | return YoutubeDL.updateYoutubeDLBinary() |
17 | } | 17 | } |
18 | 18 | ||
19 | static get Instance () { | 19 | static get Instance () { |
diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts index c949dca2e..51949f51a 100644 --- a/server/lib/video-transcoding.ts +++ b/server/lib/video-transcoding.ts | |||
@@ -215,16 +215,6 @@ function generateHlsPlaylistResolution (options: { | |||
215 | }) | 215 | }) |
216 | } | 216 | } |
217 | 217 | ||
218 | function getEnabledResolutions (type: 'vod' | 'live') { | ||
219 | const transcoding = type === 'vod' | ||
220 | ? CONFIG.TRANSCODING | ||
221 | : CONFIG.LIVE.TRANSCODING | ||
222 | |||
223 | return Object.keys(transcoding.RESOLUTIONS) | ||
224 | .filter(key => transcoding.ENABLED && transcoding.RESOLUTIONS[key] === true) | ||
225 | .map(r => parseInt(r, 10)) | ||
226 | } | ||
227 | |||
228 | // --------------------------------------------------------------------------- | 218 | // --------------------------------------------------------------------------- |
229 | 219 | ||
230 | export { | 220 | export { |
@@ -232,8 +222,7 @@ export { | |||
232 | generateHlsPlaylistResolutionFromTS, | 222 | generateHlsPlaylistResolutionFromTS, |
233 | optimizeOriginalVideofile, | 223 | optimizeOriginalVideofile, |
234 | transcodeNewWebTorrentResolution, | 224 | transcodeNewWebTorrentResolution, |
235 | mergeAudioVideofile, | 225 | mergeAudioVideofile |
236 | getEnabledResolutions | ||
237 | } | 226 | } |
238 | 227 | ||
239 | // --------------------------------------------------------------------------- | 228 | // --------------------------------------------------------------------------- |