diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-23 11:20:00 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-07-26 11:29:31 +0200 |
commit | 764b1a14fc494f2cfd7ea590d2f07b01df65c7ad (patch) | |
tree | 198ca5f242c63a205a05fa4cfd6d063277c541fd /scripts/update-host.ts | |
parent | 83903cb65d531a6b6b91715387493ba8312b264d (diff) | |
download | PeerTube-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-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 | } |