X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo.ts;h=27e605be64af1265a970710e88313d76d96835e2;hb=7b6b445d91d3f0bcbb526cb1e8c1f26b96f0a971;hp=55da5305838866a8316f2c39035d4967a90bde4c;hpb=4f50475c67356fb1fecd1de6d2551fdc5ad9a739;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 55da53058..27e605be6 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -26,7 +26,7 @@ import { } from 'sequelize-typescript' import { getPrivaciesForFederation, isPrivacyForFederation, isStateForFederation } from '@server/helpers/video' import { LiveManager } from '@server/lib/live/live-manager' -import { removeHLSObjectStorage, removeWebTorrentObjectStorage } from '@server/lib/object-storage' +import { removeHLSFileObjectStorage, removeHLSObjectStorage, removeWebTorrentObjectStorage } from '@server/lib/object-storage' import { getHLSDirectory, getHLSRedundancyDirectory } from '@server/lib/paths' import { VideoPathManager } from '@server/lib/video-path-manager' import { getServerActor } from '@server/models/application/application' @@ -1816,6 +1816,25 @@ export class VideoModel extends Model>> { } } + async removeStreamingPlaylistVideoFile (streamingPlaylist: MStreamingPlaylist, videoFile: MVideoFile) { + const filePath = VideoPathManager.Instance.getFSHLSOutputPath(this, videoFile.filename) + await videoFile.removeTorrent() + await remove(filePath) + + if (videoFile.storage === VideoStorage.OBJECT_STORAGE) { + await removeHLSFileObjectStorage(streamingPlaylist.withVideo(this), videoFile.filename) + } + } + + async removeStreamingPlaylistFile (streamingPlaylist: MStreamingPlaylist, filename: string) { + const filePath = VideoPathManager.Instance.getFSHLSOutputPath(this, filename) + await remove(filePath) + + if (streamingPlaylist.storage === VideoStorage.OBJECT_STORAGE) { + await removeHLSFileObjectStorage(streamingPlaylist.withVideo(this), filename) + } + } + isOutdated () { if (this.isOwned()) return false