From f9745a2390943353022de2426acd1e6f2c71faa7 Mon Sep 17 00:00:00 2001 From: unfr Date: Thu, 23 Apr 2026 10:56:45 +0200 Subject: [PATCH] Creation automatique des dossiers tmdbintegral/* au premier run --- cron/justwatchSync.js | 2 ++ cron/tmdbExports.js | 3 ++- cron/tmdbSync.js | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cron/justwatchSync.js b/cron/justwatchSync.js index f5f49ce..d748a6c 100644 --- a/cron/justwatchSync.js +++ b/cron/justwatchSync.js @@ -68,6 +68,8 @@ function removeOrphans(type, ids) { } export async function syncType(type) { + const baseDir = type === 'movie' ? JUSTWATCH_MOVIE_DIR : JUSTWATCH_TV_DIR; + await mkdir(baseDir, { recursive: true }); const ids = await readMasterIds(type); const limiter = new Limiter(DOWNLOAD_CONCURRENCY); const tasks = []; diff --git a/cron/tmdbExports.js b/cron/tmdbExports.js index 9deccab..d94338f 100644 --- a/cron/tmdbExports.js +++ b/cron/tmdbExports.js @@ -1,5 +1,5 @@ import { createWriteStream } from 'node:fs'; -import { rename } from 'node:fs/promises'; +import { rename, mkdir } from 'node:fs/promises'; import { pipeline } from 'node:stream/promises'; import { createGunzip } from 'node:zlib'; import { Readable } from 'node:stream'; @@ -44,6 +44,7 @@ async function downloadExport(prefix, outName) { } export async function syncExports() { + await mkdir(TMDBINTEGRAL_DIR, { recursive: true }); await downloadExport('movie_ids', 'movie.json'); await downloadExport('tv_series_ids', 'tv.json'); } diff --git a/cron/tmdbSync.js b/cron/tmdbSync.js index 6a28b2e..cefc704 100644 --- a/cron/tmdbSync.js +++ b/cron/tmdbSync.js @@ -139,6 +139,8 @@ function removeOrphans(type, sortedIds) { } export async function syncType(type) { + const baseDir = type === 'movie' ? MOVIE_DIR : TV_DIR; + await mkdir(baseDir, { recursive: true }); const updates = await findChanges(type); const ids = await readMasterIds(type);