diff options
Diffstat (limited to 'server/lib/cache/videos-preview-cache.ts')
-rw-r--r-- | server/lib/cache/videos-preview-cache.ts | 13 |
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 @@ | |||
1 | import * as asyncLRU from 'async-lru' | 1 | import * as asyncLRU from 'async-lru' |
2 | import { join } from 'path' | ||
3 | import { createWriteStream } from 'fs' | 2 | import { createWriteStream } from 'fs' |
4 | 3 | import { join } from 'path' | |
5 | import { database as db, CONFIG, CACHE } from '../../initializers' | ||
6 | import { logger, unlinkPromise } from '../../helpers' | 4 | import { logger, unlinkPromise } from '../../helpers' |
7 | import { VideoInstance } from '../../models' | 5 | import { CACHE, CONFIG } from '../../initializers' |
8 | import { fetchRemoteVideoPreview } from '../activitypub/videos' | 6 | import { VideoModel } from '../../models/video/video' |
7 | import { fetchRemoteVideoPreview } from '../activitypub' | ||
9 | 8 | ||
10 | class VideosPreviewCache { | 9 | class 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) => { |