diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/videos/import.ts | 9 | ||||
-rw-r--r-- | server/controllers/static.ts | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index 3b9b887e2..37fd42b90 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts | |||
@@ -3,6 +3,7 @@ import { move, readFile } from 'fs-extra' | |||
3 | import * as magnetUtil from 'magnet-uri' | 3 | import * as magnetUtil from 'magnet-uri' |
4 | import * as parseTorrent from 'parse-torrent' | 4 | import * as parseTorrent from 'parse-torrent' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { getEnabledResolutions } from '@server/lib/config' | ||
6 | import { setVideoTags } from '@server/lib/video' | 7 | import { setVideoTags } from '@server/lib/video' |
7 | import { | 8 | import { |
8 | MChannelAccountDefault, | 9 | MChannelAccountDefault, |
@@ -24,7 +25,7 @@ import { isArray } from '../../../helpers/custom-validators/misc' | |||
24 | import { createReqFiles } from '../../../helpers/express-utils' | 25 | import { createReqFiles } from '../../../helpers/express-utils' |
25 | import { logger } from '../../../helpers/logger' | 26 | import { logger } from '../../../helpers/logger' |
26 | import { getSecureTorrentName } from '../../../helpers/utils' | 27 | import { getSecureTorrentName } from '../../../helpers/utils' |
27 | import { getYoutubeDLInfo, getYoutubeDLSubs, YoutubeDLInfo } from '../../../helpers/youtube-dl' | 28 | import { YoutubeDL, YoutubeDLInfo } from '../../../helpers/youtube-dl' |
28 | import { CONFIG } from '../../../initializers/config' | 29 | import { CONFIG } from '../../../initializers/config' |
29 | import { MIMETYPES } from '../../../initializers/constants' | 30 | import { MIMETYPES } from '../../../initializers/constants' |
30 | import { sequelizeTypescript } from '../../../initializers/database' | 31 | import { sequelizeTypescript } from '../../../initializers/database' |
@@ -139,10 +140,12 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response) | |||
139 | const targetUrl = body.targetUrl | 140 | const targetUrl = body.targetUrl |
140 | const user = res.locals.oauth.token.User | 141 | const user = res.locals.oauth.token.User |
141 | 142 | ||
143 | const youtubeDL = new YoutubeDL(targetUrl, getEnabledResolutions('vod')) | ||
144 | |||
142 | // Get video infos | 145 | // Get video infos |
143 | let youtubeDLInfo: YoutubeDLInfo | 146 | let youtubeDLInfo: YoutubeDLInfo |
144 | try { | 147 | try { |
145 | youtubeDLInfo = await getYoutubeDLInfo(targetUrl) | 148 | youtubeDLInfo = await youtubeDL.getYoutubeDLInfo() |
146 | } catch (err) { | 149 | } catch (err) { |
147 | logger.info('Cannot fetch information from import for URL %s.', targetUrl, { err }) | 150 | logger.info('Cannot fetch information from import for URL %s.', targetUrl, { err }) |
148 | 151 | ||
@@ -188,7 +191,7 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response) | |||
188 | 191 | ||
189 | // Get video subtitles | 192 | // Get video subtitles |
190 | try { | 193 | try { |
191 | const subtitles = await getYoutubeDLSubs(targetUrl) | 194 | const subtitles = await youtubeDL.getYoutubeDLSubs() |
192 | 195 | ||
193 | logger.info('Will create %s subtitles from youtube import %s.', subtitles.length, targetUrl) | 196 | logger.info('Will create %s subtitles from youtube import %s.', subtitles.length, targetUrl) |
194 | 197 | ||
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index 8d9003a3e..5cf4e9575 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -2,7 +2,7 @@ import * as cors from 'cors' | |||
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { serveIndexHTML } from '@server/lib/client-html' | 4 | import { serveIndexHTML } from '@server/lib/client-html' |
5 | import { getRegisteredPlugins, getRegisteredThemes } from '@server/lib/config' | 5 | import { getEnabledResolutions, getRegisteredPlugins, getRegisteredThemes } from '@server/lib/config' |
6 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | 6 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' |
7 | import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' | 7 | import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' |
8 | import { root } from '../helpers/core-utils' | 8 | import { root } from '../helpers/core-utils' |
@@ -18,7 +18,6 @@ import { | |||
18 | WEBSERVER | 18 | WEBSERVER |
19 | } from '../initializers/constants' | 19 | } from '../initializers/constants' |
20 | import { getThemeOrDefault } from '../lib/plugins/theme-utils' | 20 | import { getThemeOrDefault } from '../lib/plugins/theme-utils' |
21 | import { getEnabledResolutions } from '../lib/video-transcoding' | ||
22 | import { asyncMiddleware } from '../middlewares' | 21 | import { asyncMiddleware } from '../middlewares' |
23 | import { cacheRoute } from '../middlewares/cache' | 22 | import { cacheRoute } from '../middlewares/cache' |
24 | import { UserModel } from '../models/account/user' | 23 | import { UserModel } from '../models/account/user' |