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" />
<div class="content">
<!-- key forces rerender when new and old path use same component -->
<router-view />
</div>
</div>

View File

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

View File

@ -79,7 +79,7 @@
<router-link
v-for="movie in release.movies"
: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"
>
<span class="movie-title">{{ movie.title }}</span>
@ -209,13 +209,7 @@ import Releases from './releases.vue';
import Scroll from '../scroll/scroll.vue';
import Expand from '../expand/expand.vue';
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));
}
async function mounted() {
async function fetchRelease() {
if (this.$route.name === 'scene') {
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 {
components: {
Actor,
@ -245,7 +245,13 @@ export default {
computed: {
pageTitle,
},
mounted,
watch: {
$route: fetchRelease,
},
mounted: fetchRelease,
methods: {
fetchRelease,
},
};
</script>

View File

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

View File

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

View File

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

View File

@ -359,7 +359,7 @@ function scrapeProfile(html, url, actorName, entity) {
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
? util.format(site.parameters.latest, page)
: `${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;
}
if (uniqueReleases.length === 0) {
return false;
}
if (argv.after) {
const oldestReleaseOnPage = releases
.sort((releaseA, releaseB) => releaseB.date - releaseA.date)
.slice(-1)[0];
const oldestReleaseOnPage = releases
.sort((releaseA, releaseB) => releaseB.date - releaseA.date)
.slice(-1)[0];
if (moment(oldestReleaseOnPage.date).isAfter(argv.after)) {
// oldest release on page is newer than the specified date cut-off
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;