push latest changes
This commit is contained in:
parent
7523a19d1f
commit
cb2b5c2c2b
63 changed files with 3158 additions and 1552 deletions
54
templates/requests/details.html
Normal file
54
templates/requests/details.html
Normal file
|
@ -0,0 +1,54 @@
|
|||
{% 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)}} % (ETA: {{[torrent.eta,eta_act]|min|round(0)|timedelta(clamp=true)}})
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
{% endblock %}
|
116
templates/requests/index.html
Normal file
116
templates/requests/index.html
Normal file
|
@ -0,0 +1,116 @@
|
|||
{% 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 %}
|
||||
|
||||
{% macro search_tab() %}
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{{ form.csrf_token() }}
|
||||
{{ custom_render_form_row([form.query],render_args={'form_type':'horizontal','horizontal_columns':('lg',1,6)}) }}
|
||||
{{ custom_render_form_row([form.search_type],render_args={'form_type':'horizontal','horizontal_columns':('lg',1,6)}) }}
|
||||
{{ custom_render_form_row([form.search]) }}
|
||||
</form>
|
||||
{% if results %}
|
||||
<form method="post">
|
||||
{{ form.csrf_token() }}
|
||||
{% if search_type %}
|
||||
<input type="hidden" name="search_type" value="{{search_type}}">
|
||||
{% endif %}
|
||||
<table class="table table-sm table-bordered mt-3">
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>In Cinemas</th>
|
||||
<th>Digital Release</th>
|
||||
</tr>
|
||||
{% for result in results %}
|
||||
{% if result.tvdbId %}
|
||||
{% set link="https://www.thetvdb.com/?tab=series&id=%s"|format(result.tvdbId) %}
|
||||
{% elif result.imdbId %}
|
||||
{% set link="https://www.imdb.com/title/%s"|format(result.imdbId) %}
|
||||
{% endif %}
|
||||
{% if result.path %}
|
||||
{% set style="background-color: darkgreen !important;" %}
|
||||
{% else %}
|
||||
{% set style="" %}
|
||||
{% endif %}
|
||||
<tr style="{{style}}">
|
||||
<td>
|
||||
{% if result.path %}
|
||||
<input type="checkbox" disabled>
|
||||
{% else %}
|
||||
<input type="checkbox" name="selected[]" value="{{result|tojson|base64}}">
|
||||
{% endif %}
|
||||
<a href="{{link}}">{{result.title}}</a> ({{result.year}})
|
||||
</td>
|
||||
<td>
|
||||
{% if result.inCinemas %}
|
||||
{{result.inCinemas|fromiso}}
|
||||
{% else %}
|
||||
None
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if result.digitalRelease %}
|
||||
{{result.digitalRelease|fromiso}}
|
||||
{% else %}
|
||||
None
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<button class="btn btn-success" type="submit">Submit Request</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro request_queue() %}
|
||||
<form method="post">
|
||||
{{ form.csrf_token() }}
|
||||
<table class="table table-sm table-bordered mt-3">
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Requested at</th>
|
||||
{% if current_user.is_admin %}
|
||||
<th>Requested by</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% for request in requests %}
|
||||
{% set data = (request.data|fromjson) %}
|
||||
{% if request.approved==True %}
|
||||
<tr class="bg-success">
|
||||
{% elif request.approved==False %}
|
||||
<tr class="bg-danger">
|
||||
{% else %}
|
||||
<tr class="">
|
||||
{% endif %}
|
||||
<td>
|
||||
{% if current_user.is_admin and request.approved!=True %}
|
||||
<input type="checkbox" name="selected[]" value="{{request.item_id}}">
|
||||
{% endif %}
|
||||
<a href="{{url_for('requests.details',request_id=request.id)}}" style="color: #eee; text-decoration: underline;">{{data.title}}</a> ({{data.year}})
|
||||
</td>
|
||||
<td>{{request.added_date}}</td>
|
||||
{% if current_user.is_admin %}
|
||||
<td>{{request.users|join(", ",attribute="user_name")}}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% if current_user.is_admin %}
|
||||
<button name="approve" value="approve" class="btn btn-success" type="submit">Approve</button>
|
||||
<button name="decline" value="decline" class="btn btn-danger" type="submit">Decline</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
|
||||
{% block app_content %}
|
||||
<h1>Requests</h1>
|
||||
{% set requests_tabs = [
|
||||
('Queue',request_queue()),
|
||||
('Search',search_tab()),
|
||||
] %}
|
||||
{{ make_tabs(requests_tabs) }}
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue