Release Experimental Google Music Addon
Hi,

when I tried to perform a search (using exp1.2), I always ran into this python error:

Code:
ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
               Error Type: <type 'exceptions.UnicodeEncodeError'>
               Error Contents: 'ascii' codec can't encode character u'\xdf' in position 26: ordinal not in range(128)
               Traceback (most recent call last):
                 File "/home/kodi/.kodi/addons/plugin.audio.googlemusic.exp/default.py", line 84, in <module>
                   navigation.listMenu(params)  
                 File "/home/kodi/.kodi/addons/plugin.audio.googlemusic.exp/GoogleMusicNavigation.py", line 66, in listMenu
                   listItems = self.getSearch(query)
                 File "/home/kodi/.kodi/addons/plugin.audio.googlemusic.exp/GoogleMusicNavigation.py", line 280, in getSearch
                   listItems.append(self.addFolderListItem(album[0],{'path':"search_result",'query':album[0]+' '+album[1]}))
                 File "/home/kodi/.kodi/addons/plugin.audio.googlemusic.exp/GoogleMusicNavigation.py", line 130, in addFolderListItem
                   url = "?".join([sys.argv[0],urllib.urlencode(params)])
                 File "/usr/lib/python2.7/urllib.py", line 1332, in urlencode
                   v = quote_plus(str(v))
               UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf' in position 26: ordinal not in range(128)
               -->End of Python script error report<--

Seems urlencode has some trouble with unicode. I'm not very familiar with python but after some googling I found the following workaround that fixed it for me:

Code:
--- old/GoogleMusicNavigation.py    2014-10-16 16:30:32.000000000 +0200
+++ new/GoogleMusicNavigation.py    2014-12-29 19:12:47.513368708 +0100
@@ -127,7 +127,10 @@
     def addFolderListItem(self, name, params, contextMenu=[], album_art_url=''):
         li = self.xbmcgui.ListItem(label=name, iconImage=album_art_url, thumbnailImage=album_art_url)
         li.addContextMenuItems(contextMenu, replaceItems=True)
+        str_params = {}
+        for p_key,p_value in params.iteritems():
+            str_params[p_key] = unicode(p_value).encode('utf-8')
-        url = "?".join([sys.argv[0],urllib.urlencode(params)])
+        url = "?".join([sys.argv[0],urllib.urlencode(str_params)])
         return url, li, "true"

     def listPlaylistSongs(self, playlist_id):

edit: Unfortunately this workaround broke other things in artist / album lists etc. Sad Assume I should leave the bug fixing to someone with better python skills, will be glad to assist with testing and providing logs though.

-- wrayan
Reply


Messages In This Thread
RE: Experimental Google Music Addon - by Drir - 2014-07-26, 08:21
RE: Experimental Google Music Addon - by SBCV - 2014-11-13, 03:38
RE: Experimental Google Music Addon - by SBCV - 2014-11-16, 23:12
RE: Experimental Google Music Addon - by SBCV - 2014-11-17, 06:06
RE: Experimental Google Music Addon - by wrayan - 2014-12-29, 20:39
RE: Experimental Google Music Addon - by Auri - 2016-02-05, 20:03
Experimental Google Music Addon - by huzz456 - 2015-02-19, 01:41
Experimental Google Music Addon - by haarlokk - 2015-06-08, 01:53
RE: Experimental Google Music Addon - by moyn - 2015-12-03, 23:58
RE: Experimental Google Music Addon - by moyn - 2015-12-10, 22:17
RE: Experimental Google Music Addon - by moyn - 2015-12-10, 22:32
RE: Experimental Google Music Addon - by moyn - 2015-12-22, 12:29
RE: Experimental Google Music Addon - by spec - 2016-02-21, 19:13
RE: Experimental Google Music Addon - by spec - 2016-02-27, 20:36
RE: Experimental Google Music Addon - by tibb - 2016-02-29, 19:50
RE: Experimental Google Music Addon - by view - 2016-04-10, 17:44
Experimental Google Music Addon - by sjchmura - 2016-04-10, 18:28
Experimental Google Music Addon - by sjchmura - 2016-04-11, 22:24
Experimental Google Music Addon - by sjchmura - 2016-05-25, 21:14
issues with None from params - by brtkrbzhnv - 2016-08-27, 14:47
Experimental Google Music Addon - by sjchmura - 2016-09-04, 14:29
Experimental Google Music Addon - by sjchmura - 2016-09-11, 15:10
RE: Experimental Google Music Addon - by mrpg - 2016-09-11, 17:27
Experimental Google Music Addon - by sjchmura - 2016-09-11, 18:47
Experimental Google Music Addon - by sjchmura - 2016-09-20, 04:57
RE: Experimental Google Music Addon - by m2c2 - 2016-10-29, 20:16
RE: Experimental Google Music Addon - by nb2a - 2016-11-29, 05:00
RE: Experimental Google Music Addon - by nb2a - 2016-11-30, 17:00
RE: Experimental Google Music Addon - by Tux2 - 2016-12-21, 11:14
RE: Experimental Google Music Addon - by benj - 2017-01-19, 02:51
RE: Experimental Google Music Addon - by nb2a - 2017-01-24, 05:57
RE: Experimental Google Music Addon - by AshG - 2017-01-30, 12:53
RE: Experimental Google Music Addon - by AshG - 2017-01-30, 23:57
RE: Experimental Google Music Addon - by vevs - 2019-04-05, 17:15
RE: Experimental Google Music Addon - by vevs - 2019-05-08, 02:05
Logout Mark Read Team Forum Stats Members Help
Experimental Google Music Addon17