mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 09:49:20 +02:00
Add config option to keep original video file (basic first version) (#6157)
* testing not removing old file and adding columb to db * implement feature * remove unnecessary config changes * use only keptOriginalFileName, change keptOriginalFileName to keptOriginalFilename for consistency with with videoFile table, slight refactor with basename() * save original video files to dedicated directory original-video-files * begin implementing object storage (bucket) support --------- Co-authored-by: chagai.friedlander <chagai.friedlander@fairkom.eu> Co-authored-by: Ian <ian.kraft@hotmail.com> Co-authored-by: Chocobozzz <me@florianbigard.com>
This commit is contained in:
parent
ae31e90c30
commit
e57c3024f4
75 changed files with 1653 additions and 801 deletions
|
@ -19,7 +19,7 @@ async function run () {
|
|||
console.log('Moving private video files in dedicated folders.')
|
||||
|
||||
await ensureDir(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE)
|
||||
await ensureDir(DIRECTORIES.VIDEOS.PRIVATE)
|
||||
await ensureDir(DIRECTORIES.WEB_VIDEOS.PRIVATE)
|
||||
|
||||
await initDatabaseModels(true)
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ async function run () {
|
|||
console.log('Detecting files to remove, it could take a while...')
|
||||
|
||||
toDelete = toDelete.concat(
|
||||
await pruneDirectory(DIRECTORIES.VIDEOS.PUBLIC, doesWebVideoFileExist()),
|
||||
await pruneDirectory(DIRECTORIES.VIDEOS.PRIVATE, doesWebVideoFileExist()),
|
||||
await pruneDirectory(DIRECTORIES.WEB_VIDEOS.PUBLIC, doesWebVideoFileExist()),
|
||||
await pruneDirectory(DIRECTORIES.WEB_VIDEOS.PRIVATE, doesWebVideoFileExist()),
|
||||
|
||||
await pruneDirectory(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE, doesHLSPlaylistExist()),
|
||||
await pruneDirectory(DIRECTORIES.HLS_STREAMING_PLAYLIST.PUBLIC, doesHLSPlaylistExist()),
|
||||
|
@ -97,7 +97,7 @@ async function pruneDirectory (directory: string, existFun: ExistFun) {
|
|||
function doesWebVideoFileExist () {
|
||||
return (filePath: string) => {
|
||||
// Don't delete private directory
|
||||
if (filePath === DIRECTORIES.VIDEOS.PRIVATE) return true
|
||||
if (filePath === DIRECTORIES.WEB_VIDEOS.PRIVATE) return true
|
||||
|
||||
return VideoFileModel.doesOwnedWebVideoFileExist(basename(filePath))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue