Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
funkwhale
mopidy
Commits
7d29c71b
Commit
7d29c71b
authored
Jun 19, 2020
by
Georg Krause
Committed by
Agate
Jun 19, 2020
Browse files
Add option to show only artists from own libraries
parent
aab99430
Changes
2
Hide whitespace changes
Inline
Side-by-side
mopidy_funkwhale/library.py
View file @
7d29c71b
...
...
@@ -161,6 +161,7 @@ class FunkwhaleLibraryProvider(backend.LibraryProvider):
[
new_folder
(
"Recent"
,
"artists:recent"
),
new_folder
(
"By name"
,
"artists:by-name"
),
new_folder
(
"Own Content"
,
"artists:scope-me"
),
],
False
,
)
...
...
@@ -207,6 +208,23 @@ class FunkwhaleLibraryProvider(backend.LibraryProvider):
]
return
artists
,
True
if
root
==
"scope-me"
:
if
end
:
# list albums
return
(
self
.
browse_albums
(
uri_prefix
=
albums_uri_prefix
,
remaining
=
end
),
True
)
payload
=
self
.
backend
.
client
.
list_artists
(
{
"ordering"
:
"name"
,
"page_size"
:
50
,
"scope"
:
"me"
}
)
uri_prefix
=
"funkwhale:directory:artists:scope-me"
artists
=
[
convert_to_artist
(
row
,
uri_prefix
=
uri_prefix
,
ref
=
True
)
for
row
in
self
.
backend
.
client
.
load_all
(
payload
)
]
return
artists
,
True
return
[],
False
def
search
(
self
,
query
=
None
,
uris
=
None
,
exact
=
False
):
...
...
tests/test_library.py
View file @
7d29c71b
...
...
@@ -157,6 +157,9 @@ def test_browse_artists_root(library):
models
.
Ref
.
directory
(
uri
=
"funkwhale:directory:artists:by-name"
,
name
=
"By name"
),
models
.
Ref
.
directory
(
uri
=
"funkwhale:directory:artists:scope-me"
,
name
=
"Own Content"
),
],
False
,
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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