aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2021-11-09 11:05:35 +0100
committerGitHub <noreply@github.com>2021-11-09 11:05:35 +0100
commite1ab52d7ec7370a6f9f5937192d6003206af1ac0 (patch)
treeaecc8b696b0021e073fd205dd6e126fb4f178e8f /server/models/video/video.ts
parentc49c366ac320fe5ac3dc08f5891fe5898c1b34e3 (diff)
downloadPeerTube-e1ab52d7ec7370a6f9f5937192d6003206af1ac0.tar.gz
PeerTube-e1ab52d7ec7370a6f9f5937192d6003206af1ac0.tar.zst
PeerTube-e1ab52d7ec7370a6f9f5937192d6003206af1ac0.zip
Add migrate-to-object-storage script (#4481)
* add migrate-to-object-storage-script closes #4467 * add migrate-to-unique-playlist-filenames script * fix(migrate-to-unique-playlist-filenames): update master/segments256 run updateMasterHLSPlaylist and updateSha256VODSegments after file rename. * Improve move to object storage scripts * PR remarks Co-authored-by: Chocobozzz <me@florianbigard.com>
Diffstat (limited to 'server/models/video/video.ts')
-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