aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/update-host.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-23 11:20:00 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-07-26 11:29:31 +0200
commit764b1a14fc494f2cfd7ea590d2f07b01df65c7ad (patch)
tree198ca5f242c63a205a05fa4cfd6d063277c541fd /scripts/update-host.ts
parent83903cb65d531a6b6b91715387493ba8312b264d (diff)
downloadPeerTube-764b1a14fc494f2cfd7ea590d2f07b01df65c7ad.tar.gz
PeerTube-764b1a14fc494f2cfd7ea590d2f07b01df65c7ad.tar.zst
PeerTube-764b1a14fc494f2cfd7ea590d2f07b01df65c7ad.zip
Use random names for VOD HLS playlists
Diffstat (limited to 'scripts/update-host.ts')
-rwxr-xr-xscripts/update-host.ts13
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'
16import { VideoCommentModel } from '../server/models/video/video-comment' 16import { VideoCommentModel } from '../server/models/video/video-comment'
17import { AccountModel } from '../server/models/account/account' 17import { AccountModel } from '../server/models/account/account'
18import { VideoChannelModel } from '../server/models/video/video-channel' 18import { VideoChannelModel } from '../server/models/video/video-channel'
19import { VideoStreamingPlaylistModel } from '../server/models/video/video-streaming-playlist'
20import { initDatabaseModels } from '../server/initializers/database' 19import { initDatabaseModels } from '../server/initializers/database'
21import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' 20import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
22import { getServerActor } from '@server/models/application/application' 21import { 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}