Changed next page determination to ensure --after is followed even if there are no unique releases.

This commit is contained in:
DebaucheryLibrarian 2020-09-10 23:49:24 +02:00
parent a833476437
commit 0e8024adf1
8 changed files with 31 additions and 28 deletions

View File

@ -13,7 +13,6 @@
<Header :toggle-sidebar="toggleSidebar" /> <Header :toggle-sidebar="toggleSidebar" />
<div class="content"> <div class="content">
<!-- key forces rerender when new and old path use same component -->
<router-view /> <router-view />
</div> </div>
</div> </div>

View File

@ -218,7 +218,7 @@ export default {
} }
.logo-child { .logo-child {
height: 2.5rem; height: 2rem;
} }
.logo-parent { .logo-parent {

View File

@ -79,7 +79,7 @@
<router-link <router-link
v-for="movie in release.movies" v-for="movie in release.movies"
:key="`movie-${movie.id}`" :key="`movie-${movie.id}`"
:to="{ name: 'movie', params: { movieId: movie.id, movieSlug: movie.slug } }" :to="{ name: 'movie', params: { releaseId: movie.id, releaseSlug: movie.slug } }"
class="movie" class="movie"
> >
<span class="movie-title">{{ movie.title }}</span> <span class="movie-title">{{ movie.title }}</span>
@ -209,13 +209,7 @@ import Releases from './releases.vue';
import Scroll from '../scroll/scroll.vue'; import Scroll from '../scroll/scroll.vue';
import Expand from '../expand/expand.vue'; import Expand from '../expand/expand.vue';
function pageTitle() { async function fetchRelease() {
return this.release
&& (this.release.title
|| (this.release.actors.length > 0 ? `${this.release.actors.map(actor => actor.name).join(', ')} for ${this.release.entity.name}` : null));
}
async function mounted() {
if (this.$route.name === 'scene') { if (this.$route.name === 'scene') {
this.release = await this.$store.dispatch('fetchReleaseById', this.$route.params.releaseId); this.release = await this.$store.dispatch('fetchReleaseById', this.$route.params.releaseId);
} }
@ -225,6 +219,12 @@ async function mounted() {
} }
} }
function pageTitle() {
return this.release
&& (this.release.title
|| (this.release.actors.length > 0 ? `${this.release.actors.map(actor => actor.name).join(', ')} for ${this.release.entity.name}` : null));
}
export default { export default {
components: { components: {
Actor, Actor,
@ -245,7 +245,13 @@ export default {
computed: { computed: {
pageTitle, pageTitle,
}, },
mounted, watch: {
$route: fetchRelease,
},
mounted: fetchRelease,
methods: {
fetchRelease,
},
}; };
</script> </script>

View File

@ -40,8 +40,8 @@ async function init() {
const sceneMovies = deepScenes && deepScenes.map(scene => scene.movie).filter(Boolean); const sceneMovies = deepScenes && deepScenes.map(scene => scene.movie).filter(Boolean);
const deepMovies = argv.sceneMovies && await fetchMovies([...(argv.movie || []), ...(sceneMovies || [])]); const deepMovies = argv.sceneMovies && await fetchMovies([...(argv.movie || []), ...(sceneMovies || [])]);
const 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.movieScenes ? await fetchScenes(movieScenes) : movieScenes; const deepMovieScenes = argv.deep ? await fetchScenes(movieScenes) : movieScenes;
if (argv.inspect) { if (argv.inspect) {
console.log(util.inspect(deepScenes)); console.log(util.inspect(deepScenes));

View File

@ -31,8 +31,8 @@ function extractActors(scene) {
return release; return release;
} }
async function fetchLatestWrap(site, page = 1) { async function fetchLatestWrap(site, page = 1, include, preData) {
const latest = await fetchLatest(site, page); const latest = await fetchLatest(site, page, include, preData);
return latest.map(scene => extractActors(scene)); return latest.map(scene => extractActors(scene));
} }

View File

@ -44,8 +44,8 @@ function scrapeScene({ query }, channel) {
return release; return release;
} }
async function fetchLatestLocal(channel, page) { async function fetchLatestLocal(channel, page, include, preData) {
return fetchLatest(channel, page, true); return fetchLatest(channel, page, include, preData, true);
} }
async function fetchScene(url, channel) { async function fetchScene(url, channel) {

View File

@ -359,7 +359,7 @@ function scrapeProfile(html, url, actorName, entity) {
return profile; return profile;
} }
async function fetchLatest(site, page = 1, entryIdFromTitle = false) { async function fetchLatest(site, page = 1, include, preData, entryIdFromTitle = false) {
const url = site.parameters?.latest const url = site.parameters?.latest
? util.format(site.parameters.latest, page) ? util.format(site.parameters.latest, page)
: `${site.url}/trial/categories/movies_${page}_d.html`; : `${site.url}/trial/categories/movies_${page}_d.html`;

View File

@ -56,17 +56,15 @@ function needNextPage(releases, uniqueReleases, totalReleases, hasDates, upcomin
return totalReleases + releases.length < argv.nullDateLimit; return totalReleases + releases.length < argv.nullDateLimit;
} }
if (uniqueReleases.length === 0) { if (argv.after) {
return false; const oldestReleaseOnPage = releases
} .sort((releaseA, releaseB) => releaseB.date - releaseA.date)
.slice(-1)[0];
const oldestReleaseOnPage = releases if (moment(oldestReleaseOnPage.date).isAfter(argv.after)) {
.sort((releaseA, releaseB) => releaseB.date - releaseA.date) // oldest release on page is newer than the specified date cut-off
.slice(-1)[0]; return true;
}
if (moment(oldestReleaseOnPage.date).isAfter(argv.after)) {
// oldest release on page is newer than the specified date cut-off
return true;
} }
return false; return false;