Commit 3f4120f2 authored by Georg Krause's avatar Georg Krause
Browse files

Merge branch '15-album-artists-and-album-track-ordering' into 'master'

Hide compilation artists and fix album track ordering (#15)

Closes #15

See merge request !14
parents 5392f5b7 9b00b87d
Pipeline #16275 passed with stages
in 3 minutes and 49 seconds
......@@ -37,6 +37,9 @@ class Extension(mopidy.ext.Extension):
schema["password"] = mopidy.config.Secret(optional=True)
schema["cache_duration"] = mopidy.config.Integer(optional=True)
schema["verify_cert"] = mopidy.config.Boolean(optional=True)
schema["exclude_compilation_artists"] = mopidy.config.Boolean(optional=True)
return schema
def validate_config(self, config):
......
......@@ -97,6 +97,8 @@ class APIClient(object):
self.username = self.config["funkwhale"]["username"]
self.session.verify = config["funkwhale"].get("verify_cert", True)
self.exclude_compilation_artists = self.config["funkwhale"].get("exclude_compilation_artists", True)
@property
def use_oauth(self):
return self.config["funkwhale"]["client_id"] and self.oauth_token
......@@ -132,6 +134,9 @@ class APIClient(object):
return response.json()
def list_artists(self, filters):
if self.exclude_compilation_artists:
filters = {"has_albums": "true", **filters}
response = self.session.get("artists/", params=filters)
response.raise_for_status()
return response.json()
......
......@@ -27,3 +27,7 @@ cache_duration = 600
# Control HTTPS certificate verification. Set it to false if you're using a self-signed certificate
verify_cert = true
# Hide artists that only have track credits when browsing artists.
# Set this to false to show all artists.
exclude_compilation_artists = true
\ No newline at end of file
......@@ -371,7 +371,7 @@ class FunkwhaleLibraryProvider(backend.LibraryProvider):
client = self.backend.client
config = {
"track": lambda id: [client.get_track(id)],
"album": lambda id: client.list_tracks({"album": id})["results"],
"album": lambda id: client.list_tracks({"album": id, "ordering": "position"})["results"],
"artist": lambda id: client.list_tracks({"artist": id})["results"],
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment