From: Radek Czajka Date: Mon, 27 Dec 2021 13:10:19 +0000 (+0100) Subject: Minor view changes. X-Git-Url: https://git.mdrn.pl/audio.git/commitdiff_plain/631597417095f9adeaef8314862c1b9974e960c9?ds=inline Minor view changes. --- diff --git a/src/archive/models.py b/src/archive/models.py index aa84ce4..b467a68 100644 --- a/src/archive/models.py +++ b/src/archive/models.py @@ -198,7 +198,7 @@ class Audiobook(models.Model): return ( not self.youtube_volume or not type(self) - .objects.filter(youtube_volume=self.youtube_volume, index__lt=self.index) + .objects.filter(slug=self.slug, youtube_volume=self.youtube_volume, index__lt=self.index) .exists() ) diff --git a/src/archive/templates/archive/book.html b/src/archive/templates/archive/book.html index 9c44a9c..9cb1c80 100644 --- a/src/archive/templates/archive/book.html +++ b/src/archive/templates/archive/book.html @@ -51,7 +51,11 @@ - {{ audiobook.total|duration }} + {% if audiobook.youtube_volume %} + {{ audiobook.total|duration }} + {% else %} + {{ audiobook.subtotal|duration }} + {% endif %} {{ audiobook.duration|duration }} @@ -72,6 +76,7 @@ + {{ audiobook.subtotal|duration }} {{ audiobook.duration|duration }} diff --git a/src/archive/templates/archive/list_publishing.html b/src/archive/templates/archive/list_publishing.html index ad13504..2a8512d 100644 --- a/src/archive/templates/archive/list_publishing.html +++ b/src/archive/templates/archive/list_publishing.html @@ -17,7 +17,18 @@ {% for file in objects %} - + diff --git a/src/archive/views.py b/src/archive/views.py index 87eee5b..0b5a5ac 100644 --- a/src/archive/views.py +++ b/src/archive/views.py @@ -292,11 +292,17 @@ class BookView(ListView): "index" ) last_vol = None + last_vol_sub = None for b in qs: - if last_vol is None or last_vol.youtube_volume != b.youtube_volume: + if last_vol is None or last_vol.youtube_volume_index != b.youtube_volume_index: last_vol = b b.total = 0 + if last_vol_sub is None or b.youtube_volume: + last_vol_sub = last_vol + last_vol_sub.total_for_sub = 0 last_vol.total += b.duration + last_vol_sub.total_for_sub += b.duration + b.subtotal = last_vol_sub.total_for_sub return list(qs)
{{ file }} + + {{ file }} + {% if file.youtube_status == k.0 and file.youtube_volume %} +
+ + ({{ file.youtube_volume_index }}/{{ file.youtube_volume_count }}) + {{ file.youtube_volume }} + + {% endif %} +
+
{% if file.mp3_status == k.0 %}MP3{% endif %}