diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-30 11:53:38 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-30 11:53:38 +0100 |
commit | ca6d36227a9273f616a462d3aad6a721ab5dd627 (patch) | |
tree | a1610578e719ddb2c58199f06dd4eae436d25c0a /server/lib/files-cache/videos-caption-cache.ts | |
parent | 215304eaa06020f27152108567c6a9de16b220d3 (diff) | |
download | PeerTube-ca6d36227a9273f616a462d3aad6a721ab5dd627.tar.gz PeerTube-ca6d36227a9273f616a462d3aad6a721ab5dd627.tar.zst PeerTube-ca6d36227a9273f616a462d3aad6a721ab5dd627.zip |
Add url field in caption and use it for thumbnails
Diffstat (limited to 'server/lib/files-cache/videos-caption-cache.ts')
-rw-r--r-- | server/lib/files-cache/videos-caption-cache.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/server/lib/files-cache/videos-caption-cache.ts b/server/lib/files-cache/videos-caption-cache.ts index 440c3fde8..26ab3bd0d 100644 --- a/server/lib/files-cache/videos-caption-cache.ts +++ b/server/lib/files-cache/videos-caption-cache.ts | |||
@@ -5,7 +5,7 @@ import { VideoCaptionModel } from '../../models/video/video-caption' | |||
5 | import { AbstractVideoStaticFileCache } from './abstract-video-static-file-cache' | 5 | import { AbstractVideoStaticFileCache } from './abstract-video-static-file-cache' |
6 | import { CONFIG } from '../../initializers/config' | 6 | import { CONFIG } from '../../initializers/config' |
7 | import { logger } from '../../helpers/logger' | 7 | import { logger } from '../../helpers/logger' |
8 | import { fetchRemoteVideoStaticFile } from '../activitypub' | 8 | import { doRequestAndSaveToFile } from '@server/helpers/requests' |
9 | 9 | ||
10 | type GetPathParam = { videoId: string, language: string } | 10 | type GetPathParam = { videoId: string, language: string } |
11 | 11 | ||
@@ -46,11 +46,10 @@ class VideosCaptionCache extends AbstractVideoStaticFileCache <GetPathParam> { | |||
46 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId) | 46 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId) |
47 | if (!video) return undefined | 47 | if (!video) return undefined |
48 | 48 | ||
49 | // FIXME: use URL | 49 | const remoteUrl = videoCaption.getFileUrl(video) |
50 | const remoteStaticPath = videoCaption.getCaptionStaticPath() | ||
51 | const destPath = join(FILES_CACHE.VIDEO_CAPTIONS.DIRECTORY, videoCaption.getCaptionName()) | 50 | const destPath = join(FILES_CACHE.VIDEO_CAPTIONS.DIRECTORY, videoCaption.getCaptionName()) |
52 | 51 | ||
53 | await fetchRemoteVideoStaticFile(video, remoteStaticPath, destPath) | 52 | await doRequestAndSaveToFile({ uri: remoteUrl }, destPath) |
54 | 53 | ||
55 | return { isOwned: false, path: destPath } | 54 | return { isOwned: false, path: destPath } |
56 | } | 55 | } |