Add video and series detail pages

This commit is contained in:
2023-03-13 14:43:08 -04:00
parent c494779c82
commit d071319df4
8 changed files with 170 additions and 52 deletions

View File

@ -504,8 +504,8 @@
{% for scrobble in video_scrobble_list %}
<tr>
<td>{{scrobble.timestamp|naturaltime}}</td>
<td>{% if scrobble.video.tv_series%}S{{scrobble.video.season_number}}E{{scrobble.video.episode_number}} -{%endif %} {{scrobble.video.title}}</td>
<td>{% if scrobble.video.tv_series %}{{scrobble.video.tv_series}}{% endif %}
<td><a href="{{scrobble.video.get_absolute_url }}">{% if scrobble.video.tv_series%}S{{scrobble.video.season_number}}E{{scrobble.video.episode_number}} -{%endif %} {{scrobble.video.title}}</a></td>
<td><a href="{{scrobble.video.tv_series.get_absolute_url }}">{% if scrobble.video.tv_series %}{{scrobble.video.tv_series}}</a>{% endif %}
</td>
</tr>
{% endfor %}

View File

@ -7,35 +7,47 @@
{% block head_extra %}
<style>
.cover img { width: 250px; }
.cover { float: left; width:252px; padding:0; border: 1px solid #ccc; }
.summary {
float:left; width:600px; margin-left:10px;
}
.cover img {
width: 250px;
}
.cover {
float: left;
width: 252px;
padding: 0;
border: 1px solid #ccc;
}
.summary {
float: left;
width: 600px;
margin-left: 10px;
}
</style>
{% endblock %}
{% endblock %}
{% block lists %}
<div class="row">
{% if object.hltb_cover%}
<div class="cover"><img src="{{object.hltb_cover.url}}" /></div>
{% endif %}
<div class="summary">
{% if object.summary %}
<p>{{object.summary|safe|linebreaks|truncatewords:160}}</p>
<hr/>
<hr />
{% endif %}
<p style="float:right;">
<a href="{{object.igdb_link}}"><img src="{% static "images/igdb-logo.png" %}" width=35></a>
<a href="{{object.hltb_link}}"><img style="background: black;" src="{% static "images/hltb.webp" %}" width=35></a>
<a href="{{object.igdb_link}}"><img src="{% static " images/igdb-logo.png" %}" width=35></a>
<a href="{{object.hltb_link}}"><img style="background: black;" src="{% static " images/hltb.webp" %}"
width=35></a>
</p>
</div>
</div>
<div class="row">
<p>{{object.scrobble_set.count}} scrobbles</p>
<p>{{object.scrobble_set.last.long_play_seconds|natural_duration}}{% if object.scrobble_set.last.long_play_complete %} and completed{% else %} spent playing{% endif %}</p>
<p>{{object.scrobble_set.last.long_play_seconds|natural_duration}}{% if object.scrobble_set.last.long_play_complete
%} and completed{% else %} spent playing{% endif %}</p>
<p>
{% if object.scrobble_set.last.long_play_complete == True %}
<a href="">Play again</a>
@ -49,26 +61,29 @@
<h3>Last scrobbles</h3>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">Date</th>
<th scope="col">Completed</th>
<th scope="col">Duration</th>
<th scope="col">Platforms</th>
</tr>
</thead>
<tbody>
{% for scrobble in object.scrobble_set.all|dictsortreversed:"timestamp" %}
<tr>
<td>{{scrobble.timestamp}}</td>
<thead>
<tr>
<th scope="col">Date</th>
<th scope="col">Completed</th>
<th scope="col">Duration</th>
<th scope="col">Platforms</th>
</tr>
</thead>
<tbody>
{% for scrobble in object.scrobble_set.all|dictsortreversed:"timestamp" %}
<tr>
<td>{{scrobble.timestamp}}</td>
<td>{% if scrobble.long_play_complete == True %}Yes{% endif %}</td>
<td>{% if scrobble.in_progress %}Now playing{% else %}{{scrobble.playback_position_seconds|natural_duration}}{% endif %}</td>
<td>{% for platform in scrobble.video_game.platforms.all %}<a href="{{platform.get_absolute_url}}">{{platform}}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</td>
</tr>
{% endfor %}
</tbody>
<td>{% if scrobble.in_progress %}Now playing{% else
%}{{scrobble.playback_position_seconds|natural_duration}}{% endif %}</td>
<td>{% for platform in scrobble.video_game.platforms.all %}<a
href="{{platform.get_absolute_url}}">{{platform}}</a>{% if not forloop.last %}, {% endif
%}{% endfor %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}
{% endblock %}

View File

@ -0,0 +1,56 @@
{% extends "base_list.html" %}
{% load static %}
{% block title %}{{object.title}}{% if object.tv_series %} - {{object.tv_series}}{% endif %}{% endblock %}
{% block head_extra %}
<style>
.cover {float:left; width:300px; margin-right:10px;}
.summary{float:left; width:600px; margin-left:10px;}
</style>
{% endblock %}
{% block lists %}
<div class="row">
{% if object.cover_image %}
<div class="cover"><img src="{{object.cover_image.url}}" /></div>
{% endif %}
<div class="summary">
{% if object.plot%}
<p>{{object.plot|safe|linebreaks|truncatewords:160}}</p>
<hr />
{% endif %}
<p style="float:right;">
<a href="{{object.imdb_link}}"><img src="{% static " images/imdb-logo.png" %}" width=35></a>
</p>
</div>
</div>
<div class="row">
<div class="col-md">
<h3>Last scrobbles</h3>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">Date</th>
<th scope="col">Title</th>
<th scope="col">Season</th>
<th scope="col">Episode</th>
</tr>
</thead>
<tbody>
{% for scrobble in scrobbles %}
<tr>
<td>{{scrobble.timestamp}}</td>
<td><a href="{{scrobble.media_obj.get_absolute_url}}">{{scrobble.media_obj.title}}</a></td>
<td>{{scrobble.media_obj.season_number}}</td>
<td>{{scrobble.media_obj.episode_number}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}

View File

@ -1,8 +1,35 @@
{% extends "base_detail.html" %}
{% extends "base_list.html" %}
{% load static %}
{% block title %}{{object.title}}{% if object.tv_series %} - {{object.tv_series}}{% endif %}{% endblock %}
{% block details %}
{% block head_extra %}
<style>
.cover {float:left; width:300px; margin-right:10px;}
.summary{float:left; width:600px; margin-left:10px;}
</style>
{% endblock %}
{% block lists %}
<div class="row">
{% if object.cover_image %}
<div class="cover"><img src="{{object.cover_image.url}}" /></div>
{% endif %}
<div class="summary">
{% if object.overview %}
<p><em>{{object.overview}}</em></p>
{% endif %}
{% if object.plot%}
<p>{{object.plot|safe|linebreaks|truncatewords:160}}</p>
<hr />
{% endif %}
<p style="float:right;">
<a href="{{object.imdb_link}}"><img src="{% static " images/imdb-logo.png" %}" width=35></a>
<a href="{{object.tmdb_link}}"><img style="background: black;" src="{% static " images/tmdb-logo.png" %}" width=35></a>
</p>
</div>
</div>
<div class="row">
<div class="col-md">
<h3>Last scrobbles</h3>
@ -11,7 +38,6 @@
<thead>
<tr>
<th scope="col">Date</th>
<th scope="col">Title</th>
{% if object.tv_series %}
<th scope="col">Series</th>
<th scope="col">Season</th>
@ -23,9 +49,8 @@
{% for scrobble in object.scrobble_set.all %}
<tr>
<td>{{scrobble.timestamp}}</td>
<td>{{scrobble.video.title}}</td>
{% if object.tv_series %}
<td>{{scrobble.video.tv_series}}</td>
<td><a href="{{scrobble.video.tv_series.get_absolute_url}}">{{scrobble.video.tv_series}}</a></td>
<td>{{scrobble.video.season_number}}</td>
<td>{{scrobble.video.episode_number}}</td>
{% endif %}