import { AbstractVideoStaticFileCache } from './abstract-video-static-file-cache'
import { CONFIG } from '../../initializers/config'
import { logger } from '../../helpers/logger'
+import { doRequestAndSaveToFile } from '@server/helpers/requests'
type GetPathParam = { videoId: string, language: string }
const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId)
if (!video) return undefined
- // FIXME: use URL
- const remoteStaticPath = videoCaption.getCaptionStaticPath()
+ const remoteUrl = videoCaption.getFileUrl(video)
const destPath = join(FILES_CACHE.VIDEO_CAPTIONS.DIRECTORY, videoCaption.getCaptionName())
- const path = await this.saveRemoteVideoFileAndReturnPath(video, remoteStaticPath, destPath)
+ await doRequestAndSaveToFile({ uri: remoteUrl }, destPath)
- return { isOwned: false, path }
+ return { isOwned: false, path: destPath }
}
}