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.
This commit is contained in:
@@ -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]:
|
||||
|
||||
@@ -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] = []
|
||||
|
||||
Reference in New Issue
Block a user