aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-12-04 17:08:55 +0100
committerChocobozzz <me@florianbigard.com>2018-12-04 17:08:55 +0100
commitb9fffa297f49a84df8ffd0d7b842599bc88a8e3e (patch)
tree49a12ebebf4d533e8b273abbb9492350a233101d /server/models/video/video.ts
parent6040f87d143a5fa01db79867ece8197c3ce7be47 (diff)
downloadPeerTube-b9fffa297f49a84df8ffd0d7b842599bc88a8e3e.tar.gz
PeerTube-b9fffa297f49a84df8ffd0d7b842599bc88a8e3e.tar.zst
PeerTube-b9fffa297f49a84df8ffd0d7b842599bc88a8e3e.zip
Create redundancy endpoint
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 0f18d9f0c..e8cb5aa88 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -1538,8 +1538,10 @@ export class VideoModel extends Model<VideoModel> {
1538 .catch(err => logger.warn('Cannot delete preview %s.', previewPath, { err })) 1538 .catch(err => logger.warn('Cannot delete preview %s.', previewPath, { err }))
1539 } 1539 }
1540 1540
1541 removeFile (videoFile: VideoFileModel) { 1541 removeFile (videoFile: VideoFileModel, isRedundancy = false) {
1542 const filePath = join(CONFIG.STORAGE.VIDEOS_DIR, this.getVideoFilename(videoFile)) 1542 const baseDir = isRedundancy ? CONFIG.STORAGE.REDUNDANCY_DIR : CONFIG.STORAGE.VIDEOS_DIR
1543
1544 const filePath = join(baseDir, this.getVideoFilename(videoFile))
1543 return remove(filePath) 1545 return remove(filePath)
1544 .catch(err => logger.warn('Cannot delete file %s.', filePath, { err })) 1546 .catch(err => logger.warn('Cannot delete file %s.', filePath, { err }))
1545 } 1547 }
@@ -1617,6 +1619,10 @@ export class VideoModel extends Model<VideoModel> {
1617 return baseUrlHttp + STATIC_PATHS.WEBSEED + this.getVideoFilename(videoFile) 1619 return baseUrlHttp + STATIC_PATHS.WEBSEED + this.getVideoFilename(videoFile)
1618 } 1620 }
1619 1621
1622 getVideoRedundancyUrl (videoFile: VideoFileModel, baseUrlHttp: string) {
1623 return baseUrlHttp + STATIC_PATHS.REDUNDANCY + this.getVideoFilename(videoFile)
1624 }
1625
1620 getVideoFileDownloadUrl (videoFile: VideoFileModel, baseUrlHttp: string) { 1626 getVideoFileDownloadUrl (videoFile: VideoFileModel, baseUrlHttp: string) {
1621 return baseUrlHttp + STATIC_DOWNLOAD_PATHS.VIDEOS + this.getVideoFilename(videoFile) 1627 return baseUrlHttp + STATIC_DOWNLOAD_PATHS.VIDEOS + this.getVideoFilename(videoFile)
1622 } 1628 }