[podcasts] Fixes enrichment of podcasts with podcastindex
This commit is contained in:
@ -15,7 +15,8 @@ from locations.models import GeoLocation
|
||||
from music.constants import JELLYFIN_POST_KEYS, MOPIDY_POST_KEYS
|
||||
from music.models import Track
|
||||
from music.utils import get_or_create_track
|
||||
from podcasts.utils import get_or_create_podcast
|
||||
from podcasts.models import PodcastEpisode
|
||||
from podcasts.utils import parse_mopidy_uri
|
||||
from scrobbles.constants import (
|
||||
JELLYFIN_AUDIO_ITEM_TYPES,
|
||||
MANUAL_SCROBBLE_FNS,
|
||||
@ -54,7 +55,19 @@ 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)
|
||||
parsed_data = parse_mopidy_uri(post_data.get("mopidy_uri", ""))
|
||||
podcast_name = post_data.get(
|
||||
"album", parsed_data.get("podcast_name", "")
|
||||
)
|
||||
|
||||
media_obj = PodcastEpisode.find_or_create(
|
||||
title=parsed_data.get("episode_filename", ""),
|
||||
podcast_name=podcast_name,
|
||||
producer_name=post_data.get("artist", ""),
|
||||
number=parsed_data.get("episode_num", ""),
|
||||
pub_date=parsed_data.get("pub_date", ""),
|
||||
mopidy_uri=post_data.get("mopidy_uri", ""),
|
||||
)
|
||||
else:
|
||||
media_obj = Track.find_or_create(
|
||||
title=post_data.get("name", ""),
|
||||
|
||||
Reference in New Issue
Block a user