diff --git a/vrobbler/apps/scrobbles/models.py b/vrobbler/apps/scrobbles/models.py index 2626151..7ecec62 100644 --- a/vrobbler/apps/scrobbles/models.py +++ b/vrobbler/apps/scrobbles/models.py @@ -957,7 +957,7 @@ class Scrobble(TimeStampedModel): # GeoLocations are a special case scrobble if mtype == cls.MediaType.GEO_LOCATION: - logger.warn( + logger.warning( f"[create_or_update] geoloc requires create_or_update_location" ) scrobble = cls.create_or_update_location( @@ -981,7 +981,7 @@ class Scrobble(TimeStampedModel): scrobble.can_be_updated or scrobble_data["playback_status"] == "stopped" ): - if "log" in scrobble_data.keys(): + if "log" in scrobble_data.keys() and scrobble.log: scrobble_data["log"] = scrobble.log | scrobble_data["log"] return scrobble.update(scrobble_data) @@ -997,7 +997,8 @@ class Scrobble(TimeStampedModel): }, ) - return cls.create(scrobble_data) + scrobble = cls.create(scrobble_data) + return scrobble @classmethod def create_or_update_location( @@ -1151,7 +1152,6 @@ class Scrobble(TimeStampedModel): cls, scrobble_data: dict, ) -> "Scrobble": - scrobble_data["log"] = {} scrobble = cls.objects.create( **scrobble_data, ) diff --git a/vrobbler/apps/scrobbles/scrobblers.py b/vrobbler/apps/scrobbles/scrobblers.py index f7a75c6..24164c8 100644 --- a/vrobbler/apps/scrobbles/scrobblers.py +++ b/vrobbler/apps/scrobbles/scrobblers.py @@ -313,11 +313,11 @@ def manual_scrobble_task(url: str, user_id: int): if "shortcut" in url: source = "Shortcut" title = "Generic Shortcut task" - description = url.split("/")[-1] + description = " ".join(url.split("/")[-1].split("-")).capitalize if "todoist" in url: source = "Todoist" title = "Generic Todoist task" - description = url.split("-")[-1] + description = " ".join(url.split("/")[-1].split("-")[:-1]).capitalize task = Task.find_or_create(title) @@ -337,7 +337,6 @@ def manual_scrobble_task(url: str, user_id: int): "media_type": Scrobble.MediaType.WEBPAGE, }, ) - scrobble = Scrobble.create_or_update(task, user_id, scrobble_dict) return scrobble diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index e443556..35102c7 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -44,7 +44,7 @@ from scrobbles.models import ( RetroarchImport, Scrobble, ) -from scrobbles.scrobblers import manual_scrobble_from_url +from scrobbles.scrobblers import * from scrobbles.tasks import ( process_koreader_import, process_lastfm_import, diff --git a/vrobbler/apps/tasks/models.py b/vrobbler/apps/tasks/models.py index 12c6e1a..8fe7b4f 100644 --- a/vrobbler/apps/tasks/models.py +++ b/vrobbler/apps/tasks/models.py @@ -14,6 +14,7 @@ BNULL = {"blank": True, "null": True} @dataclass class TaskLogData(LongPlayLogData): + description: Optional[str] = None source_id: Optional[str] = None serial_scrobble_id: Optional[int] = None long_play_complete: Optional[bool] = None diff --git a/vrobbler/templates/base.html b/vrobbler/templates/base.html index 568a6b6..22aac64 100644 --- a/vrobbler/templates/base.html +++ b/vrobbler/templates/base.html @@ -290,6 +290,7 @@ {% if scrobble.media_obj.primary_image_url %}
{{scrobble.media_obj.subtitle}}
{% endif %} + {% if scrobble.logdata.description %}{{scrobble.logdata.description}}
{% endif %}{{scrobble.timestamp|naturaltime}} from {{scrobble.source}}