Compare commits

..

4 Commits

Author SHA1 Message Date
d34e56aa89 Bump version to 0.11.3 2023-02-27 11:13:45 -05:00
6316d4bead Fix chart templates 2023-02-27 11:13:13 -05:00
56e5728245 Bump version to 0.11.2 2023-02-27 10:30:44 -05:00
6ff170e169 Quite a few bugs 2023-02-27 10:30:20 -05:00
6 changed files with 53 additions and 25 deletions

View File

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

View File

@ -6,7 +6,7 @@ from uuid import uuid4
import musicbrainzngs import musicbrainzngs
from django.conf import settings from django.conf import settings
from django.core.files.base import File from django.core.files.base import ContentFile, File
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _

View File

@ -6,14 +6,12 @@ from scrobbles.models import Scrobble
def now_playing(request): def now_playing(request):
user = request.user user = request.user
now = timezone.now() now = timezone.now()
if user.is_authenticated: if not user.is_authenticated:
if user.profile: return {}
timezone.activate(pytz.timezone(user.profile.timezone)) return {
now = timezone.localtime(timezone.now()) 'now_playing_list': Scrobble.objects.filter(
return { in_progress=True,
'now_playing_list': Scrobble.objects.filter( is_paused=False,
in_progress=True, user=user,
is_paused=False, )
user=user, }
)
}

View File

@ -87,17 +87,17 @@ class RecentScrobbleList(ListView):
data['sport_scrobble_list'] = completed_for_user.filter( data['sport_scrobble_list'] = completed_for_user.filter(
sport_event__isnull=False sport_event__isnull=False
).order_by('-timestamp')[:15] ).order_by('-timestamp')[:15]
data['active_imports'] = AudioScrobblerTSVImport.objects.filter(
processing_started__isnull=False,
processed_finished__isnull=True,
user=self.request.user,
)
data["weekly_data"] = week_of_scrobbles(user=user) data["weekly_data"] = week_of_scrobbles(user=user)
data['counts'] = scrobble_counts(user) data['counts'] = scrobble_counts(user)
data['imdb_form'] = ScrobbleForm data['imdb_form'] = ScrobbleForm
data['export_form'] = ExportScrobbleForm data['export_form'] = ExportScrobbleForm
data['active_imports'] = AudioScrobblerTSVImport.objects.filter(
processing_started__isnull=False,
processed_finished__isnull=True,
user=self.request.user,
)
return data return data
def get_queryset(self): def get_queryset(self):
@ -468,11 +468,11 @@ class ChartRecordView(TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context_data = super().get_context_data(**kwargs) context_data = super().get_context_data(**kwargs)
date = self.request.GET.get('date') date = self.request.GET.get("date")
media_type = self.request.GET.get('media') media_type = self.request.GET.get("media", "Track")
user = self.request.user user = self.request.user
params = {} params = {}
context_data['artist_charts'] = {} context_data["artist_charts"] = {}
if not date: if not date:
context_data['artist_charts'] = { context_data['artist_charts'] = {
@ -543,6 +543,7 @@ class ChartRecordView(TemplateView):
# TODO recalculate # TODO recalculate
... ...
context_data['charts'] = charts
context_data['name'] = name context_data['name'] = name
context_data['in_progress'] = in_progress context_data['in_progress'] = in_progress
return context_data return context_data

View File

@ -1,9 +1,9 @@
{% extends "base_detail.html" %} {% extends "base_list.html" %}
{% load mathfilters %} {% load mathfilters %}
{% block title %}{{object.name}}{% endblock %} {% block title %}{{object.name}}{% endblock %}
{% block details %} {% block lists %}
<div class="row"> <div class="row">
{% for album in artist.album_set.all %} {% for album in artist.album_set.all %}

View File

@ -4,6 +4,34 @@
{% block lists %} {% block lists %}
<div class="row"> <div class="row">
{% if charts %}
<div class="tab-content" id="artistTabContent">
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">Rank</th>
<th scope="col">Artist</th>
<th scope="col">Track</th>
<th scope="col">Scrobbles</th>
</tr>
</thead>
<tbody>
{% for chart in charts %}
<tr>
<td>{{chart.rank}}</td>
<td><a href="{{chart.media_obj.artist.get_absolute_url}}">{{chart.media_obj.artist}}</a></td>
<td><a href="{{chart.media_obj.get_absolute_url}}">{{chart.media_obj.title}}</a></td>
<td>{{chart.count}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% if artist_charts %}
<h2>Top Artists</h2> <h2>Top Artists</h2>
<ul class="nav nav-tabs" id="artistTab" role="tablist"> <ul class="nav nav-tabs" id="artistTab" role="tablist">
@ -25,7 +53,6 @@
<table class="table table-striped table-sm"> <table class="table table-striped table-sm">
<thead> <thead>
<tr> <tr>
<th scope="col">Rank</th>
<th scope="col">Artist</th> <th scope="col">Artist</th>
<th scope="col">Scrobbles</th> <th scope="col">Scrobbles</th>
</tr> </tr>
@ -33,7 +60,6 @@
<tbody> <tbody>
{% for artist in artists %} {% for artist in artists %}
<tr> <tr>
<td>{{artist.rank}}</td>
<td><a href="{{artist.get_absolute_url}}">{{artist}}</a></td> <td><a href="{{artist.get_absolute_url}}">{{artist}}</a></td>
<td>{{artist.num_scrobbles}}</td> <td>{{artist.num_scrobbles}}</td>
</tr> </tr>
@ -44,9 +70,11 @@
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% endif %}
</div> </div>
<div class="row"> <div class="row">
{% if track_charts %}
<h2>Top Tracks</h2> <h2>Top Tracks</h2>
<ul class="nav nav-tabs" id="artistTab" role="tablist"> <ul class="nav nav-tabs" id="artistTab" role="tablist">
@ -89,6 +117,7 @@
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% endif %}
</div> </div>
{% endblock %} {% endblock %}