From e3364d15ce1b7006ad6926614e11f9de123414af Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Wed, 11 Mar 2026 16:34:48 -0400 Subject: [PATCH] [scrobblers] Actually lookup the album ID --- vrobbler/apps/scrobbles/scrobblers.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vrobbler/apps/scrobbles/scrobblers.py b/vrobbler/apps/scrobbles/scrobblers.py index e56d620..0522b2c 100644 --- a/vrobbler/apps/scrobbles/scrobblers.py +++ b/vrobbler/apps/scrobbles/scrobblers.py @@ -4,6 +4,7 @@ from datetime import datetime, timedelta from typing import Any, Optional import pendulum +from pylast import Album import pytz import requests from beers.models import Beer @@ -76,13 +77,21 @@ def mopidy_scrobble_media(post_data: dict, user_id: int) -> Scrobble: media_obj = PodcastEpisode.find_or_create(**parsed_data) else: + # TODO this kind of sucks, there's gotta be a way to get this in one shot + try: + album_id = ( + Album.objects.filter(name=post_data.get("album", "")) + .first() + .id + ) + except Exception: + pass media_obj = Track.find_or_create( title=post_data.get("name", ""), artist_name=post_data.get("artist", ""), album_name=post_data.get("album", ""), run_time_seconds=post_data.get("run_time", 900000), ) - album_id = media_obj.album_id log = {} try: