mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
lightbulb moment! next episode logic
This commit is contained in:
parent
9d21124379
commit
765749a956
1 changed files with 16 additions and 12 deletions
|
@ -154,27 +154,31 @@ export function SearchView() {
|
||||||
// begin next episode logic
|
// begin next episode logic
|
||||||
} else {
|
} else {
|
||||||
// we can't do next episode for movies!
|
// we can't do next episode for movies!
|
||||||
if (!subselection.show) return;
|
if (!subselection.show) continue;
|
||||||
|
|
||||||
|
let newShow = {};
|
||||||
|
|
||||||
// if the current season has a next episode, load it
|
// if the current season has a next episode, load it
|
||||||
if (subselection.meta.episodes[subselection.show.season].includes(`${parseInt(subselection.show.episode) + 1}`)) {
|
if (subselection.meta.episodes[subselection.show.season].includes(`${parseInt(subselection.show.episode) + 1}`)) {
|
||||||
subselection.show = {
|
newShow.season = subselection.show.season;
|
||||||
season: subselection.show.season,
|
newShow.episode = `${parseInt(subselection.show.episode) + 1}`;
|
||||||
episode: `${parseInt(subselection.show.episode) + 1}`
|
|
||||||
}
|
|
||||||
|
|
||||||
entry.percentageDone = 0;
|
entry.percentageDone = 0;
|
||||||
// if the current season does not have a next epsiode, and the next season has a first episode, load that
|
// if the current season does not have a next epsiode, and the next season has a first episode, load that
|
||||||
} else if (subselection.meta.episodes[`${parseInt(subselection.show.season) + 1}`][0]) {
|
} else if (subselection.meta.episodes[`${parseInt(subselection.show.season) + 1}`][0]) {
|
||||||
subselection.show = {
|
newShow.season = `${parseInt(subselection.show.season) + 1}`;
|
||||||
season: `${parseInt(subselection.show.season) + 1}`,
|
newShow.episode = subselection.meta.episodes[`${parseInt(subselection.show.season) + 1}`][0];
|
||||||
episode: subselection.meta.episodes[`${parseInt(subselection.show.season) + 1}`][0]
|
|
||||||
}
|
|
||||||
|
|
||||||
entry.percentageDone = 0;
|
entry.percentageDone = 0;
|
||||||
|
// the next episode does not exist
|
||||||
} else {
|
} else {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// assign the new episode and season data
|
||||||
|
entry.data.show = { ...newShow };
|
||||||
|
|
||||||
|
// if the next episode exists, continue. we don't want to end up with duplicate data.
|
||||||
|
let nextEpisode = progressData?.[source]?.show?.[slug]?.[`${entry.data.show.season}-${entry.data.show.episode}`];
|
||||||
|
if (nextEpisode) continue;
|
||||||
|
|
||||||
newContinueWatching.push(entry);
|
newContinueWatching.push(entry);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue