diff --git a/mopidy_funkwhale/library.py b/mopidy_funkwhale/library.py index 164825d..19128b4 100644 --- a/mopidy_funkwhale/library.py +++ b/mopidy_funkwhale/library.py @@ -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): diff --git a/tests/test_library.py b/tests/test_library.py index 9923d15..f864dd0 100644 --- a/tests/test_library.py +++ b/tests/test_library.py @@ -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, )