diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-24 16:11:37 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-24 16:11:37 +0200 |
commit | 97816649b793bdd0f3df64631ae0ef7cf3d7461c (patch) | |
tree | abd56aac43d2d79dc4840d2ed6385449e1563286 /server/models/video/video-query-builder.ts | |
parent | 74055dc882e484b217f398917a3cc24bf2ea8cbe (diff) | |
download | PeerTube-97816649b793bdd0f3df64631ae0ef7cf3d7461c.tar.gz PeerTube-97816649b793bdd0f3df64631ae0ef7cf3d7461c.tar.zst PeerTube-97816649b793bdd0f3df64631ae0ef7cf3d7461c.zip |
Fix RSS feed when HLS only is enabled
Diffstat (limited to 'server/models/video/video-query-builder.ts')
-rw-r--r-- | server/models/video/video-query-builder.ts | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/server/models/video/video-query-builder.ts b/server/models/video/video-query-builder.ts index 466890364..b14bb16d6 100644 --- a/server/models/video/video-query-builder.ts +++ b/server/models/video/video-query-builder.ts | |||
@@ -156,7 +156,16 @@ function buildListQuery (model: typeof Model, options: BuildVideosQueryOptions) | |||
156 | } | 156 | } |
157 | 157 | ||
158 | if (options.withFiles === true) { | 158 | if (options.withFiles === true) { |
159 | and.push('EXISTS (SELECT 1 FROM "videoFile" WHERE "videoFile"."videoId" = "video"."id")') | 159 | and.push( |
160 | '(' + | ||
161 | ' EXISTS (SELECT 1 FROM "videoFile" WHERE "videoFile"."videoId" = "video"."id") ' + | ||
162 | ' OR EXISTS (' + | ||
163 | ' SELECT 1 FROM "videoStreamingPlaylist" ' + | ||
164 | ' INNER JOIN "videoFile" ON "videoFile"."videoStreamingPlaylistId" = "videoStreamingPlaylist"."id" ' + | ||
165 | ' WHERE "videoStreamingPlaylist"."videoId" = "video"."id"' + | ||
166 | ' )' + | ||
167 | ')' | ||
168 | ) | ||
160 | } | 169 | } |
161 | 170 | ||
162 | if (options.tagsOneOf) { | 171 | if (options.tagsOneOf) { |
@@ -443,7 +452,13 @@ function wrapForAPIResults (baseQuery: string, replacements: any, options: Build | |||
443 | ] | 452 | ] |
444 | 453 | ||
445 | if (options.withFiles) { | 454 | if (options.withFiles) { |
446 | joins.push('INNER JOIN "videoFile" AS "VideoFiles" ON "VideoFiles"."videoId" = "video"."id"') | 455 | joins.push('LEFT JOIN "videoFile" AS "VideoFiles" ON "VideoFiles"."videoId" = "video"."id"') |
456 | |||
457 | joins.push('LEFT JOIN "videoStreamingPlaylist" AS "VideoStreamingPlaylists" ON "VideoStreamingPlaylists"."videoId" = "video"."id"') | ||
458 | joins.push( | ||
459 | 'LEFT JOIN "videoFile" AS "VideoStreamingPlaylists->VideoFiles" ' + | ||
460 | 'ON "VideoStreamingPlaylists->VideoFiles"."videoStreamingPlaylistId" = "VideoStreamingPlaylists"."id"' | ||
461 | ) | ||
447 | 462 | ||
448 | Object.assign(attributes, { | 463 | Object.assign(attributes, { |
449 | '"VideoFiles"."id"': '"VideoFiles.id"', | 464 | '"VideoFiles"."id"': '"VideoFiles.id"', |
@@ -454,7 +469,18 @@ function wrapForAPIResults (baseQuery: string, replacements: any, options: Build | |||
454 | '"VideoFiles"."extname"': '"VideoFiles.extname"', | 469 | '"VideoFiles"."extname"': '"VideoFiles.extname"', |
455 | '"VideoFiles"."infoHash"': '"VideoFiles.infoHash"', | 470 | '"VideoFiles"."infoHash"': '"VideoFiles.infoHash"', |
456 | '"VideoFiles"."fps"': '"VideoFiles.fps"', | 471 | '"VideoFiles"."fps"': '"VideoFiles.fps"', |
457 | '"VideoFiles"."videoId"': '"VideoFiles.videoId"' | 472 | '"VideoFiles"."videoId"': '"VideoFiles.videoId"', |
473 | |||
474 | '"VideoStreamingPlaylists"."id"': '"VideoStreamingPlaylists.id"', | ||
475 | '"VideoStreamingPlaylists->VideoFiles"."id"': '"VideoStreamingPlaylists.VideoFiles.id"', | ||
476 | '"VideoStreamingPlaylists->VideoFiles"."createdAt"': '"VideoStreamingPlaylists.VideoFiles.createdAt"', | ||
477 | '"VideoStreamingPlaylists->VideoFiles"."updatedAt"': '"VideoStreamingPlaylists.VideoFiles.updatedAt"', | ||
478 | '"VideoStreamingPlaylists->VideoFiles"."resolution"': '"VideoStreamingPlaylists.VideoFiles.resolution"', | ||
479 | '"VideoStreamingPlaylists->VideoFiles"."size"': '"VideoStreamingPlaylists.VideoFiles.size"', | ||
480 | '"VideoStreamingPlaylists->VideoFiles"."extname"': '"VideoStreamingPlaylists.VideoFiles.extname"', | ||
481 | '"VideoStreamingPlaylists->VideoFiles"."infoHash"': '"VideoStreamingPlaylists.VideoFiles.infoHash"', | ||
482 | '"VideoStreamingPlaylists->VideoFiles"."fps"': '"VideoStreamingPlaylists.VideoFiles.fps"', | ||
483 | '"VideoStreamingPlaylists->VideoFiles"."videoId"': '"VideoStreamingPlaylists.VideoFiles.videoId"' | ||
458 | }) | 484 | }) |
459 | } | 485 | } |
460 | 486 | ||