aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/cache/videos-preview-cache.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/cache/videos-preview-cache.ts')
-rw-r--r--server/lib/cache/videos-preview-cache.ts13
1 files changed, 6 insertions, 7 deletions
diff --git a/server/lib/cache/videos-preview-cache.ts b/server/lib/cache/videos-preview-cache.ts
index 7f352f361..c5bda8dd8 100644
--- a/server/lib/cache/videos-preview-cache.ts
+++ b/server/lib/cache/videos-preview-cache.ts
@@ -1,11 +1,10 @@
1import * as asyncLRU from 'async-lru' 1import * as asyncLRU from 'async-lru'
2import { join } from 'path'
3import { createWriteStream } from 'fs' 2import { createWriteStream } from 'fs'
4 3import { join } from 'path'
5import { database as db, CONFIG, CACHE } from '../../initializers'
6import { logger, unlinkPromise } from '../../helpers' 4import { logger, unlinkPromise } from '../../helpers'
7import { VideoInstance } from '../../models' 5import { CACHE, CONFIG } from '../../initializers'
8import { fetchRemoteVideoPreview } from '../activitypub/videos' 6import { VideoModel } from '../../models/video/video'
7import { fetchRemoteVideoPreview } from '../activitypub'
9 8
10class VideosPreviewCache { 9class VideosPreviewCache {
11 10
@@ -43,7 +42,7 @@ class VideosPreviewCache {
43 } 42 }
44 43
45 private async loadPreviews (key: string) { 44 private async loadPreviews (key: string) {
46 const video = await db.Video.loadByUUIDAndPopulateAccountAndServerAndTags(key) 45 const video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(key)
47 if (!video) return undefined 46 if (!video) return undefined
48 47
49 if (video.isOwned()) return join(CONFIG.STORAGE.PREVIEWS_DIR, video.getPreviewName()) 48 if (video.isOwned()) return join(CONFIG.STORAGE.PREVIEWS_DIR, video.getPreviewName())
@@ -53,7 +52,7 @@ class VideosPreviewCache {
53 return res 52 return res
54 } 53 }
55 54
56 private saveRemotePreviewAndReturnPath (video: VideoInstance) { 55 private saveRemotePreviewAndReturnPath (video: VideoModel) {
57 const req = fetchRemoteVideoPreview(video) 56 const req = fetchRemoteVideoPreview(video)
58 57
59 return new Promise<string>((res, rej) => { 58 return new Promise<string>((res, rej) => {