mirror of https://github.com/Chocobozzz/PeerTube
Fix live files include
parent
b8afe6f0cd
commit
668f864f5a
|
@ -102,9 +102,8 @@ export class AbstractVideosModelQueryBuilder extends AbstractVideosQueryBuilder
|
|||
}
|
||||
}
|
||||
|
||||
protected includeWebtorrentFiles (required: boolean) {
|
||||
const joinType = required ? 'INNER' : 'LEFT'
|
||||
this.addJoin(joinType + ' JOIN "videoFile" AS "VideoFiles" ON "VideoFiles"."videoId" = "video"."id"')
|
||||
protected includeWebtorrentFiles () {
|
||||
this.addJoin('LEFT JOIN "videoFile" AS "VideoFiles" ON "VideoFiles"."videoId" = "video"."id"')
|
||||
|
||||
this.attributes = {
|
||||
...this.attributes,
|
||||
|
@ -113,15 +112,13 @@ export class AbstractVideosModelQueryBuilder extends AbstractVideosQueryBuilder
|
|||
}
|
||||
}
|
||||
|
||||
protected includeStreamingPlaylistFiles (required: boolean) {
|
||||
const joinType = required ? 'INNER' : 'LEFT'
|
||||
|
||||
protected includeStreamingPlaylistFiles () {
|
||||
this.addJoin(
|
||||
joinType + ' JOIN "videoStreamingPlaylist" AS "VideoStreamingPlaylists" ON "VideoStreamingPlaylists"."videoId" = "video"."id"'
|
||||
'LEFT JOIN "videoStreamingPlaylist" AS "VideoStreamingPlaylists" ON "VideoStreamingPlaylists"."videoId" = "video"."id"'
|
||||
)
|
||||
|
||||
this.addJoin(
|
||||
joinType + ' JOIN "videoFile" AS "VideoStreamingPlaylists->VideoFiles" ' +
|
||||
'LEFT JOIN "videoFile" AS "VideoStreamingPlaylists->VideoFiles" ' +
|
||||
'ON "VideoStreamingPlaylists->VideoFiles"."videoStreamingPlaylistId" = "VideoStreamingPlaylists"."id"'
|
||||
)
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ export class VideoFileQueryBuilder extends AbstractVideosModelQueryBuilder {
|
|||
'"video"."id"': ''
|
||||
}
|
||||
|
||||
this.includeWebtorrentFiles(true)
|
||||
this.includeWebtorrentFiles()
|
||||
|
||||
if (this.shouldIncludeRedundancies(options)) {
|
||||
this.includeWebTorrentRedundancies()
|
||||
|
@ -48,7 +48,7 @@ export class VideoFileQueryBuilder extends AbstractVideosModelQueryBuilder {
|
|||
'"video"."id"': ''
|
||||
}
|
||||
|
||||
this.includeStreamingPlaylistFiles(true)
|
||||
this.includeStreamingPlaylistFiles()
|
||||
|
||||
if (this.shouldIncludeRedundancies(options)) {
|
||||
this.includeStreamingPlaylistRedundancies()
|
||||
|
|
|
@ -108,9 +108,12 @@ export class VideoModelBuilder {
|
|||
if (!rowsWebTorrentFiles) return
|
||||
|
||||
for (const row of rowsWebTorrentFiles) {
|
||||
const id = row['VideoFiles.id']
|
||||
if (!id) continue
|
||||
|
||||
const videoModel = this.videosMemo[row.id]
|
||||
this.addWebTorrentFile(row, videoModel)
|
||||
this.addRedundancy(row, 'VideoFiles.RedundancyVideos', this.videoFileMemo[row['VideoFiles.id']])
|
||||
this.addRedundancy(row, 'VideoFiles.RedundancyVideos', this.videoFileMemo[id])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,6 +121,9 @@ export class VideoModelBuilder {
|
|||
if (!rowsStreamingPlaylist) return
|
||||
|
||||
for (const row of rowsStreamingPlaylist || []) {
|
||||
const id = row['VideoStreamingPlaylists.id']
|
||||
if (!id) continue
|
||||
|
||||
const videoModel = this.videosMemo[row.id]
|
||||
|
||||
this.addStreamingPlaylist(row, videoModel)
|
||||
|
@ -125,7 +131,7 @@ export class VideoModelBuilder {
|
|||
this.addRedundancy(
|
||||
row,
|
||||
'VideoStreamingPlaylists.RedundancyVideos',
|
||||
this.videoStreamingPlaylistMemo[row['VideoStreamingPlaylists.id']]
|
||||
this.videoStreamingPlaylistMemo[id]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ export class VideosModelListQueryBuilder extends AbstractVideosModelQueryBuilder
|
|||
this.includeThumbnails()
|
||||
|
||||
if (options.withFiles) {
|
||||
this.includeWebtorrentFiles(false)
|
||||
this.includeStreamingPlaylistFiles(false)
|
||||
this.includeWebtorrentFiles()
|
||||
this.includeStreamingPlaylistFiles()
|
||||
}
|
||||
|
||||
if (options.user) {
|
||||
|
|
|
@ -27,7 +27,7 @@ import {
|
|||
|
||||
const expect = chai.expect
|
||||
|
||||
describe('Permenant live', function () {
|
||||
describe('Permanent live', function () {
|
||||
let servers: ServerInfo[] = []
|
||||
let videoUUID: string
|
||||
|
||||
|
|
Loading…
Reference in New Issue