Compare commits

...

2 Commits
0.2.2 ... 0.3.0

Author SHA1 Message Date
2a20d1212b Bump version to 0.3.0 2023-01-11 11:56:12 -05:00
83b6ba9cc3 Add tabs and clean up main page 2023-01-11 11:55:44 -05:00
3 changed files with 118 additions and 95 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "vrobbler" name = "vrobbler"
version = "0.2.2" version = "0.3.0"
description = "" description = ""
authors = ["Colin Powell <colin@unbl.ink>"] authors = ["Colin Powell <colin@unbl.ink>"]

View File

@ -75,7 +75,7 @@ class RecentScrobbleList(ListView):
def get_queryset(self): def get_queryset(self):
return Scrobble.objects.filter( return Scrobble.objects.filter(
track__isnull=False, in_progress=False track__isnull=False, in_progress=False
).order_by('-timestamp')[:25] ).order_by('-timestamp')[:15]
@csrf_exempt @csrf_exempt

View File

@ -3,7 +3,7 @@
{% block content %} {% block content %}
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4"> <main class="col-md-4 ms-sm-auto col-lg-10 px-md-4">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom"> <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">Dashboard</h1> <h1 class="h2">Dashboard</h1>
<div class="btn-toolbar mb-2 mb-md-0"> <div class="btn-toolbar mb-2 mb-md-0">
@ -18,108 +18,131 @@
</div> </div>
</div> </div>
<canvas class="my-4 w-100" id="myChart" width="900" height="380"></canvas> <canvas class="my-4 w-100" id="myChart" width="900" height="220"></canvas>
<div class="container"> <div class="container">
<div class="row">
<p>Today <b>{{counts.today}}</b> | This Week <b>{{counts.week}}</b> | This Month <b>{{counts.month}}</b> | This Year <b>{{counts.year}}</b> | All Time <b>{{counts.alltime}}</b></p>
</div>
<div class="row"> <div class="row">
<div class="col-md"> <div class="col-md">
<h2>Top artists this week</h2> <ul class="nav nav-tabs" id="myTab" role="tablist">
<div class="table-responsive"> <li class="nav-item" role="presentation">
<table class="table table-striped table-sm"> <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#artists-week" type="button" role="tab" aria-controls="home" aria-selected="true">Weekly Artists</button>
<thead> </li>
<tr> <li class="nav-item" role="presentation">
<th scope="col">#</th> <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#tracks-week" type="button" role="tab" aria-controls="profile" aria-selected="false">Weekly Tracks</button>
<th scope="col">Artist</th> </li>
</tr> </ul>
</thead>
<tbody> <div class="tab-content" id="myTabContent">
{% for artist in top_weekly_artists %} <div class="tab-pane fade show" id="artists-week" role="tabpanel" aria-labelledby="artists-week-tab">
<tr> <h2>Top artists this week</h2>
<td>{{artist.num_scrobbles}}</td> <div class="table-responsive">
<td>{{artist.name}}</td> <table class="table table-striped table-sm">
</tr> <thead>
{% endfor %} <tr>
</tbody> <th scope="col">#</th>
</table> <th scope="col">Artist</th>
</tr>
</thead>
<tbody>
{% for artist in top_weekly_artists %}
<tr>
<td>{{artist.num_scrobbles}}</td>
<td>{{artist.name}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="tab-pane fade show active" id="tracks-week" role="tabpanel" aria-labelledby="tracks-week-tab">
<h2>Top tracks this week</h2>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Track</th>
<th scope="col">Artist</th>
</tr>
</thead>
<tbody>
{% for track in top_weekly_tracks %}
<tr>
<td>{{track.num_scrobbles}}</td>
<td>{{track.title}}</td>
<td>{{track.artist.name}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div> </div>
</div> </div>
<div class="col-lg"> <div class="col-md">
<h2>Top tracks this week</h2> <ul class="nav nav-tabs" id="myTab" role="tablist">
<div class="table-responsive"> <li class="nav-item" role="presentation">
<table class="table table-striped table-sm"> <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#latest-listened" type="button" role="tab" aria-controls="home" aria-selected="true">Latest Listened</button>
<thead> </li>
<tr> <li class="nav-item" role="presentation">
<th scope="col">#</th> <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#latest-watched" type="button" role="tab" aria-controls="profile" aria-selected="false">Latest Watched</button>
</li>
</ul>
<div class="tab-content" id="myTabContent2">
<div class="tab-pane fade show active" id="latest-listened" role="tabpanel" aria-labelledby="latest-listened-tab">
<h2>Latest listened</h2>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">Time</th>
<th scope="col">Track</th> <th scope="col">Track</th>
<th scope="col">Artist</th> <th scope="col">Artist</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for track in top_weekly_tracks %} {% for scrobble in object_list %}
<tr> <tr>
<td>{{track.num_scrobbles}}</td> <td>{{scrobble.timestamp|naturaltime}}</td>
<td>{{track.title}}</td> <td>{{scrobble.track.title}}</td>
<td>{{track.artist.name}}</td> <td>{{scrobble.track.artist.name}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg">
<h2>Latest listened</h2>
<p>Today <b>{{counts.today}}</b> | This Week <b>{{counts.week}}</b> | This Month <b>{{counts.month}}</b> | This Year <b>{{counts.year}}</b> | All Time <b>{{counts.alltime}}</b></p>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">Time</th>
<th scope="col">Track</th>
<th scope="col">Artist</th>
<th scope="col">Source</th>
</tr>
</thead>
<tbody>
{% for scrobble in object_list %}
<tr>
<td>{{scrobble.timestamp|naturaltime}}</td>
<td>{{scrobble.track.title}}</td>
<td>{{scrobble.track.artist.name}}</td>
<td>{{scrobble.source}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="col-lg"> <div class="tab-pane fade show" id="latest-watched" role="tabpanel" aria-labelledby="latest-watched-tab">
<h2>Latest watched</h2> <h2>Latest watched</h2>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-sm"> <table class="table table-striped table-sm">
<thead> <thead>
<tr> <tr>
<th scope="col">Time</th> <th scope="col">Time</th>
<th scope="col">Title</th> <th scope="col">Title</th>
<th scope="col">Series</th> <th scope="col">Series</th>
<th scope="col">Source</th> <th scope="col">Source</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for scrobble in video_scrobble_list %} {% for scrobble in video_scrobble_list %}
<tr> <tr>
<td>{{scrobble.timestamp|naturaltime}}</td> <td>{{scrobble.timestamp|naturaltime}}</td>
<td>{% if scrobble.video.tv_series %}E{{scrobble.video.season_number}}S{{scrobble.video.season_number}} -{% endif %} {{scrobble.video.title}}</td> <td>{% if scrobble.video.tv_series %}E{{scrobble.video.season_number}}S{{scrobble.video.season_number}} -{% endif %} {{scrobble.video.title}}</td>
<td>{% if scrobble.video.tv_series %}{{scrobble.video.tv_series}}{% endif %}</td> <td>{% if scrobble.video.tv_series %}{{scrobble.video.tv_series}}{% endif %}</td>
<td>{{scrobble.source}}</td> <td>{{scrobble.source}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div> </div>
</div> </div>