From 4ce888cee54a13aa4af67738352c9152b589e0f9 Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Fri, 5 Jul 2024 23:00:14 +0100 Subject: [PATCH] fix/ocp_uris (#102) file:// was being preprended to uris where it shouldn't, eg. spotify a log error was also wrongly logged for playlists --- ovos_bus_client/apis/ocp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ovos_bus_client/apis/ocp.py b/ovos_bus_client/apis/ocp.py index 71781ed..d2b3cd1 100644 --- a/ovos_bus_client/apis/ocp.py +++ b/ovos_bus_client/apis/ocp.py @@ -35,12 +35,12 @@ def ensure_uri(s: str): if s is uri, s is returned otherwise file:// is prepended """ if isinstance(s, str): - if '://' not in s: + if ':' not in s: return 'file://' + abspath(s) else: return s elif isinstance(s, (tuple, list)): # Handle (mime, uri) arg - if '://' not in s[0]: + if ':' not in s[0]: return 'file://' + abspath(s[0]), s[1] else: return s @@ -271,7 +271,7 @@ def norm_tracks(tracks: list): tracks[idx] = track.as_media_entry elif isinstance(track, list) and not isinstance(track, Playlist): tracks[idx] = OCPInterface.norm_tracks(track) - elif not isinstance(track, MediaEntry): + elif not isinstance(track, (Playlist, MediaEntry)): # TODO - support string uris # let it fail in next assert # log all bad entries before failing