Fix parsing of podcast episode titles
This commit is contained in:
@ -21,9 +21,7 @@ def scrobble_podcast(data_dict: dict, user_id: Optional[int]) -> Scrobble:
|
|||||||
podcast_name = parsed_data.get("podcast_name")
|
podcast_name = parsed_data.get("podcast_name")
|
||||||
podcast_dict = {"name": podcast_name}
|
podcast_dict = {"name": podcast_name}
|
||||||
|
|
||||||
episode_name = data_dict.get("name")
|
episode_name = parsed_data.get("episode_filename")
|
||||||
if not episode_name or '.mp3' in episode_name:
|
|
||||||
episode_name = parsed_data.get("episode_filename")
|
|
||||||
episode_dict = {
|
episode_dict = {
|
||||||
"title": episode_name,
|
"title": episode_name,
|
||||||
"run_time_ticks": data_dict.get("run_time_ticks"),
|
"run_time_ticks": data_dict.get("run_time_ticks"),
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
from urllib.parse import unquote
|
||||||
|
|
||||||
from dateutil.parser import ParserError, parse
|
from dateutil.parser import ParserError, parse
|
||||||
|
|
||||||
@ -19,8 +20,8 @@ def parse_mopidy_uri(uri: str) -> dict:
|
|||||||
logger.debug(f"Parsing URI: {uri}")
|
logger.debug(f"Parsing URI: {uri}")
|
||||||
parsed_uri = uri.split('/')
|
parsed_uri = uri.split('/')
|
||||||
|
|
||||||
episode_str = parsed_uri.pop(-1).strip(".mp3")
|
episode_str = unquote(parsed_uri.pop(-1).strip(".mp3"))
|
||||||
podcast_str = parsed_uri.pop(-1).replace("%20", " ")
|
podcast_str = unquote(parsed_uri.pop(-1))
|
||||||
possible_date_str = episode_str[0:10]
|
possible_date_str = episode_str[0:10]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user