Show who requested each show on Admin rows
All checks were successful
Deploy / deploy (push) Successful in 39s

Sonarr has no concept of a requester, so this cross-references Ombi's
TV request list by title to attribute the show to whoever's request
triggered the grab, falling back to "Requester unknown" for anything
added straight in Sonarr or when Ombi can't be reached.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LPJxtE9tPURsaWDZ6rC4Dt
This commit is contained in:
Barely Removable 2026-09-05 09:55:02 -07:00
parent 6d093a25d7
commit 106bd16de8
2 changed files with 22 additions and 2 deletions

22
app.py
View file

@ -801,7 +801,9 @@ def get_admin_unwatched_shows(limit=10, months=ADMIN_UNWATCHED_MONTHS):
dashboard uses) because a recency-limited window could mismark a show
that genuinely was watched — just a while ago — as never-watched,
which matters a lot more here than elsewhere given what's attached to
the wrong answer.
the wrong answer. Each show also carries whoever's Ombi request
triggered it, best-effort by title match — a show added straight in
Sonarr rather than requested has no requester to find.
"""
try:
series_list = sonarr_series_cached()
@ -851,8 +853,26 @@ def get_admin_unwatched_shows(limit=10, months=ADMIN_UNWATCHED_MONTHS):
never.sort(key=lambda x: x["size"], reverse=True)
top = never[:limit]
# Sonarr doesn't know who asked for a show — Ombi does, via whoever's
# request triggered the grab. Best-effort only: a show added straight
# in Sonarr, without an Ombi request, has no requester to find, and an
# unreachable Ombi shouldn't take down the rest of the section.
requested_by = {}
try:
for show in ombi_get("Request/tv"):
for child in show.get("childRequests", []):
user = child.get("requestedUser", {})
alias = (user.get("alias") or user.get("userAlias")
or user.get("userName") or "").split("@")[0]
if alias:
requested_by.setdefault(show.get("title", "").lower(), alias)
except Exception:
pass
for show in top:
show["size_display"] = _fmt_bytes(show["size"])
show["requested_by"] = requested_by.get(show["title"].lower(), "")
total_bytes = sum(show["size"] for show in top)
return {