X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fvideo.ts;h=7c510f474ced28d07e309ec33c444b0ab4eed276;hb=88cfa3e8fa8417f14a905c089e57e1648f5a3846;hp=bfd5a9627d783de0baa418f6b4895534385a704b;hpb=24516aa26a6753517b379cf7b5104c1a24eccad6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/video.ts b/server/helpers/video.ts index bfd5a9627..7c510f474 100644 --- a/server/helpers/video.ts +++ b/server/helpers/video.ts @@ -1,20 +1,17 @@ import { Response } from 'express' import { CONFIG } from '@server/initializers/config' -import { DEFAULT_AUDIO_RESOLUTION } from '@server/initializers/constants' -import { JobQueue } from '@server/lib/job-queue' import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoAccountLightBlacklistAllFiles, - MVideoFile, MVideoFullLight, MVideoIdThumbnail, MVideoImmutable, MVideoThumbnail, MVideoWithRights } from '@server/types/models' -import { VideoPrivacy, VideoState, VideoTranscodingPayload } from '@shared/models' +import { VideoPrivacy, VideoState } from '@shared/models' import { VideoModel } from '../models/video/video' type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' | 'only-immutable-attributes' @@ -69,27 +66,6 @@ function getVideoWithAttributes (res: Response) { return res.locals.videoAll || res.locals.onlyVideo || res.locals.onlyVideoWithRights } -function addOptimizeOrMergeAudioJob (video: MVideo, videoFile: MVideoFile) { - let dataInput: VideoTranscodingPayload - - if (videoFile.isAudio()) { - dataInput = { - type: 'merge-audio-to-webtorrent', - resolution: DEFAULT_AUDIO_RESOLUTION, - videoUUID: video.uuid, - isNewVideo: true - } - } else { - dataInput = { - type: 'optimize-to-webtorrent', - videoUUID: video.uuid, - isNewVideo: true - } - } - - return JobQueue.Instance.createJobWithPromise({ type: 'video-transcoding', payload: dataInput }) -} - function extractVideo (videoOrPlaylist: MVideo | MStreamingPlaylistVideo) { return isStreamingPlaylist(videoOrPlaylist) ? videoOrPlaylist.Video @@ -107,7 +83,6 @@ function isStateForFederation (state: VideoState) { const castedState = parseInt(state + '', 10) return castedState === VideoState.PUBLISHED || castedState === VideoState.WAITING_FOR_LIVE || castedState === VideoState.LIVE_ENDED - } function getPrivaciesForFederation () { @@ -130,7 +105,6 @@ export { fetchVideo, getVideoWithAttributes, fetchVideoByUrl, - addOptimizeOrMergeAudioJob, extractVideo, getExtFromMimetype, isStateForFederation,