sessions / 29cb6a49917b403364ba424d799f96d6fba19cdc

/home/powellc/src/code.unbl.ink/secstate/vrobbler

This commit has no recorded session.

diff

ignore whitespace

commit 29cb6a49917b403364ba424d799f96d6fba19cdcAuthor: Colin Powell <colin@unbl.ink>Date:   Thu Jun 11 10:48:21 2026 -0400    [books] Really fix the subtitle bugdiff --git a/vrobbler/apps/books/models.py b/vrobbler/apps/books/models.pyindex a41ee44..1547541 100644--- a/vrobbler/apps/books/models.py+++ b/vrobbler/apps/books/models.py@@ -71,7 +71,7 @@ class BookLogData(BaseLogData, LongPlayLogData):     _excluded_fields = {"koreader_hash", "page_data"}      def avg_seconds_per_page(self):-        if self.page_data:+        if self.page_data and isinstance(self.page_data, dict):             total_duration = 0             for page_num, stats in self.page_data.items():                 total_duration += stats.get("duration", 0)@@ -173,6 +173,9 @@ class Book(LongPlayScrobblableMixin):     genre = TaggableManager(through=ObjectWithGenres, blank=True, verbose_name="Genre")      def __str__(self) -> str:+        if not self.subtitle:+            return self.title+         return f"{self.title} - {self.subtitle}"      def save(self, *args, **kwargs):@@ -184,14 +187,18 @@ class Book(LongPlayScrobblableMixin):      @property     def subtitle(self):-        subtitle = ""+        subtitle_parts = []         if self.author:-            subtitle += self.author.name+            subtitle_parts.append(self.author.name)         if self.issue_number and "Issue" not in str(self.title):-            subtitle += " - Issue {self.issue_number}"+            subtitle_parts.append(f"Issue {self.issue_number}")         if self.volume_number and "Volume" not in str(self.title):-            subtitle += " - Volume {self.volume_number}"-        return subtitle+            subtitle_parts.append(f"Volume {self.volume_number}")+        if len(subtitle_parts) > 1:+            return " / ".join(subtitle_parts)+        if len(subtitle_parts) == 1:+            return subtitle_parts[0]+        return ""      @property     def strings(self) -> ScrobblableConstants: