diff options
| author | Fuwn <[email protected]> | 2026-05-26 14:15:12 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-05-26 14:15:12 +0000 |
| commit | 0192a7f143fbc9eca913bc77a2cf0ce95e3e7a3a (patch) | |
| tree | 907291985be19ed8cfc52485ff18514afe5675c8 /src/lib/Media/Anime/Airing | |
| parent | fix(match): normalize "S2"-style season suffix in title preprocessing (diff) | |
| download | due.moe-0192a7f143fbc9eca913bc77a2cf0ce95e3e7a3a.tar.xz due.moe-0192a7f143fbc9eca913bc77a2cf0ce95e3e7a3a.zip | |
The shift was capped at 36h, which caught daily-cadence drift but not
weekly shows where AniList's nextAiringEpisode jumps a full week ahead
once an episode airs. Extends to 8 days so weekly schedules trigger it.
Also shifts nativeEpisode alongside episode so classify treats the
subtitled release as authoritative for aired-count when prefer-native
is off; previously the original AniList count survived and kept shows
in Due even though display correctly said the next sub release was
still upcoming.
Diffstat (limited to 'src/lib/Media/Anime/Airing')
| -rw-r--r-- | src/lib/Media/Anime/Airing/Subtitled/match.ts | 6 | ||||
| -rw-r--r-- | src/lib/Media/Anime/Airing/classify.test.ts | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/Media/Anime/Airing/Subtitled/match.ts b/src/lib/Media/Anime/Airing/Subtitled/match.ts index 10f63aa5..b72be71d 100644 --- a/src/lib/Media/Anime/Airing/Subtitled/match.ts +++ b/src/lib/Media/Anime/Airing/Subtitled/match.ts @@ -100,7 +100,7 @@ const FALLBACK_MIN_MARGIN = 0.08; const MAX_MATCH_CACHE_ENTRIES = 10_000; const MAX_INJECT_CACHE_ENTRIES = 10_000; const STALE_AIRING_GRACE_SECONDS = 5 * 60; -const MAX_EPISODE_SHIFT_WINDOW_SECONDS = 36 * 60 * 60; +const MAX_EPISODE_SHIFT_WINDOW_SECONDS = 8 * 24 * 60 * 60; interface SimilarityAnalysis { score: number; @@ -585,6 +585,7 @@ export const injectAiringTime = ( let untilAiring: number | undefined; let time = new Date(airingAt ? airingAt * 1000 : 0); let nextEpisode = anime.nextAiringEpisode?.episode || 0; + let nativeEpisode = nextEpisode; if (!(displayNativeCountdown || !subsPlease)) { const scheduleIndex = getScheduleIndex(subsPlease); @@ -614,6 +615,7 @@ export const injectAiringTime = ( nativeTime.getTime() / 1000 > nowEpochSeconds + STALE_AIRING_GRACE_SECONDS ) { nextEpisode -= 1; + nativeEpisode = nextEpisode; } if (nativeTime.getTime() - now.getTime() > SEVEN_DAYS) { @@ -631,7 +633,7 @@ export const injectAiringTime = ( episode: nextEpisode, airingAt: time.getTime() / 1000, nativeAiringAt: nativeTime.getTime() / 1000, - nativeEpisode: anime.nextAiringEpisode?.episode || 0, + nativeEpisode, }, } as Media; diff --git a/src/lib/Media/Anime/Airing/classify.test.ts b/src/lib/Media/Anime/Airing/classify.test.ts index b05be83b..2b40d7df 100644 --- a/src/lib/Media/Anime/Airing/classify.test.ts +++ b/src/lib/Media/Anime/Airing/classify.test.ts @@ -146,6 +146,8 @@ describe("native countdown toggle parity", () => { airingAt: nativeAiringAt, }; + if (media.mediaListEntry) media.mediaListEntry.progress = 5; + settings.setKey("displayNativeCountdown", true); const nativeOnly = injectAiringTime(media, subsPlease); @@ -242,7 +244,7 @@ describe("injectAiringTime cache safety", () => { ...media, mediaListEntry: { ...(media.mediaListEntry || {}), - progress: 8, + progress: 7, }, } as Media; const cachedCaughtUp = injectAiringTime(caughtUp, subsPlease); |