Add active-viewer list to Watch with per-user 48h history drill-down
All checks were successful
Deploy / deploy (push) Successful in 28s

Lists anyone who's watched something in the last 10 days; clicking a
name shows their play history for the last 48 hours.

Bump to v2.1.0 per the just-added CLAUDE.md rule that every commit
should be matched with a version change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017kn4ZaFd6RCnbMewMyMsfe
This commit is contained in:
Barely Removable 2026-08-31 07:56:18 -07:00
parent cf2b5acd3e
commit 8115ed4855
2 changed files with 112 additions and 4 deletions

View file

@ -11,6 +11,29 @@
{% else %}
{%- set sessions = tautulli.sessions or [] -%}
{% if selected_user %}
<div class="tt-field"><span>History &mdash; {{ selected_user }}</span><span class="tt-field-meta">last 48 hours</span></div>
{% if user_history.status != 'ok' %}
{{ service_error('Tautulli', user_history.error) }}
{% elif user_history.entries %}
<div class="tt-rows">
{% for it in user_history.entries %}
<div class="tt-row">
<span class="tt-row-name">{{ (it.media_type or 'play') | upper }}</span>
<span class="tt-row-body">
<span class="tt-row-title">{{ it.title }}</span>
<span class="tt-row-sub">{{ it.when }}</span>
</span>
<span class="tt-row-val">{{ it.percent }}%</span>
</div>
{% endfor %}
</div>
{% else %}
<p class="tt-empty">Nothing played in the last 48 hours.</p>
{% endif %}
<p class="tt-empty"><a href="{{ request.script_root }}/watch">&larr; All viewers</a></p>
{% endif %}
<div class="tt-field {{ 'warn' if sessions else '' }}">
<span>Streaming Now</span>
<span class="tt-field-meta">{{ tautulli.active_streams }} active</span>
@ -75,5 +98,23 @@
{% endfor %}
</div>
{% endif %}
<div class="tt-field"><span>Active Viewers</span><span class="tt-field-meta">last 10 days</span></div>
{% if tautulli.active_users %}
<div class="tt-rows">
{% for u in tautulli.active_users %}
<a class="tt-row" href="{{ request.script_root }}/watch?user={{ u.username | urlencode }}">
<span class="tt-row-num">{{ loop.index }}</span>
<span class="tt-row-body">
<span class="tt-row-title">{{ u.username }}</span>
<span class="tt-row-sub">Last watched {{ u.last_watched }}</span>
</span>
<span class="tt-row-val">{{ u.plays }} PLAYS</span>
</a>
{% endfor %}
</div>
{% else %}
<p class="tt-empty">No viewers in the last 10 days.</p>
{% endif %}
{% endif %}
{% endblock %}