aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/videos/import.ts9
-rw-r--r--server/controllers/static.ts3
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'
3import * as magnetUtil from 'magnet-uri' 3import * as magnetUtil from 'magnet-uri'
4import * as parseTorrent from 'parse-torrent' 4import * as parseTorrent from 'parse-torrent'
5import { join } from 'path' 5import { join } from 'path'
6import { getEnabledResolutions } from '@server/lib/config'
6import { setVideoTags } from '@server/lib/video' 7import { setVideoTags } from '@server/lib/video'
7import { 8import {
8 MChannelAccountDefault, 9 MChannelAccountDefault,
@@ -24,7 +25,7 @@ import { isArray } from '../../../helpers/custom-validators/misc'
24import { createReqFiles } from '../../../helpers/express-utils' 25import { createReqFiles } from '../../../helpers/express-utils'
25import { logger } from '../../../helpers/logger' 26import { logger } from '../../../helpers/logger'
26import { getSecureTorrentName } from '../../../helpers/utils' 27import { getSecureTorrentName } from '../../../helpers/utils'
27import { getYoutubeDLInfo, getYoutubeDLSubs, YoutubeDLInfo } from '../../../helpers/youtube-dl' 28import { YoutubeDL, YoutubeDLInfo } from '../../../helpers/youtube-dl'
28import { CONFIG } from '../../../initializers/config' 29import { CONFIG } from '../../../initializers/config'
29import { MIMETYPES } from '../../../initializers/constants' 30import { MIMETYPES } from '../../../initializers/constants'
30import { sequelizeTypescript } from '../../../initializers/database' 31import { 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'
2import * as express from 'express' 2import * as express from 'express'
3import { join } from 'path' 3import { join } from 'path'
4import { serveIndexHTML } from '@server/lib/client-html' 4import { serveIndexHTML } from '@server/lib/client-html'
5import { getRegisteredPlugins, getRegisteredThemes } from '@server/lib/config' 5import { getEnabledResolutions, getRegisteredPlugins, getRegisteredThemes } from '@server/lib/config'
6import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' 6import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
7import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' 7import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo'
8import { root } from '../helpers/core-utils' 8import { root } from '../helpers/core-utils'
@@ -18,7 +18,6 @@ import {
18 WEBSERVER 18 WEBSERVER
19} from '../initializers/constants' 19} from '../initializers/constants'
20import { getThemeOrDefault } from '../lib/plugins/theme-utils' 20import { getThemeOrDefault } from '../lib/plugins/theme-utils'
21import { getEnabledResolutions } from '../lib/video-transcoding'
22import { asyncMiddleware } from '../middlewares' 21import { asyncMiddleware } from '../middlewares'
23import { cacheRoute } from '../middlewares/cache' 22import { cacheRoute } from '../middlewares/cache'
24import { UserModel } from '../models/account/user' 23import { UserModel } from '../models/account/user'