hide artist in lists if it is unique
This commit is contained in:
parent
f80b6458a1
commit
5117218f86
15
main.py
15
main.py
|
@ -339,7 +339,15 @@ def list_albums(params):
|
||||||
plugin.log('list_albums with args:' + query_args_json);
|
plugin.log('list_albums with args:' + query_args_json);
|
||||||
|
|
||||||
#Get items
|
#Get items
|
||||||
items = connection.walk_albums(**query_args)
|
generator = connection.walk_albums(**query_args)
|
||||||
|
|
||||||
|
#make a list out of the generator so we can iterate it several times
|
||||||
|
items = list(generator)
|
||||||
|
|
||||||
|
#check if there is only one artist for this album (and then hide it)
|
||||||
|
artists = [item.get('artist',None) for item in items]
|
||||||
|
if len(artists) <= 1:
|
||||||
|
params['hide_artist'] = True
|
||||||
|
|
||||||
# Iterate through items
|
# Iterate through items
|
||||||
for item in items:
|
for item in items:
|
||||||
|
@ -578,6 +586,11 @@ def list_tracks(params):
|
||||||
|
|
||||||
#make a list out of the generator so we can iterate it several times
|
#make a list out of the generator so we can iterate it several times
|
||||||
items = list(generator)
|
items = list(generator)
|
||||||
|
|
||||||
|
#check if there is only one artist for this album (and then hide it)
|
||||||
|
artists = [item.get('artist',None) for item in items]
|
||||||
|
if len(artists) <= 1:
|
||||||
|
params['hide_artist'] = True
|
||||||
|
|
||||||
#update stars
|
#update stars
|
||||||
if menu_id == 'tracks_starred':
|
if menu_id == 'tracks_starred':
|
||||||
|
|
Loading…
Reference in New Issue