MediaDash/templates/requests/details.html

55 lines
2.4 KiB
HTML
Raw Permalink Normal View History

2021-12-13 18:11:43 +00:00
{% extends "base.html" %}
{% from 'bootstrap/utils.html' import render_icon %}
{% block app_content %}
<h1>Request details</h1>
{% set data = request.data|fromjson%}
<div class="row">
<div class="col">
{% set label = {True:"Approved",False:"Declined",None:"Pending"}[request.approved] %}
{% set class = {True:"bg-success",False:"bg-danger", None: ""}[request.approved] %}
{% if request.approved and jellyfin_id %}
{% set label = "Approved and Downloaded" %}
{% endif %}
{% if data.tvdbId %}
{% set link="https://www.thetvdb.com/?tab=series&id=%s"|format(data.tvdbId) %}
{% elif data.imdbId %}
{% set link="https://www.imdb.com/title/%s"|format(data.imdbId) %}
{% endif %}
<p><b>Title</b>: <a href="{{link}}">{{data.title}}</a> ({{data.year}})</p>
<p><b>Type</b>: {{{"sonarr":"TV Show","radarr":"Movie"}.get(request.request_type,"Unknown")}}</p>
<p><b>Added</b>: {{request.added_date|ago_dt(0)}} ago</p>
<p><b>Status</b>: <span class="{{class}}">{{label}}</span></p>
</div>
</div>
<div>
<p>{{data.overview}}</p>
{% if jellyfin_id %}
<a class="btn btn-success" href="{{cfg().jellyfin_url}}web/index.html#!/details?id={{jellyfin_id}}">Open in Jellyfin</a>
{% endif %}
</div>
{% set downloads = (request.downloads|list) %}
{% if downloads %}
<h3>Downloads</h3>
<table class="table table-sm">
<tr>
<th>Name</th>
<th>Quality</th>
<th>Progress</th>
</tr>
{% for download in downloads %}
{% set torrent = download.download.info %}
{% set dl_rate = torrent.downloaded / torrent.time_active %}
{% set eta_act = [0, (torrent.size - torrent.downloaded) / dl_rate]|max %}
<tr>
<td><a href="{{url_for('requests.download_details',request_id=request.id,download_id=torrent.hash)}}">{{download.title}}</a></td>
<td>{{download.quality.quality.name}}</td>
<td>
{{(torrent.progress*100)|round(2)}}&nbsp;% (ETA: {{[torrent.eta,eta_act]|min|round(0)|timedelta(clamp=true)}})
</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% endblock %}