MediaDash/templates/remote/index.html

166 lines
7.1 KiB
HTML

{% extends "base.html" %}
{% from 'utils.html' import custom_render_form_row,make_tabs %}
{% from 'bootstrap/utils.html' import render_icon %}
{% from 'bootstrap/form.html' import render_form, render_field, render_form_row %}
{% block app_content %}
<h1>
Remote access <a href={{url_for("remote.add")}}>{{render_icon("person-plus-fill")}}</a>
</h1>
<div class="row">
<div class="col-lg">
<h4>SSH</h4>
<table class="table table-sm table-bordered">
<tr>
<th></th>
<th>Type</th>
<th>Key fingerprint</th>
<th>Name</th>
</tr>
{% for key in ssh %}
<tr {{ {"class":"text-muted" if key.disabled else none}|xmlattr }}>
<td>
{% if key.disabled %}
<a href="{{url_for("remote.index",enabled=True,key=key.key)}}">{{render_icon("person-x-fill",color='danger')}}</a>
{% else %}
<a href="{{url_for("remote.index",enabled=False,key=key.key)}}">{{render_icon("person-check-fill",color='success')}}</a>
{% endif %}
</td>
<td>{{key.type}}</td>
<td title="{{key.key}}">{{key.fingerprint}}</td>
<td>{{key.name}}</td>
</tr>
{% endfor %}
</table>
</div>
</div>
<div class="row">
<div class="col-lg">
<h4>Active Streams</h4>
<table class="table table-sm table-bordered">
<tr>
<th>Episode</th>
<th>Show</th>
<th>Language</th>
<th>User</th>
<th>Device</th>
<th>Mode</th>
</tr>
{% for session in jellyfin.sessions %}
{% if "NowPlayingItem" in session %}
{% with np=session.NowPlayingItem, ps=session.PlayState%}
<tr>
<td>
{% if session.SupportsMediaControl %}
<a href="{{url_for('remote.stop',session=session.Id)}}">
{{render_icon("stop-circle")}}
</a>
{% endif %}
<a title="{{ps.MediaSourceId}}" href="{{cfg().jellyfin_url}}web/index.html#!/details?id={{np.Id}}">
{{np.Name}}
</a>
({{(ps.PositionTicks/10_000_000)|timedelta(digits=0)}}/{{(np.RunTimeTicks/10_000_000)|timedelta(digits=0)}})
{% if ps.IsPaused %}
(Paused)
{% endif %}
</td>
<td>
<a href="{{cfg().jellyfin_url}}web/index.html#!/details?id={{np.SeriesId}}">
{{np.SeriesName}}
</a>
<a href="{{cfg().jellyfin_url}}web/index.html#!/details?id={{np.SeasonId}}">
({{np.SeasonName}})
</a>
</td>
<td>
{% if ("AudioStreamIndex" in ps) and ("SubtitleStreamIndex" in ps) %}
{% if ps.AudioStreamIndex == -1 %}
{% set audio_lang = "-" %}
{% else %}
{% set audio_lang = np.MediaStreams[ps.AudioStreamIndex].Language or "?" %}
{% endif %}
{% if ps.SubtitleStreamIndex == -1 %}
{% set subtitle_lang = "-" %}
{% else %}
{% set subtitle_lang = np.MediaStreams[ps.AudioStreamIndex].Language or "?" %}
{% endif %}
{{audio_lang}}/{{subtitle_lang}}
{% else %}
?/?
{% endif %}
</td>
<td>
<a href="{{cfg().jellyfin_url}}web/index.html#!/useredit.html?userId={{session.UserId}}">
{{session.UserName}}
</a>
</td>
<td>
{{session.DeviceName}}
</td>
<td>
{% if ps.PlayMethod =="Transcode" %}
<p title="{{session.TranscodingInfo.Bitrate|filesizeformat(binary=False)}}/s | {{session.TranscodingInfo.CompletionPercentage|round(2)}}%">
{{ps.PlayMethod}}
</p>
{% else %}
<p>
{{ps.PlayMethod}}
</p>
{% endif %}
</td>
</tr>
{% endwith %}
{% endif %}
{% endfor %}
</table>
</div>
</div>
<div class="row">
<div class="col-lg">
<h4><a href="{{cfg().jellyfin_url}}web/index.html#!/userprofiles.html">Jellyfin</a></h4>
<table class="table table-sm table-bordered">
<tr>
<th>Name</th>
<th>Last Login</th>
<th>Last Active</th>
<th>Bandwidth Limit</th>
</tr>
{% for user in jellyfin.users|defaultattr("LastLoginDate","")|sort(attribute="LastLoginDate",reverse=True) %}
<tr>
<td>
<a href="{{cfg().jellyfin_url}}web/index.html#!/useredit.html?userId={{user.Id}}">
{{user.Name}}
</a>
</td>
<td>
{% if user.LastLoginDate %}
{{user.LastLoginDate|fromiso|ago_dt_utc(2)}} ago
{% else %}
Never
{% endif %}
</td>
<td>
{% if user.LastActivityDate %}
{{user.LastActivityDate|fromiso|ago_dt_utc(2)}} ago
{% else %}
Never
{% endif %}
</td>
<td>
{% if user.Policy.RemoteClientBitrateLimit!=0 %}
{{user.Policy.RemoteClientBitrateLimit|filesizeformat(binary=False)}}/s
{% else %}
None
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endblock %}