Don't add live videos in redundancy

pull/3284/head
Chocobozzz 2020-11-06 14:33:31 +01:00 committed by Chocobozzz
parent 3cabf3532b
commit 9e2b2e76ba
5 changed files with 9 additions and 6 deletions

View File

@ -271,6 +271,8 @@ type TranscodeOptions =
| QuickTranscodeOptions | QuickTranscodeOptions
function transcode (options: TranscodeOptions) { function transcode (options: TranscodeOptions) {
logger.debug('Will run transcode.', { options })
return new Promise<void>(async (res, rej) => { return new Promise<void>(async (res, rej) => {
try { try {
let command = getFFmpeg(options.inputPath) let command = getFFmpeg(options.inputPath)

View File

@ -123,7 +123,7 @@ async function saveLive (video: MVideo, live: MVideoLive) {
} }
async function cleanupLive (video: MVideo, streamingPlaylist: MStreamingPlaylist) { async function cleanupLive (video: MVideo, streamingPlaylist: MStreamingPlaylist) {
const hlsDirectory = getHLSDirectory(video, false) const hlsDirectory = getHLSDirectory(video)
await remove(hlsDirectory) await remove(hlsDirectory)

View File

@ -174,8 +174,6 @@ async function generateHlsPlaylist (options: {
} }
} }
logger.debug('Will run transcode.', { transcodeOptions })
await transcode(transcodeOptions) await transcode(transcodeOptions)
const playlistUrl = WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsMasterPlaylistStaticPath(video.uuid) const playlistUrl = WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsMasterPlaylistStaticPath(video.uuid)

View File

@ -268,7 +268,8 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
limit: randomizedFactor, limit: randomizedFactor,
order: getVideoSort('-views'), order: getVideoSort('-views'),
where: { where: {
privacy: VideoPrivacy.PUBLIC privacy: VideoPrivacy.PUBLIC,
isLive: false
}, },
include: [ include: [
await VideoRedundancyModel.buildVideoFileForDuplication(), await VideoRedundancyModel.buildVideoFileForDuplication(),
@ -288,7 +289,8 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
limit: randomizedFactor, limit: randomizedFactor,
order: getVideoSort('-trending'), order: getVideoSort('-trending'),
where: { where: {
privacy: VideoPrivacy.PUBLIC privacy: VideoPrivacy.PUBLIC,
isLive: false
}, },
include: [ include: [
await VideoRedundancyModel.buildVideoFileForDuplication(), await VideoRedundancyModel.buildVideoFileForDuplication(),
@ -309,6 +311,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
order: getVideoSort('-publishedAt'), order: getVideoSort('-publishedAt'),
where: { where: {
privacy: VideoPrivacy.PUBLIC, privacy: VideoPrivacy.PUBLIC,
isLive: false,
views: { views: {
[Op.gte]: minViews [Op.gte]: minViews
} }

View File

@ -334,7 +334,7 @@ export class VideoFileModel extends Model<VideoFileModel> {
} }
isHLS () { isHLS () {
return this.videoStreamingPlaylistId !== null return !!this.videoStreamingPlaylistId
} }
hasSameUniqueKeysThan (other: MVideoFile) { hasSameUniqueKeysThan (other: MVideoFile) {