[scrobbles] Fix mopidy lookup
This commit is contained in:
@ -64,6 +64,7 @@ def mopidy_scrobble_media(post_data: dict, user_id: int) -> Scrobble:
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
album_id = None
|
||||||
if media_type == Scrobble.MediaType.PODCAST_EPISODE:
|
if media_type == Scrobble.MediaType.PODCAST_EPISODE:
|
||||||
parsed_data = parse_mopidy_uri(post_data.get("mopidy_uri", ""))
|
parsed_data = parse_mopidy_uri(post_data.get("mopidy_uri", ""))
|
||||||
if not parsed_data:
|
if not parsed_data:
|
||||||
@ -81,16 +82,19 @@ def mopidy_scrobble_media(post_data: dict, user_id: int) -> Scrobble:
|
|||||||
album_name=post_data.get("album", ""),
|
album_name=post_data.get("album", ""),
|
||||||
run_time_seconds=post_data.get("run_time", 900000),
|
run_time_seconds=post_data.get("run_time", 900000),
|
||||||
)
|
)
|
||||||
|
album_id = media_obj.album_id
|
||||||
|
|
||||||
log = {}
|
log = {}
|
||||||
try:
|
try:
|
||||||
log = {
|
mopidy_source = post_data.get("mopidy_uri", "").split(":")[0]
|
||||||
"mopidy_source": post_data.get("mopidy_uri", "").split(":")[0],
|
|
||||||
"album_id": media_obj.album_id,
|
|
||||||
"raw_data": post_data,
|
|
||||||
}
|
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
mopidy_source = "Unknown"
|
||||||
|
log = {
|
||||||
|
"mopidy_source": mopidy_source,
|
||||||
|
"raw_data": post_data,
|
||||||
|
}
|
||||||
|
if album_id:
|
||||||
|
log["album_id"] = album_id
|
||||||
|
|
||||||
return media_obj.scrobble_for_user(
|
return media_obj.scrobble_for_user(
|
||||||
user_id,
|
user_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user