Added option for merging albums in browse mode
This commit is contained in:
parent
742c5b66fc
commit
03da132550
17
main.py
17
main.py
|
@ -240,7 +240,6 @@ def menu_tracks(params):
|
||||||
))
|
))
|
||||||
|
|
||||||
@plugin.action()
|
@plugin.action()
|
||||||
#@plugin.cached(cachetime) # cache (in minutes)
|
|
||||||
def browse_folders(params):
|
def browse_folders(params):
|
||||||
# get connection
|
# get connection
|
||||||
connection = get_connection()
|
connection = get_connection()
|
||||||
|
@ -307,6 +306,7 @@ def browse_indexes(params):
|
||||||
def list_directory(params):
|
def list_directory(params):
|
||||||
# get connection
|
# get connection
|
||||||
connection = get_connection()
|
connection = get_connection()
|
||||||
|
merge_artist = Addon().get_setting('merge')
|
||||||
|
|
||||||
if connection==False:
|
if connection==False:
|
||||||
return
|
return
|
||||||
|
@ -315,7 +315,7 @@ def list_directory(params):
|
||||||
|
|
||||||
# Get items
|
# Get items
|
||||||
id = params.get('id')
|
id = params.get('id')
|
||||||
items = walk_directory(id)
|
items = walk_directory(id, merge_artist)
|
||||||
|
|
||||||
# Iterate through items
|
# Iterate through items
|
||||||
for item in items:
|
for item in items:
|
||||||
|
@ -381,7 +381,6 @@ def browse_library(params):
|
||||||
))
|
))
|
||||||
|
|
||||||
@plugin.action()
|
@plugin.action()
|
||||||
#@plugin.cached(cachetime) #cache (in minutes)
|
|
||||||
def list_albums(params):
|
def list_albums(params):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -455,7 +454,6 @@ def list_albums(params):
|
||||||
))
|
))
|
||||||
|
|
||||||
@plugin.action()
|
@plugin.action()
|
||||||
#@plugin.cached(cachetime) #cache (in minutes)
|
|
||||||
def list_tracks(params):
|
def list_tracks(params):
|
||||||
|
|
||||||
menu_id = params.get('menu_id')
|
menu_id = params.get('menu_id')
|
||||||
|
@ -761,7 +759,7 @@ def get_artist_info(artist_id, forced=False):
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
plugin.log("Artist keyerror, is this a new cache file? %s"%cache_file)
|
plugin.log("Artist keyerror, is this a new cache file? %s"%cache_file)
|
||||||
if(time.time()-last_update>(random.randint(1,111)*360) or forced):
|
if(time.time()-last_update>(random.randint(1,111)*360) or forced):
|
||||||
plugin.log("Artist cache expired, updating %s elapsed vs random %s forced %s"%(time.time()-last_update,(random.randint(1,111)*3600), forced))
|
plugin.log("Artist cache expired, updating %s elapsed vs random %s forced %s"%(int(time.time()-last_update),(random.randint(1,111)*3600), forced))
|
||||||
try:
|
try:
|
||||||
artist_info = connection.getArtistInfo2(artist_id).get('artistInfo2')
|
artist_info = connection.getArtistInfo2(artist_id).get('artistInfo2')
|
||||||
storage['artist_info'] = artist_info
|
storage['artist_info'] = artist_info
|
||||||
|
@ -1312,7 +1310,6 @@ def create_list_item(item):
|
||||||
return list_item
|
return list_item
|
||||||
|
|
||||||
def _set_resolved_url(context):
|
def _set_resolved_url(context):
|
||||||
|
|
||||||
plugin.log_debug('Resolving URL from {0}'.format(str(context)))
|
plugin.log_debug('Resolving URL from {0}'.format(str(context)))
|
||||||
if context.play_item==None:
|
if context.play_item==None:
|
||||||
list_item = xbmcgui.ListItem(path=context.path)
|
list_item = xbmcgui.ListItem(path=context.path)
|
||||||
|
@ -1366,9 +1363,11 @@ def walk_index(folder_id=None):
|
||||||
Request Subsonic's index and iterate each item.
|
Request Subsonic's index and iterate each item.
|
||||||
"""
|
"""
|
||||||
response = connection.getIndexes(folder_id)
|
response = connection.getIndexes(folder_id)
|
||||||
|
plugin.log("Walk index resp: %s"%response)
|
||||||
try:
|
try:
|
||||||
for index in response["indexes"]["index"]:
|
for index in response["indexes"]["index"]:
|
||||||
for artist in index["artist"]:
|
for artist in index["artist"]:
|
||||||
|
plugin.log("artist: %s"%artist)
|
||||||
yield artist
|
yield artist
|
||||||
except KeyError:
|
except KeyError:
|
||||||
yield from ()
|
yield from ()
|
||||||
|
@ -1403,7 +1402,7 @@ def walk_folders():
|
||||||
except KeyError:
|
except KeyError:
|
||||||
yield from ()
|
yield from ()
|
||||||
|
|
||||||
def walk_directory(directory_id):
|
def walk_directory(directory_id, merge_artist = True):
|
||||||
"""
|
"""
|
||||||
Request a Subsonic music directory and iterate over each item.
|
Request a Subsonic music directory and iterate over each item.
|
||||||
"""
|
"""
|
||||||
|
@ -1411,8 +1410,8 @@ def walk_directory(directory_id):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for child in response["directory"]["child"]:
|
for child in response["directory"]["child"]:
|
||||||
if child.get("isDir"):
|
if merge_artist and child.get("isDir"):
|
||||||
for child in walk_directory(child["id"]):
|
for child in walk_directory(child["id"], merge_artist):
|
||||||
yield child
|
yield child
|
||||||
else:
|
else:
|
||||||
yield child
|
yield child
|
||||||
|
|
|
@ -169,3 +169,7 @@ msgctxt "#30042"
|
||||||
msgid "port"
|
msgid "port"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30043"
|
||||||
|
msgid "Merge album folders"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -169,3 +169,6 @@ msgctxt "#30042"
|
||||||
msgid "port"
|
msgid "port"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30043"
|
||||||
|
msgid "Merge album folders"
|
||||||
|
msgstr ""
|
||||||
|
|
|
@ -168,3 +168,6 @@ msgctxt "#30042"
|
||||||
msgid "port"
|
msgid "port"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30043"
|
||||||
|
msgid "Merge album folders"
|
||||||
|
msgstr ""
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
<setting label="30040" id="useget" type="bool" default="true" />
|
<setting label="30040" id="useget" type="bool" default="true" />
|
||||||
<setting label="30041" id="legacyauth" type="bool" default="false" />
|
<setting label="30041" id="legacyauth" type="bool" default="false" />
|
||||||
<setting label="30017" type="lsep" />
|
<setting label="30017" type="lsep" />
|
||||||
<setting label="30018" id="cachetime" type="labelenum" default="15" values="1|5|15|30|60|120|180|720|1440"/>
|
<setting label="30018" id="cachetime" type="labelenum" default="3600" values="1|5|15|30|60|120|180|720|1440|3600"/>
|
||||||
|
<setting label="30043" id="merge" type="bool" default="false" />
|
||||||
|
|
||||||
</category>
|
</category>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
Loading…
Reference in New Issue