aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-01-27 16:42:13 +0100
committerChocobozzz <me@florianbigard.com>2021-01-27 16:42:13 +0100
commit7a4994873c0b3394d04e16e877fc7418bc8b146a (patch)
tree36f7991bf29696d5ba44d7d09e35d1ec5f484140 /server/models/video
parent00b87c5791ecd645bb78cbb9872d60e1f957bdfa (diff)
downloadPeerTube-7a4994873c0b3394d04e16e877fc7418bc8b146a.tar.gz
PeerTube-7a4994873c0b3394d04e16e877fc7418bc8b146a.tar.zst
PeerTube-7a4994873c0b3394d04e16e877fc7418bc8b146a.zip
Fix rss feed with HLS videos
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-query-builder.ts3
-rw-r--r--server/models/video/video.ts36
2 files changed, 24 insertions, 15 deletions
diff --git a/server/models/video/video-query-builder.ts b/server/models/video/video-query-builder.ts
index 25d5042b7..9e5b6febb 100644
--- a/server/models/video/video-query-builder.ts
+++ b/server/models/video/video-query-builder.ts
@@ -472,6 +472,8 @@ function wrapForAPIResults (baseQuery: string, replacements: any, options: Build
472 '"VideoFiles"."videoId"': '"VideoFiles.videoId"', 472 '"VideoFiles"."videoId"': '"VideoFiles.videoId"',
473 473
474 '"VideoStreamingPlaylists"."id"': '"VideoStreamingPlaylists.id"', 474 '"VideoStreamingPlaylists"."id"': '"VideoStreamingPlaylists.id"',
475 '"VideoStreamingPlaylists"."playlistUrl"': '"VideoStreamingPlaylists.playlistUrl"',
476 '"VideoStreamingPlaylists"."type"': '"VideoStreamingPlaylists.type"',
475 '"VideoStreamingPlaylists->VideoFiles"."id"': '"VideoStreamingPlaylists.VideoFiles.id"', 477 '"VideoStreamingPlaylists->VideoFiles"."id"': '"VideoStreamingPlaylists.VideoFiles.id"',
476 '"VideoStreamingPlaylists->VideoFiles"."createdAt"': '"VideoStreamingPlaylists.VideoFiles.createdAt"', 478 '"VideoStreamingPlaylists->VideoFiles"."createdAt"': '"VideoStreamingPlaylists.VideoFiles.createdAt"',
477 '"VideoStreamingPlaylists->VideoFiles"."updatedAt"': '"VideoStreamingPlaylists.VideoFiles.updatedAt"', 479 '"VideoStreamingPlaylists->VideoFiles"."updatedAt"': '"VideoStreamingPlaylists.VideoFiles.updatedAt"',
@@ -480,6 +482,7 @@ function wrapForAPIResults (baseQuery: string, replacements: any, options: Build
480 '"VideoStreamingPlaylists->VideoFiles"."extname"': '"VideoStreamingPlaylists.VideoFiles.extname"', 482 '"VideoStreamingPlaylists->VideoFiles"."extname"': '"VideoStreamingPlaylists.VideoFiles.extname"',
481 '"VideoStreamingPlaylists->VideoFiles"."infoHash"': '"VideoStreamingPlaylists.VideoFiles.infoHash"', 483 '"VideoStreamingPlaylists->VideoFiles"."infoHash"': '"VideoStreamingPlaylists.VideoFiles.infoHash"',
482 '"VideoStreamingPlaylists->VideoFiles"."fps"': '"VideoStreamingPlaylists.VideoFiles.fps"', 484 '"VideoStreamingPlaylists->VideoFiles"."fps"': '"VideoStreamingPlaylists.VideoFiles.fps"',
485 '"VideoStreamingPlaylists->VideoFiles"."videoStreamingPlaylistId"': '"VideoStreamingPlaylists.VideoFiles.videoStreamingPlaylistId"',
483 '"VideoStreamingPlaylists->VideoFiles"."videoId"': '"VideoStreamingPlaylists.VideoFiles.videoId"' 486 '"VideoStreamingPlaylists->VideoFiles"."videoId"': '"VideoStreamingPlaylists.VideoFiles.videoId"'
484 }) 487 })
485 } 488 }
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 343abde44..9b0aa809e 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -152,8 +152,6 @@ export type ForAPIOptions = {
152 152
153 videoPlaylistId?: number 153 videoPlaylistId?: number
154 154
155 withFiles?: boolean
156
157 withAccountBlockerIds?: number[] 155 withAccountBlockerIds?: number[]
158} 156}
159 157
@@ -220,13 +218,6 @@ export type AvailableForListIDsOptions = {
220 } 218 }
221 } 219 }
222 220
223 if (options.withFiles === true) {
224 include.push({
225 model: VideoFileModel,
226 required: true
227 })
228 }
229
230 if (options.videoPlaylistId) { 221 if (options.videoPlaylistId) {
231 include.push({ 222 include.push({
232 model: VideoPlaylistElementModel.unscoped(), 223 model: VideoPlaylistElementModel.unscoped(),
@@ -1622,8 +1613,19 @@ export class VideoModel extends Model {
1622 const avatarKeys = [ 'id', 'filename', 'fileUrl', 'onDisk', 'createdAt', 'updatedAt' ] 1613 const avatarKeys = [ 'id', 'filename', 'fileUrl', 'onDisk', 'createdAt', 'updatedAt' ]
1623 const actorKeys = [ 'id', 'preferredUsername', 'url', 'serverId', 'avatarId' ] 1614 const actorKeys = [ 'id', 'preferredUsername', 'url', 'serverId', 'avatarId' ]
1624 const serverKeys = [ 'id', 'host' ] 1615 const serverKeys = [ 'id', 'host' ]
1625 const videoFileKeys = [ 'id', 'createdAt', 'updatedAt', 'resolution', 'size', 'extname', 'infoHash', 'fps', 'videoId' ] 1616 const videoFileKeys = [
1626 const videoStreamingPlaylistKeys = [ 'id' ] 1617 'id',
1618 'createdAt',
1619 'updatedAt',
1620 'resolution',
1621 'size',
1622 'extname',
1623 'infoHash',
1624 'fps',
1625 'videoId',
1626 'videoStreamingPlaylistId'
1627 ]
1628 const videoStreamingPlaylistKeys = [ 'id', 'type', 'playlistUrl' ]
1627 const videoKeys = [ 1629 const videoKeys = [
1628 'id', 1630 'id',
1629 'uuid', 1631 'uuid',
@@ -1882,17 +1884,21 @@ export class VideoModel extends Model {
1882 1884
1883 getFormattedVideoFilesJSON (): VideoFile[] { 1885 getFormattedVideoFilesJSON (): VideoFile[] {
1884 const { baseUrlHttp, baseUrlWs } = this.getBaseUrls() 1886 const { baseUrlHttp, baseUrlWs } = this.getBaseUrls()
1885 let files: MVideoFileRedundanciesOpt[] = [] 1887 let files: VideoFile[] = []
1886 1888
1887 if (Array.isArray(this.VideoFiles)) { 1889 if (Array.isArray(this.VideoFiles)) {
1888 files = files.concat(this.VideoFiles) 1890 const result = videoFilesModelToFormattedJSON(this, baseUrlHttp, baseUrlWs, this.VideoFiles)
1891 files = files.concat(result)
1889 } 1892 }
1890 1893
1891 for (const p of (this.VideoStreamingPlaylists || [])) { 1894 for (const p of (this.VideoStreamingPlaylists || [])) {
1892 files = files.concat(p.VideoFiles || []) 1895 p.Video = this
1896
1897 const result = videoFilesModelToFormattedJSON(p, baseUrlHttp, baseUrlWs, p.VideoFiles)
1898 files = files.concat(result)
1893 } 1899 }
1894 1900
1895 return videoFilesModelToFormattedJSON(this, baseUrlHttp, baseUrlWs, files) 1901 return files
1896 } 1902 }
1897 1903
1898 toActivityPubObject (this: MVideoAP): VideoObject { 1904 toActivityPubObject (this: MVideoAP): VideoObject {