diff options
Diffstat (limited to 'scripts/update-host.ts')
-rwxr-xr-x | scripts/update-host.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/update-host.ts b/scripts/update-host.ts index 592684225..9e8dd41ca 100755 --- a/scripts/update-host.ts +++ b/scripts/update-host.ts | |||
@@ -16,7 +16,6 @@ import { VideoShareModel } from '../server/models/video/video-share' | |||
16 | import { VideoCommentModel } from '../server/models/video/video-comment' | 16 | import { VideoCommentModel } from '../server/models/video/video-comment' |
17 | import { AccountModel } from '../server/models/account/account' | 17 | import { AccountModel } from '../server/models/account/account' |
18 | import { VideoChannelModel } from '../server/models/video/video-channel' | 18 | import { VideoChannelModel } from '../server/models/video/video-channel' |
19 | import { VideoStreamingPlaylistModel } from '../server/models/video/video-streaming-playlist' | ||
20 | import { initDatabaseModels } from '../server/initializers/database' | 19 | import { initDatabaseModels } from '../server/initializers/database' |
21 | import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' | 20 | import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' |
22 | import { getServerActor } from '@server/models/application/application' | 21 | import { getServerActor } from '@server/models/application/application' |
@@ -128,13 +127,17 @@ async function run () { | |||
128 | for (const file of video.VideoFiles) { | 127 | for (const file of video.VideoFiles) { |
129 | console.log('Updating torrent file %s of video %s.', file.resolution, video.uuid) | 128 | console.log('Updating torrent file %s of video %s.', file.resolution, video.uuid) |
130 | await createTorrentAndSetInfoHash(video, file) | 129 | await createTorrentAndSetInfoHash(video, file) |
130 | |||
131 | await file.save() | ||
131 | } | 132 | } |
132 | 133 | ||
133 | for (const playlist of video.VideoStreamingPlaylists) { | 134 | const playlist = video.getHLSPlaylist() |
134 | playlist.playlistUrl = WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsMasterPlaylistStaticPath(video.uuid) | 135 | for (const file of (playlist?.VideoFiles || [])) { |
135 | playlist.segmentsSha256Url = WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsSha256SegmentsStaticPath(video.uuid, video.isLive) | 136 | console.log('Updating fragmented torrent file %s of video %s.', file.resolution, video.uuid) |
137 | |||
138 | await createTorrentAndSetInfoHash(video, file) | ||
136 | 139 | ||
137 | await playlist.save() | 140 | await file.save() |
138 | } | 141 | } |
139 | } | 142 | } |
140 | } | 143 | } |