Merging improvements.

This commit is contained in:
DebaucheryLibrarian 2021-01-27 00:21:58 +01:00
parent 7185c8dc08
commit 4d89256a4c
10 changed files with 20 additions and 15 deletions

View File

@ -83,6 +83,7 @@
> >
<span class="movie-title">{{ movie.title }}</span> <span class="movie-title">{{ movie.title }}</span>
<img <img
v-if="movie.covers.length > 0"
:src="`/media/${movie.covers[0].thumbnail}`" :src="`/media/${movie.covers[0].thumbnail}`"
class="movie-cover" class="movie-cover"
> >

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -891,7 +891,7 @@ const tags = [
{ {
name: 'toys', name: 'toys',
slug: 'toys', slug: 'toys',
priority: 7, priority: 6,
}, },
{ {
name: 'toy anal', name: 'toy anal',

View File

@ -729,6 +729,7 @@ const tagPhotos = [
['creampie', 'poster', 'Alina Lopez in "Making Yourself Unforgettable" for Blacked'], ['creampie', 'poster', 'Alina Lopez in "Making Yourself Unforgettable" for Blacked'],
['cum-drunk', 0, 'Ashly Anderson in "Rough Love" for Hookup Hotshot'], ['cum-drunk', 0, 'Ashly Anderson in "Rough Love" for Hookup Hotshot'],
['cum-in-mouth', 3, 'Kira Noir for HardX'], ['cum-in-mouth', 3, 'Kira Noir for HardX'],
['cum-in-mouth', 5, 'Emma Hix in "A Big Dick For Emma Hix" for DarkX'],
['cum-in-mouth', 4, 'Vanna Bardot and Isiah Maxwell in "Vanna Craves Isiah\'s Cock!" for DarkX'], ['cum-in-mouth', 4, 'Vanna Bardot and Isiah Maxwell in "Vanna Craves Isiah\'s Cock!" for DarkX'],
['cum-in-mouth', 2, 'Jaye Summers in "Double The Cum" for HardX'], ['cum-in-mouth', 2, 'Jaye Summers in "Double The Cum" for HardX'],
['cum-in-mouth', 0, 'Vina Sky and Avi Love for HardX'], ['cum-in-mouth', 0, 'Vina Sky and Avi Love for HardX'],

View File

@ -76,8 +76,8 @@ async function init() {
? await fetchScenes([...(sceneUrls), ...(updateBaseScenes || []), ...(actorBaseScenes || [])]) ? await fetchScenes([...(sceneUrls), ...(updateBaseScenes || []), ...(actorBaseScenes || [])])
: [...(updateBaseScenes || []), ...(actorBaseScenes || [])]; : [...(updateBaseScenes || []), ...(actorBaseScenes || [])];
const sceneMovies = deepScenes && deepScenes.map(scene => scene.movie).filter(Boolean); const sceneMovies = deepScenes ? deepScenes.map(scene => ({ ...scene.movie, entity: scene.entity })).filter(Boolean) : [];
const deepMovies = argv.sceneMovies && await fetchMovies([...(argv.movie || []), ...(sceneMovies || [])]); const deepMovies = argv.sceneMovies || argv.movie ? await fetchMovies([...(argv.movie || []), ...(sceneMovies || [])]) : sceneMovies;
const movieScenes = argv.movieScenes ? deepMovies.map(movie => movie.scenes?.map(scene => ({ ...scene, entity: movie.entity }))).flat().filter(Boolean) : []; const movieScenes = argv.movieScenes ? deepMovies.map(movie => movie.scenes?.map(scene => ({ ...scene, entity: movie.entity }))).flat().filter(Boolean) : [];
const deepMovieScenes = argv.deep ? await fetchScenes(movieScenes) : movieScenes; const deepMovieScenes = argv.deep ? await fetchScenes(movieScenes) : movieScenes;
@ -88,14 +88,14 @@ async function init() {
} }
if (argv.save) { if (argv.save) {
const storedScenes = deepScenes.length > 0 || deepMovieScenes.length > 0
? await storeScenes(deepScenes)
: [];
if (deepMovies.length > 0) { if (deepMovies.length > 0) {
const storedMovieScenes = await storeScenes(deepMovieScenes); const storedMovieScenes = await storeScenes(deepMovieScenes);
await storeMovies(deepMovies, storedMovieScenes || []); await storeMovies(deepMovies, [...(storedMovieScenes || []), ...storedScenes]);
}
if (deepScenes.length > 0 || deepMovieScenes.length > 0) {
await storeScenes(deepScenes || []);
} }
} }

View File

@ -203,7 +203,7 @@ function scrapeAll(html, site, networkUrl, hasTeaser = true) {
}); });
} }
async function scrapeScene(html, url, site, baseRelease, mobileHtml) { async function scrapeScene(html, url, site, baseRelease, mobileHtml, options) {
const $ = cheerio.load(html, { normalizeWhitespace: true }); const $ = cheerio.load(html, { normalizeWhitespace: true });
const m$ = mobileHtml && cheerio.load(mobileHtml, { normalizeWhitespace: true }); const m$ = mobileHtml && cheerio.load(mobileHtml, { normalizeWhitespace: true });
const release = { $, url }; const release = { $, url };
@ -261,7 +261,7 @@ async function scrapeScene(html, url, site, baseRelease, mobileHtml) {
const photoLink = $('.picturesItem a').attr('href'); const photoLink = $('.picturesItem a').attr('href');
const mobilePhotos = m$ ? m$('.preview-displayer a img').map((photoIndex, photoEl) => $(photoEl).attr('src')).toArray() : []; const mobilePhotos = m$ ? m$('.preview-displayer a img').map((photoIndex, photoEl) => $(photoEl).attr('src')).toArray() : [];
if (photoLink) { if (photoLink && options.includePhotos) {
const photos = await getPhotos(photoLink, site, mobilePhotos.length < 3); // only get thumbnails when less than 3 mobile photos are available const photos = await getPhotos(photoLink, site, mobilePhotos.length < 3); // only get thumbnails when less than 3 mobile photos are available
if (photos.length < 7) release.photos = [...photos, ...mobilePhotos]; // probably only teaser photos available, supplement with mobile album if (photos.length < 7) release.photos = [...photos, ...mobilePhotos]; // probably only teaser photos available, supplement with mobile album
@ -312,7 +312,6 @@ async function scrapeScene(html, url, site, baseRelease, mobileHtml) {
title: movie.attr('title'), title: movie.attr('title'),
entryId: movieUrl.match(/\/(\d+)(\/|$)/)?.[1], entryId: movieUrl.match(/\/(\d+)(\/|$)/)?.[1],
covers: [movie.find('img').attr('src')], covers: [movie.find('img').attr('src')],
entity: site,
}; };
} }
@ -595,7 +594,7 @@ function getDeepUrl(url, site, baseRelease, mobile) {
return url; return url;
} }
async function fetchScene(url, site, baseRelease) { async function fetchScene(url, site, baseRelease, options) {
if (site.parameters?.deep === false) { if (site.parameters?.deep === false) {
return baseRelease; return baseRelease;
} }
@ -616,7 +615,7 @@ async function fetchScene(url, site, baseRelease) {
if (res.status === 200) { if (res.status === 200) {
const mobileBody = mobileRes?.status === 200 ? mobileRes.body.toString() : null; const mobileBody = mobileRes?.status === 200 ? mobileRes.body.toString() : null;
const scene = await scrapeScene(res.body.toString(), url, site, baseRelease, mobileBody); const scene = await scrapeScene(res.body.toString(), url, site, baseRelease, mobileBody, options);
return { ...scene, deepUrl }; return { ...scene, deepUrl };
} }

View File

@ -339,15 +339,19 @@ async function associateMovieScenes(movies, movieScenes) {
}, },
}), {}); }), {});
console.log('movies', movies, movieScenes);
const associations = movies.map((movie) => { const associations = movies.map((movie) => {
if (!movie.scenes) { if (!movie.scenes || !movie.id) {
return null; return null;
} }
console.log(movie, movie.scenes);
return movie.scenes.map((scene) => { return movie.scenes.map((scene) => {
const movieScene = movieScenesByEntityIdAndEntryId[movie.entity.id]?.[scene.entryId]; const movieScene = movieScenesByEntityIdAndEntryId[movie.entity.id]?.[scene.entryId];
if (movieScene) { if (movieScene?.id) {
return { return {
movie_id: movie.id, movie_id: movie.id,
scene_id: movieScene.id, scene_id: movieScene.id,