fixed ADN (NC) episodes not working

This commit is contained in:
stratumadev 2025-04-16 01:20:49 +02:00
parent a27daa2ec6
commit 7fbf1a956b

13
adn.ts
View file

@ -255,7 +255,8 @@ export default class AnimationDigitalNetwork implements ServiceClass {
const showData = show.value.videos[0].show;
console.info(`[S.${showData.id}] ${showData.title}`);
const specials: ADNVideo[] = [];
let episodeIndex = 0, specialIndex = 0;
const ncs: ADNVideo[] = [];
let episodeIndex = 0, specialIndex = 0, ncIndex = 0;
for (const episode of show.value.videos) {
episode.season = episode.season+'';
const seasonNumberTitleParse = episode.season.match(/\d+/);
@ -274,6 +275,11 @@ export default class AnimationDigitalNetwork implements ServiceClass {
episode.shortNumber = 'S'+specialIndex;
specials.push(episode);
episodeIndex--;
} else if (episode.number.includes('(NC)')) {
ncIndex++;
episode.shortNumber = 'NC'+ncIndex;
ncs.push(episode);
episodeIndex--;
} else {
console.info(` (${episode.id}) [E${episode.shortNumber}] ${episode.number} - ${episode.name}`);
}
@ -283,7 +289,12 @@ export default class AnimationDigitalNetwork implements ServiceClass {
console.info(` (Special) (${special.id}) [${special.shortNumber}] ${special.number} - ${special.name}`);
show.value.videos.splice(show.value.videos.findIndex(i => i.id === special.id), 1);
}
for (const nc of ncs) {
console.info(` (NC) (${nc.id}) [${nc.shortNumber}] ${nc.number} - ${nc.name}`);
show.value.videos.splice(show.value.videos.findIndex(i => i.id === nc.id), 1);
}
show.value.videos.push(...specials);
show.value.videos.push(...ncs);
return { isOk: true, value: show.value };
}