MediaDash/templates/qbittorrent/index.html

139 lines
4.6 KiB
HTML

{% extends "base.html" %}
{% macro torrent_entry(torrent) %}
{% set state_label,badge_type = status_map[torrent.state] or (torrent.state,'light') %}
<li class="list-group-item">
<a href="{{url_for('qbittorrent_details',infohash=torrent.hash)}}">{{torrent.name|truncate(75)}}</a>
(DL: {{torrent.dlspeed|filesizeformat(binary=true)}}/s, UL: {{torrent.upspeed|filesizeformat(binary=true)}}/s)
<span class="badge badge-{{badge_type}}">{{state_label}}</span>
{% if torrent.category %}
<span class="badge badge-light">{{torrent.category}}</span>
{% endif %}
<div style="margin-top: 5px"></div>
<div class="progress" style="width: 100%;">
<div class="progress-bar progress-bar-striped progress-bar-animated"
style="width: {{(torrent.progress*100)|round(2)}}%;" role="progressbar"
aria-valuenow="{{(torrent.progress*100)|round(2)}}" aria-valuemin="0" aria-valuemax="100">
</div>
<div class="progress-bar progress-bar-striped progress-bar-animated bg-primary"
style="width: {{((([torrent.availability,1]|min)-torrent.progress)*100)|round(2)}}%;" role="progressbar"
aria-valuenow="{{((([torrent.availability,1]|min)-torrent.progress)*100)|round(2)}}" aria-valuemin="0" aria-valuemax="100">
</div>
<small class="justify-content-center d-flex position-absolute w-100">{{(torrent.progress*100)|round(2)}}&nbsp;% (ETA: {{[torrent.eta,torrent.eta_act]|min|round(0)|timedelta(clamp=true)}})</small>
</div>
</li>
{% endmacro %}
{% block app_content %}
<h2>
<a href="{{config.APP_CONFIG.qbt_url}}">QBittorrent</a>
{{qbt.version}}
(DL: {{qbt.server_state.dl_info_speed|filesizeformat(binary=True)}}/s,
UL: {{qbt.server_state.up_info_speed|filesizeformat(binary=True)}}/s)
</h2>
<div class="row">
<div class="col">
Total Uploaded
</div>
<div class="col">
{{qbt.server_state.alltime_ul|filesizeformat(binary=True)}}
</div>
<div class="col">
Total Downloaded
</div>
<div class="col">
{{qbt.server_state.alltime_dl|filesizeformat(binary=True)}}
</div>
</div>
<div class="row">
<div class="col">
Session Uploaded
</div>
<div class="col">
{{qbt.server_state.up_info_data|filesizeformat(binary=True)}}
</div>
<div class="col">
Session Downloaded
</div>
<div class="col">
{{qbt.server_state.dl_info_data|filesizeformat(binary=True)}}
</div>
</div>
<div class="row">
<div class="col">
Torrents
</div>
<div class="col">
{{qbt.torrents|length}}
</div>
<div class="col">
Total Queue Size
</div>
<div class="col">
{{qbt.torrents.values()|map(attribute='size')|sum|filesizeformat(binary=true)}}
</div>
</div>
<hr />
<div class="row">
<div class="col">
<form method="GET">
<select class="form-control" name="sort" onchange="this.parentElement.submit()">
<option value="">Sort by</option>
{% for key,value in sort_by_choices.items() %}
<option value="{{key}}">{{value}}</option>
{% endfor %}
</select>
</form>
</div>
</div>
{% for state,torrents in qbt.torrents.values()|sort(attribute='state')|groupby('state') %}
{% set state_label,badge_type = status_map[state] or (state,'light') %}
<div class="row">
<div class="col">
<a href={{url_for("qbittorrent",state=state)}} >{{state_label}}</a>
</div>
<div class="col">
{{torrents|length}}
</div>
</div>
{% endfor %}
{% if state_filter %}
<div class="row">
<div class="col">
<a href={{url_for("qbittorrent")}}>[Clear filter]</a>
</div>
<div class="col">
</div>
</div>
{% endif %}
<hr />
<div class="row">
<div class="col">
<ul style="padding-bottom: 10px;" class="list-group">
{% for torrent in qbt.torrents.values()|sort(attribute=sort_by,reverse=True) %}
{% set state_label,badge_type = status_map[torrent.state] or (torrent.state,'light') %}
{% if state_filter %}
{% if torrent.state==state_filter %}
{{torrent_entry(torrent)}}
{% endif %}
{% else %}
{{torrent_entry(torrent)}}
{% endif %}
{% endfor %}
</ul>
</div>
</div>
{% endblock %}