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 /server/models/video/video.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 'server/models/video/video.ts')
-rw-r--r-- | server/models/video/video.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 1e5648a36..0f0f894e4 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -762,8 +762,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
762 | 762 | ||
763 | // Remove physical files and torrents | 763 | // Remove physical files and torrents |
764 | instance.VideoFiles.forEach(file => { | 764 | instance.VideoFiles.forEach(file => { |
765 | tasks.push(instance.removeFile(file)) | 765 | tasks.push(instance.removeFileAndTorrent(file)) |
766 | tasks.push(file.removeTorrent()) | ||
767 | }) | 766 | }) |
768 | 767 | ||
769 | // Remove playlists file | 768 | // Remove playlists file |
@@ -1670,10 +1669,13 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
1670 | .concat(toAdd) | 1669 | .concat(toAdd) |
1671 | } | 1670 | } |
1672 | 1671 | ||
1673 | removeFile (videoFile: MVideoFile, isRedundancy = false) { | 1672 | removeFileAndTorrent (videoFile: MVideoFile, isRedundancy = false) { |
1674 | const filePath = getVideoFilePath(this, videoFile, isRedundancy) | 1673 | const filePath = getVideoFilePath(this, videoFile, isRedundancy) |
1675 | return remove(filePath) | 1674 | |
1676 | .catch(err => logger.warn('Cannot delete file %s.', filePath, { err })) | 1675 | const promises: Promise<any>[] = [ remove(filePath) ] |
1676 | if (!isRedundancy) promises.push(videoFile.removeTorrent()) | ||
1677 | |||
1678 | return Promise.all(promises) | ||
1677 | } | 1679 | } |
1678 | 1680 | ||
1679 | async removeStreamingPlaylistFiles (streamingPlaylist: MStreamingPlaylist, isRedundancy = false) { | 1681 | async removeStreamingPlaylistFiles (streamingPlaylist: MStreamingPlaylist, isRedundancy = false) { |