aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/video.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index aef4fd20a..3eed1b58d 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -805,14 +805,17 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
805 await Promise.all(tasks) 805 await Promise.all(tasks)
806 } 806 }
807 807
808 static listLocal (): Promise<MVideo[]> { 808 static listLocalIds (): Promise<number[]> {
809 const query = { 809 const query = {
810 attributes: [ 'id' ],
811 raw: true,
810 where: { 812 where: {
811 remote: false 813 remote: false
812 } 814 }
813 } 815 }
814 816
815 return VideoModel.findAll(query) 817 return VideoModel.findAll(query)
818 .then(rows => rows.map(r => r.id))
816 } 819 }
817 820
818 static listAllAndSharedByActorForOutbox (actorId: number, start: number, count: number) { 821 static listAllAndSharedByActorForOutbox (actorId: number, start: number, count: number) {
@@ -1674,6 +1677,8 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1674 if (!this.VideoStreamingPlaylists) return undefined 1677 if (!this.VideoStreamingPlaylists) return undefined
1675 1678
1676 const playlist = this.VideoStreamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS) 1679 const playlist = this.VideoStreamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS)
1680 if (!playlist) return undefined
1681
1677 playlist.Video = this 1682 playlist.Video = this
1678 1683
1679 return playlist 1684 return playlist
@@ -1785,7 +1790,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1785 await this.save({ transaction }) 1790 await this.save({ transaction })
1786 } 1791 }
1787 1792
1788 getBandwidthBits (videoFile: MVideoFile) { 1793 getBandwidthBits (this: MVideo, videoFile: MVideoFile) {
1789 return Math.ceil((videoFile.size * 8) / this.duration) 1794 return Math.ceil((videoFile.size * 8) / this.duration)
1790 } 1795 }
1791 1796