From d52b9a55f4e31d3157a0374f3e61d5041e703a0b Mon Sep 17 00:00:00 2001 From: Lukas Date: Fri, 31 Jul 2026 09:50:59 +0200 Subject: [PATCH] fix: exclude downloaded episodes from episodeDict and GetMissingEpisode Prevent fully-downloaded series from being queued by auto-download: - SerieList.GetMissingEpisode(): filter by is_downloaded instead of checking if episodeDict is non-empty. episodeDict from the DB relationship includes all episodes (including downloaded), so a series with only downloaded episodes still had a truthy episodeDict. - AnimeSeries.episodeDict property: skip episodes where is_downloaded=True when building the dict from the DB relationship. This makes the property consistent with the is_downloaded filtering already done manually in list_series_with_filters(), and ensures that calling code anywhere in the codebase gets the correct missing-episode view. Fixes hana-kimi (and any other fully-downloaded series) incorrectly appearing in the auto-download queue after a rescan. --- src/server/database/SerieList.py | 2 +- src/server/database/models.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server/database/SerieList.py b/src/server/database/SerieList.py index f843873..2433ed3 100644 --- a/src/server/database/SerieList.py +++ b/src/server/database/SerieList.py @@ -134,7 +134,7 @@ class SerieList: """Return all series that still contain missing episodes.""" return [ anime for anime in self.keyDict.values() - if anime.episodeDict + if any(not ep.is_downloaded for ep in (anime.episodes or [])) ] def get_missing_episodes(self) -> List[AnimeSeries]: diff --git a/src/server/database/models.py b/src/server/database/models.py index 484694a..85ff85f 100644 --- a/src/server/database/models.py +++ b/src/server/database/models.py @@ -205,6 +205,8 @@ class AnimeSeries(Base, TimestampMixin): try: if self.episodes: for ep in self.episodes: + if ep.is_downloaded: + continue season = ep.season or 1 if season not in episode_dict: episode_dict[season] = []