[music] Attempts to fix bad lookups from LastFM and Jellyfin
Broader issue was creating tracks without albums that were duplicates of existing tracks because sometimes Jellyfin and LastFM do not have albums sent with them.
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
from datetime import datetime
|
||||
import logging
|
||||
import re
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from urllib.parse import parse_qs, urlparse
|
||||
|
||||
import pendulum
|
||||
import pytz
|
||||
@ -56,7 +55,11 @@ def mopidy_scrobble_media(post_data: dict, user_id: int) -> Scrobble:
|
||||
if media_type == Scrobble.MediaType.PODCAST_EPISODE:
|
||||
media_obj = get_or_create_podcast(post_data)
|
||||
else:
|
||||
media_obj = get_or_create_track(post_data, MOPIDY_POST_KEYS)
|
||||
media_obj = Track.find_or_create(
|
||||
title=post_data.get("title", ""),
|
||||
album_name=post_data.get("album", ""),
|
||||
run_time_seconds=post_data.get("run_time", 900000),
|
||||
)
|
||||
|
||||
log = {}
|
||||
try:
|
||||
@ -109,8 +112,11 @@ def jellyfin_scrobble_media(
|
||||
post_data.get("Provider_imdb", "").replace("tt", "")
|
||||
)
|
||||
else:
|
||||
media_obj = get_or_create_track(
|
||||
post_data, post_keys=JELLYFIN_POST_KEYS
|
||||
media_obj = Track.find_or_create(
|
||||
title=post_data.get("Name", ""),
|
||||
album_name=post_data.get("Album", ""),
|
||||
run_time_seconds=post_data.get("RunTime", 900000),
|
||||
musicbrainz_id=post_data.get("Provider_musicbrainztrack", ""),
|
||||
)
|
||||
# A hack because we don't worry about updating music ... we either finish it or we don't
|
||||
playback_position_seconds = 0
|
||||
|
||||
Reference in New Issue
Block a user