Add option to show or hide track artists when browsing artists
parent
c1461b2e27
commit
bef84395ed
|
@ -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["show_track_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.show_track_artists = self.config["funkwhale"].get("show_track_artists", False)
|
||||
|
||||
@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 not self.show_track_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
|
||||
|
||||
# Show all artists when browsing, even those without albums (e.g. per-track
|
||||
# credits or collaborations). Set this to false to only show album artists
|
||||
show_track_artists = false
|
Loading…
Reference in New Issue