mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Add ability to disable webtorrent
In favour of HLS
This commit is contained in:
parent
14981d7331
commit
d7a25329f9
80 changed files with 1189 additions and 540 deletions
|
@ -95,6 +95,9 @@ async function getConfig (req: express.Request, res: express.Response) {
|
|||
hls: {
|
||||
enabled: CONFIG.TRANSCODING.HLS.ENABLED
|
||||
},
|
||||
webtorrent: {
|
||||
enabled: CONFIG.TRANSCODING.WEBTORRENT.ENABLED
|
||||
},
|
||||
enabledResolutions: getEnabledResolutions()
|
||||
},
|
||||
import: {
|
||||
|
@ -304,6 +307,9 @@ function customConfig (): CustomConfig {
|
|||
'1080p': CONFIG.TRANSCODING.RESOLUTIONS[ '1080p' ],
|
||||
'2160p': CONFIG.TRANSCODING.RESOLUTIONS[ '2160p' ]
|
||||
},
|
||||
webtorrent: {
|
||||
enabled: CONFIG.TRANSCODING.WEBTORRENT.ENABLED
|
||||
},
|
||||
hls: {
|
||||
enabled: CONFIG.TRANSCODING.HLS.ENABLED
|
||||
}
|
||||
|
|
|
@ -64,6 +64,8 @@ import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type'
|
|||
import { VideoTranscodingPayload } from '../../../lib/job-queue/handlers/video-transcoding'
|
||||
import { Hooks } from '../../../lib/plugins/hooks'
|
||||
import { MVideoDetails, MVideoFullLight } from '@server/typings/models'
|
||||
import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
|
||||
import { getVideoFilename, getVideoFilePath } from '@server/lib/video-paths'
|
||||
|
||||
const auditLogger = auditLoggerFactory('videos')
|
||||
const videosRouter = express.Router()
|
||||
|
@ -203,7 +205,8 @@ async function addVideo (req: express.Request, res: express.Response) {
|
|||
|
||||
const videoFile = new VideoFileModel({
|
||||
extname: extname(videoPhysicalFile.filename),
|
||||
size: videoPhysicalFile.size
|
||||
size: videoPhysicalFile.size,
|
||||
videoStreamingPlaylistId: null
|
||||
})
|
||||
|
||||
if (videoFile.isAudio()) {
|
||||
|
@ -214,11 +217,10 @@ async function addVideo (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
// Move physical file
|
||||
const videoDir = CONFIG.STORAGE.VIDEOS_DIR
|
||||
const destination = join(videoDir, video.getVideoFilename(videoFile))
|
||||
const destination = getVideoFilePath(video, videoFile)
|
||||
await move(videoPhysicalFile.path, destination)
|
||||
// This is important in case if there is another attempt in the retry process
|
||||
videoPhysicalFile.filename = video.getVideoFilename(videoFile)
|
||||
videoPhysicalFile.filename = getVideoFilePath(video, videoFile)
|
||||
videoPhysicalFile.path = destination
|
||||
|
||||
// Process thumbnail or create it from the video
|
||||
|
@ -234,7 +236,7 @@ async function addVideo (req: express.Request, res: express.Response) {
|
|||
: await generateVideoMiniature(video, videoFile, ThumbnailType.PREVIEW)
|
||||
|
||||
// Create the torrent file
|
||||
await video.createTorrentAndSetInfoHash(videoFile)
|
||||
await createTorrentAndSetInfoHash(video, videoFile)
|
||||
|
||||
const { videoCreated } = await sequelizeTypescript.transaction(async t => {
|
||||
const sequelizeOptions = { transaction: t }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue