Skip to content

Commit

Permalink
fix/ocp_uris (#102)
Browse files Browse the repository at this point in the history
file:// was being preprended to uris where it shouldn't, eg. spotify

a log error was also wrongly logged for playlists
  • Loading branch information
JarbasAl authored Jul 5, 2024
1 parent b9239c7 commit 4ce888c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ovos_bus_client/apis/ocp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4ce888c

Please sign in to comment.