Show who requested each show on Admin rows
All checks were successful
Deploy / deploy (push) Successful in 39s
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:
parent
6d093a25d7
commit
106bd16de8
2 changed files with 22 additions and 2 deletions
22
app.py
22
app.py
|
|
@ -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
|
dashboard uses) because a recency-limited window could mismark a show
|
||||||
that genuinely was watched — just a while ago — as never-watched,
|
that genuinely was watched — just a while ago — as never-watched,
|
||||||
which matters a lot more here than elsewhere given what's attached to
|
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:
|
try:
|
||||||
series_list = sonarr_series_cached()
|
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)
|
never.sort(key=lambda x: x["size"], reverse=True)
|
||||||
top = never[:limit]
|
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:
|
for show in top:
|
||||||
show["size_display"] = _fmt_bytes(show["size"])
|
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)
|
total_bytes = sum(show["size"] for show in top)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@
|
||||||
<span class="tt-row-name">{{ show.ep_count }} EP</span>
|
<span class="tt-row-name">{{ show.ep_count }} EP</span>
|
||||||
<span class="tt-row-body">
|
<span class="tt-row-body">
|
||||||
<span class="tt-row-title">{{ show.title }}</span>
|
<span class="tt-row-title">{{ show.title }}</span>
|
||||||
<span class="tt-row-sub">{% if show.year %}{{ show.year }} · {% endif %}Downloaded {{ show.added[:10] if show.added else 'unknown' }} · Never watched</span>
|
<span class="tt-row-sub">{% if show.year %}{{ show.year }} · {% endif %}Downloaded {{ show.added[:10] if show.added else 'unknown' }} · {% if show.requested_by %}Requested by {{ show.requested_by }}{% else %}Requester unknown{% endif %} · Never watched</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="tt-row-val">{{ show.size_display }}</span>
|
<span class="tt-row-val">{{ show.size_display }}</span>
|
||||||
<span class="tt-row-acts">
|
<span class="tt-row-acts">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue