mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
stricter youtubedl format selectors (#3516)
* stricter youtubedl format selectors make sure selectors avoid av1, and otherwise match as closely to the maximum resolution enabled for transcoding * add support for merge formats in youtubedl * avoid vp9.2 in youtubedl to avoid any HDR * move getEnabledResolutions, safer replace of imported extension * add test for youtube-dl selectors
This commit is contained in:
@@ -10,6 +10,7 @@ import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '..
|
||||
import { objectConverter } from '../../helpers/core-utils'
|
||||
import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup'
|
||||
import { getServerCommit } from '../../helpers/utils'
|
||||
import { getEnabledResolutions } from '../../lib/video-transcoding'
|
||||
import { CONFIG, isEmailEnabled, reloadConfig } from '../../initializers/config'
|
||||
import { CONSTRAINTS_FIELDS, DEFAULT_THEME_NAME, PEERTUBE_VERSION } from '../../initializers/constants'
|
||||
import { ClientHtml } from '../../lib/client-html'
|
||||
@@ -285,16 +286,6 @@ function getRegisteredThemes () {
|
||||
}))
|
||||
}
|
||||
|
||||
function getEnabledResolutions (type: 'vod' | 'live') {
|
||||
const transcoding = type === 'vod'
|
||||
? CONFIG.TRANSCODING
|
||||
: CONFIG.LIVE.TRANSCODING
|
||||
|
||||
return Object.keys(transcoding.RESOLUTIONS)
|
||||
.filter(key => transcoding.ENABLED && transcoding.RESOLUTIONS[key] === true)
|
||||
.map(r => parseInt(r, 10))
|
||||
}
|
||||
|
||||
function getRegisteredPlugins () {
|
||||
return PluginManager.Instance.getRegisteredPlugins()
|
||||
.map(p => ({
|
||||
@@ -345,7 +336,6 @@ function getExternalAuthsPlugins () {
|
||||
|
||||
export {
|
||||
configRouter,
|
||||
getEnabledResolutions,
|
||||
getRegisteredPlugins,
|
||||
getRegisteredThemes
|
||||
}
|
||||
|
||||
@@ -146,9 +146,10 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
|
||||
} catch (err) {
|
||||
logger.info('Cannot fetch information from import for URL %s.', targetUrl, { err })
|
||||
|
||||
return res.status(HttpStatusCode.BAD_REQUEST_400).json({
|
||||
error: 'Cannot fetch remote information of this URL.'
|
||||
}).end()
|
||||
return res.status(HttpStatusCode.BAD_REQUEST_400)
|
||||
.json({
|
||||
error: 'Cannot fetch remote information of this URL.'
|
||||
})
|
||||
}
|
||||
|
||||
const video = buildVideo(res.locals.videoChannel.id, body, youtubeDLInfo)
|
||||
@@ -219,9 +220,8 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
|
||||
videoImportId: videoImport.id,
|
||||
generateThumbnail: !thumbnailModel,
|
||||
generatePreview: !previewModel,
|
||||
fileExt: youtubeDLInfo.fileExt
|
||||
? `.${youtubeDLInfo.fileExt}`
|
||||
: '.mp4'
|
||||
fileExt: `.${youtubeDLInfo.ext || 'mp4'}`,
|
||||
mergeExt: youtubeDLInfo.mergeExt ? `.${youtubeDLInfo.mergeExt}` : ''
|
||||
}
|
||||
await JobQueue.Instance.createJobWithPromise({ type: 'video-import', payload })
|
||||
|
||||
|
||||
@@ -19,13 +19,14 @@ import { VideoCommentModel } from '../models/video/video-comment'
|
||||
import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo'
|
||||
import { join } from 'path'
|
||||
import { root } from '../helpers/core-utils'
|
||||
import { getEnabledResolutions } from '../lib/video-transcoding'
|
||||
import { CONFIG, isEmailEnabled } from '../initializers/config'
|
||||
import { getPreview, getVideoCaption } from './lazy-static'
|
||||
import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type'
|
||||
import { MVideoFile, MVideoFullLight } from '@server/types/models'
|
||||
import { getTorrentFilePath, getVideoFilePath } from '@server/lib/video-paths'
|
||||
import { getThemeOrDefault } from '../lib/plugins/theme-utils'
|
||||
import { getEnabledResolutions, getRegisteredPlugins, getRegisteredThemes } from '@server/controllers/api/config'
|
||||
import { getRegisteredPlugins, getRegisteredThemes } from '@server/controllers/api/config'
|
||||
import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
|
||||
import { serveIndexHTML } from '@server/lib/client-html'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user