MediaDash/templates/index.html

150 lines
6.6 KiB
HTML
Raw Normal View History

2021-08-29 13:03:28 +00:00
{% extends "base.html" %}
{% macro make_row(title,items) %}
<div class="d-flex flex-wrap">
{% for item in items %}
{{item|safe}}
{% endfor %}
</div>
{% endmacro %}
{% macro make_tabs(tabs) %}
<div class="row">
<div class="col">
<ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
{% for (label,_) in tabs %}
{% set slug = (label|slugify) %}
{% if not (loop.first and loop.last) %}
<li class="nav-item">
<a class="nav-link {{'active' if loop.first}}" id="nav-{{slug}}-tab" data-toggle="pill" href="#pills-{{slug}}" role="tab" aria-controls="pills-{{slug}}" aria-selected="{{loop.first}}">
{{label}}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
<div class="tab-content" id="searchResults">
{% for (label,items) in tabs %}
{% set slug = (label|slugify) %}
<div class="tab-pane fade {{'show active' if loop.first}}" id="pills-{{slug}}" role="tabpanel" aria-labelledby="nav-{{slug}}-tab">
{{make_row(label,items)}}
</div>
{% endfor %}
</div>
{% endmacro %}
{% macro upcoming(data) %}
<div class="container">
<div class="row">
<div class="col-lg">
<h3>Movies</h3>
2021-12-13 18:11:43 +00:00
<table class="table table-sm table-bordered">
2021-08-29 13:03:28 +00:00
<tr>
<th>Title</th>
2021-12-13 18:11:43 +00:00
<th>Status</th>
2021-08-29 13:03:28 +00:00
<th>In Cinemas</th>
<th>Digital Release</th>
</tr>
{% for movie in data.calendar.movies %}
{% if movie.isAvailable and movie.hasFile %}
2021-12-13 18:11:43 +00:00
{% set row_attrs = "bg-success" %}
2021-08-29 13:03:28 +00:00
{% elif movie.isAvailable and not movie.hasFile %}
2021-12-13 18:11:43 +00:00
{% set row_attrs = "bg-danger" %}
2021-08-29 13:03:28 +00:00
{% elif not movie.isAvailable and movie.hasFile %}
2021-12-13 18:11:43 +00:00
{% set row_attrs = "bg-primary" %}
2021-08-29 13:03:28 +00:00
{% elif not movie.isAvailable and not movie.hasFile %}
2021-12-13 18:11:43 +00:00
{% set row_attrs = "bg-info" %}
2021-08-29 13:03:28 +00:00
{% endif %}
2021-12-13 18:11:43 +00:00
<tr class={{row_attrs}}>
2021-08-29 13:03:28 +00:00
<td>
2021-12-13 18:11:43 +00:00
<a title="{{movie.overview}}" href="{{urljoin(config.APP_CONFIG.radarr_url,'movie/'+movie.titleSlug)}}" style="color: #eee; text-decoration: underline;">
2021-08-29 13:03:28 +00:00
{{movie.title}}
</a>
</td>
2021-12-13 18:11:43 +00:00
<td>{{movie.status}}</td>
2021-08-29 13:03:28 +00:00
<td>{{movie.inCinemas|fromiso|ago_dt_utc_human(rnd=0)}}</td>
2021-12-13 18:11:43 +00:00
{% if movie.digitalRelease %}
<td>{{movie.digitalRelease|fromiso|ago_dt_utc_human(rnd=0)}}</td>
{% else %}
<td>Unknown</td>
{% endif %}
2021-08-29 13:03:28 +00:00
</tr>
{% endfor %}
</table>
<h3>Episodes</h3>
2021-12-13 18:11:43 +00:00
<table class="table table-sm table-bordered">
2021-08-29 13:03:28 +00:00
<tr>
<th>Season | Episode Number</th>
<th>Show</th>
<th>Title</th>
2021-12-13 18:11:43 +00:00
<th>Status</th>
2021-08-29 13:03:28 +00:00
<th>Air Date</th>
</tr>
{% for entry in data.calendar.episodes %}
2021-12-13 18:11:43 +00:00
{% if entry.details %}
{% set details = entry.details[0] %}
{% endif %}
{% if entry.episode.hasAired and entry.episode.hasFile %}
{% set row_attrs = {"class":"bg-success"} %}
{% elif entry.episode.hasAired and not entry.episode.hasFile and details %}
{% set row_attrs = {"style":"background-color: green !important"} %}
{% elif entry.episode.hasAired and not entry.episode.hasFile %}
{% set row_attrs = {"class":"bg-danger"} %}
{% elif not entry.episode.hasAired and entry.episode.hasFile %}
{% set row_attrs = {"class":"bg-primary"} %}
{% elif not entry.episode.hasAired and not entry.episode.hasFile %}
{% set row_attrs = {"class":"bg-info"} %}
{% endif %}
<tr {{row_attrs|xmlattr}}>
<td>{{entry.episode.seasonNumber}} | {{entry.episode.episodeNumber}}</td>
<td>
<a href="{{urljoin(config.APP_CONFIG.sonarr_url,'series/'+entry.series.titleSlug)}}" style="color: #eee; text-decoration: underline;">
{{entry.series.title}}
</a>
</td>
<td title="{{entry.episode.overview}}">{{entry.episode.title}}</td>
<td>
{% if details %}
{% set details = entry.details[0] %}
{% set dl_prc =((details.size-details.sizeleft)/details.size)*100|round(2) %}
{{details.status}} ({{dl_prc|round(2)}} %)
{% elif row_attrs.class=="bg-success" %}
downloaded
{% elif row_attrs.class=="bg-danger" %}
not downloaded
{% elif row_attrs.class=="bg-primary" %}
leaked?
{% elif row_attrs.class=="bg-info" %}
not aired
{% endif %}
</td>
<td>{{entry.episode.airDateUtc|fromiso|ago_dt_utc_human(rnd=0)}}</td>
</tr>
2021-08-29 13:03:28 +00:00
{% endfor %}
</table>
</div>
</div>
</div>
{% endmacro %}
{% block app_content %}
{% if data is none %}
<h2>No Data available!</h2>
{% else %}
{% set tabs = [] %}
2021-12-13 18:11:43 +00:00
{% do tabs.append(("Schedule",[upcoming(data)])) %}
2021-08-29 13:03:28 +00:00
{% for row in data.images %}
{% if row[0] is string %}
{% set title=row[0] %}
{% set row=row[1:] %}
{% do tabs.append((title,row)) %}
{% endif %}
{% endfor %}
{{make_tabs(tabs)}}
{% endif %}
{% endblock %}