From 71d4af1efc810f853e1a0d986bf758c201692594 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 11 Jun 2021 14:09:33 +0200 Subject: Use raw SQL for most of video queries --- scripts/create-import-video-file-job.ts | 4 ++-- scripts/prune-storage.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/create-import-video-file-job.ts b/scripts/create-import-video-file-job.ts index 5d38af066..094544e05 100644 --- a/scripts/create-import-video-file-job.ts +++ b/scripts/create-import-video-file-job.ts @@ -36,7 +36,7 @@ async function run () { return } - const video = await VideoModel.loadByUUID(options.video) + const video = await VideoModel.load(options.video) if (!video) throw new Error('Video not found.') if (video.isOwned() === false) throw new Error('Cannot import files of a non owned video.') @@ -45,7 +45,7 @@ async function run () { filePath: resolve(options.import) } - await JobQueue.Instance.init() + JobQueue.Instance.init() await JobQueue.Instance.createJobWithPromise({ type: 'video-file-import', payload: dataInput }) console.log('Import job for video %s created.', video.uuid) } diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts index 0f2d1320e..58d24816e 100755 --- a/scripts/prune-storage.ts +++ b/scripts/prune-storage.ts @@ -89,7 +89,7 @@ async function pruneDirectory (directory: string, existFun: ExistFun) { function doesVideoExist (keepOnlyOwned: boolean) { return async (file: string) => { const uuid = getUUIDFromFilename(file) - const video = await VideoModel.loadByUUID(uuid) + const video = await VideoModel.load(uuid) return video && (keepOnlyOwned === false || video.isOwned()) } -- cgit v1.2.3