feat: filter "Without German" tab to show only existing or downloading media and exclude season 0 episodes
Add is_german_review_candidate() helper function to filter media that exists locally or is currently being downloaded, excluding season 0 (specials) episodes. Apply filter to missing_german_movies and missing_german_series lists to show only actionable items. Update tab description text from "Kein deutsches Audio und keine deutschen Untertitel" to "Vorhanden oder wird gerade geladen · Staffel
This commit is contained in:
1 parent
94ab044a0a
commit
3d4fb52fa3
2 files changed
+9
-3
No files matched your search
@@ -179,6 +179,12 @@ def has_german_track(row):
|
||||
languages = row.get("audio_languages", []) + row.get("subtitle_languages", [])
|
||||
return any(language.get("name") == "Deutsch" for language in languages)
|
||||
|
||||
def is_german_review_candidate(row):
|
||||
"""Only review media that exists or is currently being downloaded."""
|
||||
if row.get("episode") and int(row.get("season") or 0) == 0:
|
||||
return False
|
||||
return not row.get("missing") or bool(row.get("downloading"))
|
||||
|
||||
def media_row(name, year, media_file, remote, local, extra=None):
|
||||
path = media_file.get("path") if media_file else None
|
||||
if not path and media_file and media_file.get("relativePath"): path = str(Path(media_file.get("basePath") or "") / media_file["relativePath"])
|
||||
@@ -250,10 +256,10 @@ def index():
|
||||
series = sonarr_groups()
|
||||
if any(row["pending"] for group in series for row in group["episodes"]): start_scan("sonarr")
|
||||
except Exception as exc: log.exception("Sonarr nicht erreichbar"); error = f"{error + ' | ' if error else ''}Sonarr: {exc}"
|
||||
missing_german_movies = [row for row in rows if not has_german_track(row)]
|
||||
missing_german_movies = [row for row in rows if is_german_review_candidate(row) and not has_german_track(row)]
|
||||
missing_german_series = []
|
||||
for group in series:
|
||||
episodes = [episode for episode in group["episodes"] if not has_german_track(episode)]
|
||||
episodes = [episode for episode in group["episodes"] if is_german_review_candidate(episode) and not has_german_track(episode)]
|
||||
if episodes:
|
||||
missing_german_series.append({**group, "episodes": episodes})
|
||||
return render_template("index.html", rows=rows, series=series, missing_german_movies=missing_german_movies,
|
||||
|
||||
Reference in new issue
Block a user