diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 17:53:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 16:50:33 +0100 |
commit | 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch) | |
tree | e5ca358287fca6ecacce83defcf23af1e8e9f419 /server/lib/cache/videos-preview-cache.ts | |
parent | c893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff) | |
download | PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip |
Move models to typescript-sequelize
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) => { |