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]
name = "vrobbler"
version = "0.11.1"
version = "0.11.3"
description = ""
authors = ["Colin Powell <colin@unbl.ink>"]

View File

@ -6,7 +6,7 @@ from uuid import uuid4
import musicbrainzngs
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.urls import reverse
from django.utils.translation import gettext_lazy as _

View File

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

View File

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

View File

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

View File

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