aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-06 14:33:31 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commit9e2b2e76ba5f7f570dcf59fc03bfec98ea5ffab8 (patch)
tree62717add69330345db3d7432e7218bb24d54a702 /server
parent3cabf3532b9118a19311f14ca3e171d12d554a2f (diff)
downloadPeerTube-9e2b2e76ba5f7f570dcf59fc03bfec98ea5ffab8.tar.gz
PeerTube-9e2b2e76ba5f7f570dcf59fc03bfec98ea5ffab8.tar.zst
PeerTube-9e2b2e76ba5f7f570dcf59fc03bfec98ea5ffab8.zip
Don't add live videos in redundancy
Diffstat (limited to 'server')
-rw-r--r--server/helpers/ffmpeg-utils.ts2
-rw-r--r--server/lib/job-queue/handlers/video-live-ending.ts2
-rw-r--r--server/lib/video-transcoding.ts2
-rw-r--r--server/models/redundancy/video-redundancy.ts7
-rw-r--r--server/models/video/video-file.ts2
5 files changed, 9 insertions, 6 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts
index b6f4097aa..69564a1a3 100644
--- a/server/helpers/ffmpeg-utils.ts
+++ b/server/helpers/ffmpeg-utils.ts
@@ -271,6 +271,8 @@ type TranscodeOptions =
271 | QuickTranscodeOptions 271 | QuickTranscodeOptions
272 272
273function transcode (options: TranscodeOptions) { 273function transcode (options: TranscodeOptions) {
274 logger.debug('Will run transcode.', { options })
275
274 return new Promise<void>(async (res, rej) => { 276 return new Promise<void>(async (res, rej) => {
275 try { 277 try {
276 let command = getFFmpeg(options.inputPath) 278 let command = getFFmpeg(options.inputPath)
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts
index 3d9341738..55c7a4ccb 100644
--- a/server/lib/job-queue/handlers/video-live-ending.ts
+++ b/server/lib/job-queue/handlers/video-live-ending.ts
@@ -123,7 +123,7 @@ async function saveLive (video: MVideo, live: MVideoLive) {
123} 123}
124 124
125async function cleanupLive (video: MVideo, streamingPlaylist: MStreamingPlaylist) { 125async function cleanupLive (video: MVideo, streamingPlaylist: MStreamingPlaylist) {
126 const hlsDirectory = getHLSDirectory(video, false) 126 const hlsDirectory = getHLSDirectory(video)
127 127
128 await remove(hlsDirectory) 128 await remove(hlsDirectory)
129 129
diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts
index e267b1397..9882a14db 100644
--- a/server/lib/video-transcoding.ts
+++ b/server/lib/video-transcoding.ts
@@ -174,8 +174,6 @@ async function generateHlsPlaylist (options: {
174 } 174 }
175 } 175 }
176 176
177 logger.debug('Will run transcode.', { transcodeOptions })
178
179 await transcode(transcodeOptions) 177 await transcode(transcodeOptions)
180 178
181 const playlistUrl = WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsMasterPlaylistStaticPath(video.uuid) 179 const playlistUrl = WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsMasterPlaylistStaticPath(video.uuid)
diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts
index 1c8b2cf78..1b967996c 100644
--- a/server/models/redundancy/video-redundancy.ts
+++ b/server/models/redundancy/video-redundancy.ts
@@ -268,7 +268,8 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
268 limit: randomizedFactor, 268 limit: randomizedFactor,
269 order: getVideoSort('-views'), 269 order: getVideoSort('-views'),
270 where: { 270 where: {
271 privacy: VideoPrivacy.PUBLIC 271 privacy: VideoPrivacy.PUBLIC,
272 isLive: false
272 }, 273 },
273 include: [ 274 include: [
274 await VideoRedundancyModel.buildVideoFileForDuplication(), 275 await VideoRedundancyModel.buildVideoFileForDuplication(),
@@ -288,7 +289,8 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
288 limit: randomizedFactor, 289 limit: randomizedFactor,
289 order: getVideoSort('-trending'), 290 order: getVideoSort('-trending'),
290 where: { 291 where: {
291 privacy: VideoPrivacy.PUBLIC 292 privacy: VideoPrivacy.PUBLIC,
293 isLive: false
292 }, 294 },
293 include: [ 295 include: [
294 await VideoRedundancyModel.buildVideoFileForDuplication(), 296 await VideoRedundancyModel.buildVideoFileForDuplication(),
@@ -309,6 +311,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
309 order: getVideoSort('-publishedAt'), 311 order: getVideoSort('-publishedAt'),
310 where: { 312 where: {
311 privacy: VideoPrivacy.PUBLIC, 313 privacy: VideoPrivacy.PUBLIC,
314 isLive: false,
312 views: { 315 views: {
313 [Op.gte]: minViews 316 [Op.gte]: minViews
314 } 317 }
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts
index 0e834aee0..a130317f6 100644
--- a/server/models/video/video-file.ts
+++ b/server/models/video/video-file.ts
@@ -334,7 +334,7 @@ export class VideoFileModel extends Model<VideoFileModel> {
334 } 334 }
335 335
336 isHLS () { 336 isHLS () {
337 return this.videoStreamingPlaylistId !== null 337 return !!this.videoStreamingPlaylistId
338 } 338 }
339 339
340 hasSameUniqueKeysThan (other: MVideoFile) { 340 hasSameUniqueKeysThan (other: MVideoFile) {