Code:
def retrieve_album_list( self ):
print "# Retrieving Album List"
album_list = []
total = 0
json_album = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "AudioLibrary.GetAlbums", "id": 1}')
print json_album
json_albums = re.compile( "{(.*?)}", re.DOTALL ).findall(json_album)
for i in json_albums:
album = {}
id = re.search( '"albumid" : (.*?),', i )
if id:
albumid = (id.group(1))
print "Album ID: %s" % albumid
title = re.search( '"label" : "(.*?)",',i)
if title:
albumtitle = (title.group(1))
print "Album: %s" % repr(albumtitle)
else:
albumtitle = ""
if albumtitle == "":
pass
else:
total=total + 1
album["title"]=albumtitle
album["local_id"]= albumid
album_list.append(album)
#print album_list
#print "total: %s" % total
return album_list, totalthe JSONRPC feed back is as follows:
Code:
21:15:46 T:2716855152 M:2611576832 NOTICE: {
"id" : 1,
"jsonrpc" : "2.0",
"result" : {
"albums" : [
{
"albumid" : 1,
"label" : "Black Jesuz"
},
{
"albumid" : 2,
"label" : "Greatests Hits - CD 1",
"thumbnail" : "special://masterprofile/Thumbnails/Music/8/82abf61a.tbn"
},
{
"albumid" : 3,
"label" : "Greatests Hits - CD 2",
"thumbnail" : "special://masterprofile/Thumbnails/Music/5/59bc5e8d.tbn"
},the xbmc.log shows the following:
Code:
21:15:47 T:2716855152 M:2612072448 NOTICE: Album ID: 1
21:15:47 T:2716855152 M:2612072448 NOTICE: Album ID: 2
21:15:47 T:2716855152 M:2612072448 NOTICE: Album: 'Greatests Hits - CD 1'
21:15:47 T:2716855152 M:2612072448 NOTICE: Album ID: 3
21:15:47 T:2716855152 M:2612072448 NOTICE: Album: 'Greatests Hits - CD 2'the problem appears as the following: if the "thumbnail": is missing, I can not parse the albumname...
Any and all help is appreciated!

![[Image: e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e...4c076g.jpg]](http://www.mediafire.com/conv/e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e4d2fe70f903275f93e5e4c076g.jpg)
Search
Help