aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/files-cache/videos-caption-cache.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-17 10:07:00 +0200
committerChocobozzz <me@florianbigard.com>2019-04-24 16:25:52 +0200
commite8bafea35bc930cb8ac5b2d521a188642a1adffe (patch)
tree7537f957ed7307b464e3c90b71b813d992acaade /server/lib/files-cache/videos-caption-cache.ts
parent94565d52bb2883e09f16d1363170ac9c0dccb7a1 (diff)
downloadPeerTube-e8bafea35bc930cb8ac5b2d521a188642a1adffe.tar.gz
PeerTube-e8bafea35bc930cb8ac5b2d521a188642a1adffe.tar.zst
PeerTube-e8bafea35bc930cb8ac5b2d521a188642a1adffe.zip
Create a dedicated table to track video thumbnails
Diffstat (limited to 'server/lib/files-cache/videos-caption-cache.ts')
-rw-r--r--server/lib/files-cache/videos-caption-cache.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/lib/files-cache/videos-caption-cache.ts b/server/lib/files-cache/videos-caption-cache.ts
index 0926f4009..d4a0a3345 100644
--- a/server/lib/files-cache/videos-caption-cache.ts
+++ b/server/lib/files-cache/videos-caption-cache.ts
@@ -20,14 +20,14 @@ class VideosCaptionCache extends AbstractVideoStaticFileCache <GetPathParam> {
20 return this.instance || (this.instance = new this()) 20 return this.instance || (this.instance = new this())
21 } 21 }
22 22
23 async getFilePath (params: GetPathParam) { 23 async getFilePathImpl (params: GetPathParam) {
24 const videoCaption = await VideoCaptionModel.loadByVideoIdAndLanguage(params.videoId, params.language) 24 const videoCaption = await VideoCaptionModel.loadByVideoIdAndLanguage(params.videoId, params.language)
25 if (!videoCaption) return undefined 25 if (!videoCaption) return undefined
26 26
27 if (videoCaption.isOwned()) return join(CONFIG.STORAGE.CAPTIONS_DIR, videoCaption.getCaptionName()) 27 if (videoCaption.isOwned()) return join(CONFIG.STORAGE.CAPTIONS_DIR, videoCaption.getCaptionName())
28 28
29 const key = params.videoId + VideosCaptionCache.KEY_DELIMITER + params.language 29 const key = params.videoId + VideosCaptionCache.KEY_DELIMITER + params.language
30 return this.loadFromLRU(key) 30 return this.loadRemoteFile(key)
31 } 31 }
32 32
33 protected async loadRemoteFile (key: string) { 33 protected async loadRemoteFile (key: string) {
@@ -42,6 +42,7 @@ class VideosCaptionCache extends AbstractVideoStaticFileCache <GetPathParam> {
42 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId) 42 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId)
43 if (!video) return undefined 43 if (!video) return undefined
44 44
45 // FIXME: use URL
45 const remoteStaticPath = videoCaption.getCaptionStaticPath() 46 const remoteStaticPath = videoCaption.getCaptionStaticPath()
46 const destPath = join(FILES_CACHE.VIDEO_CAPTIONS.DIRECTORY, videoCaption.getCaptionName()) 47 const destPath = join(FILES_CACHE.VIDEO_CAPTIONS.DIRECTORY, videoCaption.getCaptionName())
47 48