From e1ab52d7ec7370a6f9f5937192d6003206af1ac0 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Tue, 9 Nov 2021 11:05:35 +0100 Subject: 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 --- server/models/video/video.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'server/models/video') 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>> { await Promise.all(tasks) } - static listLocal (): Promise { + static listLocalIds (): Promise { const query = { + attributes: [ 'id' ], + raw: true, where: { remote: false } } return VideoModel.findAll(query) + .then(rows => rows.map(r => r.id)) } static listAllAndSharedByActorForOutbox (actorId: number, start: number, count: number) { @@ -1674,6 +1677,8 @@ export class VideoModel extends Model>> { if (!this.VideoStreamingPlaylists) return undefined const playlist = this.VideoStreamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS) + if (!playlist) return undefined + playlist.Video = this return playlist @@ -1785,7 +1790,7 @@ export class VideoModel extends Model>> { await this.save({ transaction }) } - getBandwidthBits (videoFile: MVideoFile) { + getBandwidthBits (this: MVideo, videoFile: MVideoFile) { return Math.ceil((videoFile.size * 8) / this.duration) } -- cgit v1.2.3