From 51c1acd677d6b090f57dff39916e222b9a563570 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Sun, 24 Nov 2024 09:36:50 -0500 Subject: [PATCH] [notifications] Add click to finish --- vrobbler/apps/beers/models.py | 3 +++ vrobbler/apps/books/models.py | 3 --- vrobbler/apps/moods/models.py | 3 --- vrobbler/apps/scrobbles/mixins.py | 7 ++++++- vrobbler/apps/scrobbles/utils.py | 1 + vrobbler/apps/videogames/models.py | 3 --- vrobbler/apps/videos/models.py | 6 ++++-- vrobbler/templates/_scrobblable_list.html | 2 +- vrobbler/templates/beers/beer_detail.html | 2 +- vrobbler/templates/boardgames/boardgame_detail.html | 2 +- vrobbler/templates/scrobbles/_media_box.html | 2 +- vrobbler/templates/scrobbles/long_plays_in_progress.html | 4 ++-- vrobbler/templates/tasks/task_detail.html | 2 +- vrobbler/templates/trails/trail_detail.html | 2 +- vrobbler/templates/videogames/videogame_detail.html | 2 +- 15 files changed, 23 insertions(+), 21 deletions(-) diff --git a/vrobbler/apps/beers/models.py b/vrobbler/apps/beers/models.py index a35f1e7..8a4cf94 100644 --- a/vrobbler/apps/beers/models.py +++ b/vrobbler/apps/beers/models.py @@ -67,6 +67,9 @@ class Beer(ScrobblableMixin): def get_absolute_url(self) -> str: return reverse("beers:beer_detail", kwargs={"slug": self.uuid}) + def __str__(self): + return f"{self.title} by {self.producer}" + @property def subtitle(self): return self.producer.name diff --git a/vrobbler/apps/books/models.py b/vrobbler/apps/books/models.py index ed23d90..5ea07d8 100644 --- a/vrobbler/apps/books/models.py +++ b/vrobbler/apps/books/models.py @@ -150,9 +150,6 @@ class Book(LongPlayScrobblableMixin): url = self.cover_medium.url return url - def get_start_url(self): - return reverse("scrobbles:start", kwargs={"uuid": self.uuid}) - def get_absolute_url(self): return reverse("books:book_detail", kwargs={"slug": self.uuid}) diff --git a/vrobbler/apps/moods/models.py b/vrobbler/apps/moods/models.py index 136d1f9..9489200 100644 --- a/vrobbler/apps/moods/models.py +++ b/vrobbler/apps/moods/models.py @@ -38,9 +38,6 @@ class Mood(ScrobblableMixin): def get_absolute_url(self): return reverse("moods:mood-detail", kwargs={"slug": self.uuid}) - def get_start_url(self): - return reverse("scrobbles:start", kwargs={"uuid": self.uuid}) - @property def subtitle(self) -> str: return "" diff --git a/vrobbler/apps/scrobbles/mixins.py b/vrobbler/apps/scrobbles/mixins.py index aecac9f..8e3d0fa 100644 --- a/vrobbler/apps/scrobbles/mixins.py +++ b/vrobbler/apps/scrobbles/mixins.py @@ -95,9 +95,14 @@ class ScrobblableMixin(TimeStampedModel): ) return Scrobble.create_or_update(self, user_id, scrobble_data) - def get_start_url(self): + @property + def start_url(self): return reverse("scrobbles:start", kwargs={"uuid": self.uuid}) + @property + def finish_url(self) -> str: + return reverse("scrobbles:finish", kwargs={"uuid": self.uuid}) + @property def strings(self) -> ScrobblableConstants: return ScrobblableConstants() diff --git a/vrobbler/apps/scrobbles/utils.py b/vrobbler/apps/scrobbles/utils.py index ce73034..c3d9a14 100644 --- a/vrobbler/apps/scrobbles/utils.py +++ b/vrobbler/apps/scrobbles/utils.py @@ -309,5 +309,6 @@ def send_notifications_for_scrobble(scrobble_id): "Title": scrobble.media_obj.strings.verb, "Priority": scrobble.media_obj.strings.priority, "Tags": scrobble.media_obj.strings.tags, + "Click": scrobble.finish_url, }, ) diff --git a/vrobbler/apps/videogames/models.py b/vrobbler/apps/videogames/models.py index 43182f0..a1e8955 100644 --- a/vrobbler/apps/videogames/models.py +++ b/vrobbler/apps/videogames/models.py @@ -169,9 +169,6 @@ class VideoGame(LongPlayScrobblableMixin): slug = self.title.lower().replace(" ", "-") return f"https://igdb.com/games/{slug}" - def get_start_url(self): - return reverse("scrobbles:start", kwargs={"uuid": self.uuid}) - @property def logdata_cls(self): return VideoGameLogData diff --git a/vrobbler/apps/videos/models.py b/vrobbler/apps/videos/models.py index fa7432b..b8c0c26 100644 --- a/vrobbler/apps/videos/models.py +++ b/vrobbler/apps/videos/models.py @@ -23,6 +23,7 @@ from videos.imdb import lookup_video_from_imdb logger = logging.getLogger(__name__) BNULL = {"blank": True, "null": True} + class Channel(TimeStampedModel): uuid = models.UUIDField(default=uuid4, editable=False, **BNULL) name = models.CharField(max_length=255) @@ -75,6 +76,7 @@ class Channel(TimeStampedModel): logger.warning("Not implemented yet") return + class Series(TimeStampedModel): uuid = models.UUIDField(default=uuid4, editable=False, **BNULL) name = models.CharField(max_length=255) @@ -223,9 +225,9 @@ class Video(ScrobblableMixin): def __str__(self): if self.video_type == self.VideoType.TV_EPISODE: - return f"{self.title} - {self.tv_series} - Season {self.season_number}, Episode {self.episode_number}" + return f"{self.title} / [S{self.season_number}E{self.episode_number}] {self.tv_series}" if self.video_type == self.VideoType.YOUTUBE: - return f"{self.title} - {self.channel}" + return f"{self.title} / {self.channel}" return self.title def get_absolute_url(self): diff --git a/vrobbler/templates/_scrobblable_list.html b/vrobbler/templates/_scrobblable_list.html index a5c88c0..322b80d 100644 --- a/vrobbler/templates/_scrobblable_list.html +++ b/vrobbler/templates/_scrobblable_list.html @@ -14,7 +14,7 @@ {{obj}} {% if request.user.is_authenticated %} {{obj.scrobble_count}} - Scrobble + Scrobble {% endif %} {% endfor %} diff --git a/vrobbler/templates/beers/beer_detail.html b/vrobbler/templates/beers/beer_detail.html index f986582..d7c7ed4 100644 --- a/vrobbler/templates/beers/beer_detail.html +++ b/vrobbler/templates/beers/beer_detail.html @@ -41,7 +41,7 @@

{{object.scrobble_set.count}} scrobbles

- Drink again + Drink again

diff --git a/vrobbler/templates/boardgames/boardgame_detail.html b/vrobbler/templates/boardgames/boardgame_detail.html index e48e5f2..fa6c20c 100644 --- a/vrobbler/templates/boardgames/boardgame_detail.html +++ b/vrobbler/templates/boardgames/boardgame_detail.html @@ -44,7 +44,7 @@

{{object.scrobble_set.count}} scrobbles

- Play again + Play again

diff --git a/vrobbler/templates/scrobbles/_media_box.html b/vrobbler/templates/scrobbles/_media_box.html index 91fa991..3633fb4 100644 --- a/vrobbler/templates/scrobbles/_media_box.html +++ b/vrobbler/templates/scrobbles/_media_box.html @@ -3,7 +3,7 @@
{{media.title}}
- {% if media.is_long_play_in_progress %}Playing{% else %}Resume{% endif %} + {% if media.is_long_play_in_progress %}Playing{% else %}Resume{% endif %} Finish
diff --git a/vrobbler/templates/scrobbles/long_plays_in_progress.html b/vrobbler/templates/scrobbles/long_plays_in_progress.html index c16d6f5..d47c0d1 100644 --- a/vrobbler/templates/scrobbles/long_plays_in_progress.html +++ b/vrobbler/templates/scrobbles/long_plays_in_progress.html @@ -28,7 +28,7 @@
{% endif %}
- {% if media.is_long_play_in_progress %}Playing{% else %}Resume{% endif %} + {% if media.is_long_play_in_progress %}Playing{% else %}Resume{% endif %} Finish
@@ -55,7 +55,7 @@ {{media.scrobble_set.count}} {{media}} {% if media.author %}{{media.author}}{% else %}{{media.platforms.first}}{% endif %} - Resume + Resume Finish {% endfor %} diff --git a/vrobbler/templates/tasks/task_detail.html b/vrobbler/templates/tasks/task_detail.html index 65dc796..1882a28 100644 --- a/vrobbler/templates/tasks/task_detail.html +++ b/vrobbler/templates/tasks/task_detail.html @@ -41,7 +41,7 @@

{{object.scrobble_set.count}} scrobbles

- Play again + Play again

diff --git a/vrobbler/templates/trails/trail_detail.html b/vrobbler/templates/trails/trail_detail.html index a11f7c3..0f2939d 100644 --- a/vrobbler/templates/trails/trail_detail.html +++ b/vrobbler/templates/trails/trail_detail.html @@ -41,7 +41,7 @@

{{object.scrobble_set.count}} scrobbles

- Play again + Play again

diff --git a/vrobbler/templates/videogames/videogame_detail.html b/vrobbler/templates/videogames/videogame_detail.html index 55d1cd4..56c4c4c 100644 --- a/vrobbler/templates/videogames/videogame_detail.html +++ b/vrobbler/templates/videogames/videogame_detail.html @@ -67,7 +67,7 @@ {% if object.scrobble_set.last.long_play_complete == True %} Play again {% else %} - Resume playing + Resume playing {% endif %}