Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
funkwhale
mopidy
Commits
63cd47d3
Commit
63cd47d3
authored
Aug 12, 2021
by
Erin
Browse files
Handle invalid lookup URIs
parent
fefcdf31
Changes
1
Hide whitespace changes
Inline
Side-by-side
mopidy_funkwhale/library.py
View file @
63cd47d3
...
...
@@ -375,9 +375,14 @@ class FunkwhaleLibraryProvider(backend.LibraryProvider):
"artist"
:
lambda
id
:
client
.
list_tracks
({
"artist"
:
id
})[
"results"
],
}
type
,
id
=
parse_uri
(
uri
)
payload
=
config
[
type
](
id
)
return
[
convert_to_track
(
row
,
cache
=
self
.
cache
)
for
row
in
payload
]
try
:
type
,
id
=
parse_uri
(
uri
)
except
(
IndexError
,
ValueError
):
logger
.
info
(
f
"Lookup failed: invalid uri '
{
uri
}
'"
)
return
[]
else
:
payload
=
config
[
type
](
id
)
return
[
convert_to_track
(
row
,
cache
=
self
.
cache
)
for
row
in
payload
]
def
parse_uri
(
uri
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment