From 72f3ef3c3b2e66d20ba0440057ca96a7e30e4c29 Mon Sep 17 00:00:00 2001 From: stephendenham Date: Sun, 25 Aug 2013 12:26:18 +0000 Subject: [PATCH] Fix character encodings and album name. git-svn-id: svn://svn.code.sf.net/p/xbmc-groove/code@88 2dec19e3-eb1d-4749-8193-008c8bba0994 --- addon.xml | 2 +- changelog.txt | 4 ++++ resources/lib/GroovesharkAPI.py | 26 +++++++++++++++----------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/addon.xml b/addon.xml index 1488e32..a45509e 100644 --- a/addon.xml +++ b/addon.xml @@ -1,6 +1,6 @@  + version="2.0.4" provider-name="Stephen Denham"> diff --git a/changelog.txt b/changelog.txt index 9e3cc11..4f8c97e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +2.0.4 + +Fix character encodings and album name. + 2.0.3 Python coding bug fixes. diff --git a/resources/lib/GroovesharkAPI.py b/resources/lib/GroovesharkAPI.py index 2a164df..9b8feda 100644 --- a/resources/lib/GroovesharkAPI.py +++ b/resources/lib/GroovesharkAPI.py @@ -312,7 +312,7 @@ class GrooveAPI: if 'result' in result and 'SongID' in result['result']: info = result['result'] if 'CoverArtFilename' in info and info['CoverArtFilename'] != None: - info['CoverArtFilename'] = THUMB_URL+info['CoverArtFilename'].encode('ascii', 'ignore') + info['CoverArtFilename'] = THUMB_URL+info['CoverArtFilename'].encode('utf8', 'ignore') else: info['CoverArtFilename'] = 'None' return info @@ -401,7 +401,7 @@ class GrooveAPI: artists = items['result']['artists'] while(i < len(artists)): s = artists[i] - itemList.append([s['artistName'].encode('ascii', 'ignore'),\ + itemList.append([s['artistName'].encode('utf8', 'ignore'),\ s['artistID']]) i = i + 1 return itemList @@ -481,18 +481,22 @@ class GrooveAPI: info = self.getSongsInfo(s['SongID']) coverart = info['CoverArtFilename'] elif s['CoverArtFilename'] != None: - coverart = THUMB_URL+s['CoverArtFilename'].encode('ascii', 'ignore') + coverart = THUMB_URL+s['CoverArtFilename'].encode('utf8', 'ignore') else: coverart = 'None' if 'Name' in s: name = s['Name'] else: name = s['SongName'] - itemList.append([name.encode('ascii', 'ignore'),\ + if 'AlbumName' in s: + albumName = s['AlbumName'] + else: + albumName = "" + itemList.append([name.encode('utf8', 'ignore'),\ s['SongID'],\ - name,\ + albumName.encode('utf8', 'ignore'),\ s['AlbumID'],\ - s['ArtistName'].encode('ascii', 'ignore'),\ + s['ArtistName'].encode('utf8', 'ignore'),\ s['ArtistID'],\ coverart]) i = i + 1 @@ -508,7 +512,7 @@ class GrooveAPI: artists = items['result']['artists'] while(i < len(artists)): s = artists[i] - itemList.append([s['ArtistName'].encode('ascii', 'ignore'),\ + itemList.append([s['ArtistName'].encode('utf8', 'ignore'),\ s['ArtistID']]) i = i + 1 return itemList @@ -531,14 +535,14 @@ class GrooveAPI: while(i < l): s = albums[i] if 'Name' in s: - name = s['Name'].encode('ascii', 'ignore') + name = s['Name'].encode('utf8', 'ignore') else: - name = s['AlbumName'].encode('ascii', 'ignore') + name = s['AlbumName'].encode('utf8', 'ignore') if 'CoverArtFilename' in s and s['CoverArtFilename'] != None: - coverart = THUMB_URL+s['CoverArtFilename'].encode('ascii', 'ignore') + coverart = THUMB_URL+s['CoverArtFilename'].encode('utf8', 'ignore') else: coverart = 'None' - itemList.append([s['ArtistName'].encode('ascii', 'ignore'),\ + itemList.append([s['ArtistName'].encode('utf8', 'ignore'),\ s['ArtistID'],\ name,\ s['AlbumID'],\ -- 2.20.1