diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-25 10:57:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-25 10:57:16 +0200 |
commit | 7b6b445d91d3f0bcbb526cb1e8c1f26b96f0a971 (patch) | |
tree | 1bc9724411941e0082243164d6cc53d02902b1f7 /server/models/video/video.ts | |
parent | 4f50475c67356fb1fecd1de6d2551fdc5ad9a739 (diff) | |
download | PeerTube-7b6b445d91d3f0bcbb526cb1e8c1f26b96f0a971.tar.gz PeerTube-7b6b445d91d3f0bcbb526cb1e8c1f26b96f0a971.tar.zst PeerTube-7b6b445d91d3f0bcbb526cb1e8c1f26b96f0a971.zip |
Regenerate video filenames on transcoding
In particular when using manual transcoding, to invalidate potential
HTTP caches in front of peertube
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r-- | server/models/video/video.ts | 21 |
1 files changed, 20 insertions, 1 deletions
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 { | |||
26 | } from 'sequelize-typescript' | 26 | } from 'sequelize-typescript' |
27 | import { getPrivaciesForFederation, isPrivacyForFederation, isStateForFederation } from '@server/helpers/video' | 27 | import { getPrivaciesForFederation, isPrivacyForFederation, isStateForFederation } from '@server/helpers/video' |
28 | import { LiveManager } from '@server/lib/live/live-manager' | 28 | import { LiveManager } from '@server/lib/live/live-manager' |
29 | import { removeHLSObjectStorage, removeWebTorrentObjectStorage } from '@server/lib/object-storage' | 29 | import { removeHLSFileObjectStorage, removeHLSObjectStorage, removeWebTorrentObjectStorage } from '@server/lib/object-storage' |
30 | import { getHLSDirectory, getHLSRedundancyDirectory } from '@server/lib/paths' | 30 | import { getHLSDirectory, getHLSRedundancyDirectory } from '@server/lib/paths' |
31 | import { VideoPathManager } from '@server/lib/video-path-manager' | 31 | import { VideoPathManager } from '@server/lib/video-path-manager' |
32 | import { getServerActor } from '@server/models/application/application' | 32 | import { getServerActor } from '@server/models/application/application' |
@@ -1816,6 +1816,25 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
1816 | } | 1816 | } |
1817 | } | 1817 | } |
1818 | 1818 | ||
1819 | async removeStreamingPlaylistVideoFile (streamingPlaylist: MStreamingPlaylist, videoFile: MVideoFile) { | ||
1820 | const filePath = VideoPathManager.Instance.getFSHLSOutputPath(this, videoFile.filename) | ||
1821 | await videoFile.removeTorrent() | ||
1822 | await remove(filePath) | ||
1823 | |||
1824 | if (videoFile.storage === VideoStorage.OBJECT_STORAGE) { | ||
1825 | await removeHLSFileObjectStorage(streamingPlaylist.withVideo(this), videoFile.filename) | ||
1826 | } | ||
1827 | } | ||
1828 | |||
1829 | async removeStreamingPlaylistFile (streamingPlaylist: MStreamingPlaylist, filename: string) { | ||
1830 | const filePath = VideoPathManager.Instance.getFSHLSOutputPath(this, filename) | ||
1831 | await remove(filePath) | ||
1832 | |||
1833 | if (streamingPlaylist.storage === VideoStorage.OBJECT_STORAGE) { | ||
1834 | await removeHLSFileObjectStorage(streamingPlaylist.withVideo(this), filename) | ||
1835 | } | ||
1836 | } | ||
1837 | |||
1819 | isOutdated () { | 1838 | isOutdated () { |
1820 | if (this.isOwned()) return false | 1839 | if (this.isOwned()) return false |
1821 | 1840 | ||