From dcad0cbe8fee1055de46e249a75e7628d4ad4376 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Mon, 8 Feb 2021 03:35:24 +0100 Subject: [PATCH] Fixed scenes without movies spawning empty movie objects and triggering 'missing entry ID' warning. --- src/app.js | 2 +- src/scrapers/traxxx.js | 3 ++- src/store-releases.js | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app.js b/src/app.js index f44be31a..8f9192ac 100644 --- a/src/app.js +++ b/src/app.js @@ -84,7 +84,7 @@ async function init() { ? await fetchScenes([...(sceneUrls), ...(updateBaseScenes || []), ...(actorBaseScenes || [])]) : [...(updateBaseScenes || []), ...(actorBaseScenes || [])]; - const sceneMovies = deepScenes ? deepScenes.map(scene => ({ ...scene.movie, entity: scene.entity })).filter(Boolean) : []; + const sceneMovies = deepScenes ? deepScenes.filter(scene => scene.movie).map(scene => ({ ...scene.movie, entity: scene.entity })) : []; const deepMovies = argv.sceneMovies || argv.movie ? await fetchMovies([...(argv.movie || []), ...(sceneMovies || [])]) : sceneMovies; const movieScenes = argv.movieScenes ? deepMovies.map(movie => movie.scenes?.map(scene => ({ ...scene, movie, entity: movie.entity }))).flat().filter(Boolean) : []; diff --git a/src/scrapers/traxxx.js b/src/scrapers/traxxx.js index 97709077..38a5c8a9 100644 --- a/src/scrapers/traxxx.js +++ b/src/scrapers/traxxx.js @@ -255,7 +255,8 @@ async function fetchLatest(entity, page, options) { // release.poster = `http://${config.web.host}:${config.web.port}/img/${poster}?id=${nanoid()}`; // ensure source is unique release.poster = `http://${config.web.host}:${config.web.port}/img/${poster}`; // ensure source is unique - release.photos = photos.map(photo => `http://${config.web.host}:${config.web.port}/img/${photo}?id=${nanoid()}`); + // release.photos = photos.map(photo => `http://${config.web.host}:${config.web.port}/img/${photo}?id=${nanoid()}`); + release.photos = [release.poster]; } release.tags = await knex('tags') diff --git a/src/store-releases.js b/src/store-releases.js index f79a4e0a..e76f3a82 100644 --- a/src/store-releases.js +++ b/src/store-releases.js @@ -356,8 +356,6 @@ async function associateMovieScenes(movies, movieScenes) { return null; }).filter(Boolean); - console.log(movies, movieScenes, associations); - await bulkInsert('movies_scenes', associations, false); }