From 73b28866ac398d9064a834f58e87aa9a91b61588 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Mon, 8 Feb 2021 02:10:56 +0100 Subject: [PATCH] Scene tile uses first photo if poster is unavailable. --- assets/components/releases/scene-tile.vue | 20 +++++++------------- assets/js/fragments.js | 1 + src/scrapers/traxxx.js | 11 +++++++++-- src/store-releases.js | 2 ++ 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/assets/components/releases/scene-tile.vue b/assets/components/releases/scene-tile.vue index f2b53415..dd28d0a2 100644 --- a/assets/components/releases/scene-tile.vue +++ b/assets/components/releases/scene-tile.vue @@ -26,20 +26,14 @@ loading="lazy" > - - -
`${options.source}?id=${nanoid()}`); // ensure source is unique } else { // select from local SFW database - const [poster, ...photos] = await knex('media') + const [/* poster */, ...photos] = await knex('media') .select('path') .where('is_sfw', true) .pluck('path') .orderByRaw('random()') .limit(Math.floor(Math.random() * 10) + 1); - release.poster = `http://${config.web.host}:${config.web.port}/img/${poster}?id=${nanoid()}`; // ensure source is unique + const [poster] = await knex('media') + .select('path') + .where('is_sfw', true) + .pluck('path') + .limit(1); + + // 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()}`); } diff --git a/src/store-releases.js b/src/store-releases.js index e76f3a82..f79a4e0a 100644 --- a/src/store-releases.js +++ b/src/store-releases.js @@ -356,6 +356,8 @@ async function associateMovieScenes(movies, movieScenes) { return null; }).filter(Boolean); + console.log(movies, movieScenes, associations); + await bulkInsert('movies_scenes', associations, false); }