Skip to content

Commit

Permalink
[HiDive] Remove unreleased episodes from list
Browse files Browse the repository at this point in the history
When doing a range download/single selection of an anime that's currently airing episodes that haven't released will still get downloaded at 0 bytes. This will skip them if they have a date range in them, rather than an appropriate title.
  • Loading branch information
Denoder authored May 9, 2024
1 parent b2488ed commit 130fa5e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion hidive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,10 @@ export default class Hidive implements ServiceClass {
season.value.paging.moreDataAvailable = seasonPage.value.paging.moreDataAvailable;
}
for (const episode of season.value.episodes) {
const datePattern = /\d{1,2}\/\d{1,2}\/\d{2,4} \d{1,2}:\d{2} UTC/;
if (datePattern.test(episode.title)) {
continue;
}
if (episode.title.includes(' - ')) {
episode.episodeInformation.episodeNumber = parseFloat(episode.title.split(' - ')[0].replace('E', ''));
episode.title = episode.title.split(' - ')[1];
Expand Down Expand Up @@ -397,6 +401,10 @@ export default class Hidive implements ServiceClass {
}
const episodes: Episode[] = [];
for (const episode of season.value.episodes) {
const datePattern = /\d{1,2}\/\d{1,2}\/\d{2,4} \d{1,2}:\d{2} UTC/;
if (datePattern.test(episode.title)) {
continue;
}
if (episode.title.includes(' - ')) {
episode.episodeInformation.episodeNumber = parseFloat(episode.title.split(' - ')[0].replace('E', ''));
episode.title = episode.title.split(' - ')[1];
Expand Down Expand Up @@ -1077,4 +1085,4 @@ export default class Hidive implements ServiceClass {
setTimeout(resolve, ms);
});
}
}
}

0 comments on commit 130fa5e

Please sign in to comment.