RE: Experimental Google Music Addon - Shogun - 2017-01-23
Foreverguest,
a small request from my side....is it possbile to fetch the song_id from the current song played to use it for my own script (to map it to a button):
Small example....I want to use the command:
xbmc.executebuiltin( "ActivateWindow(Music,plugin://plugin.audio.googlemusic.exp/?path=create_station&trackid=" + song_id + ")" )
I understand, that i have to import the library like "import GoogleMusicApi" of the addon to get the key...
I was looking at the GoogleMusicPlaySong.py...maybe i am on the right path...
Code: class GoogleMusicPlaySong():
def __init__(self):
self.api = GoogleMusicApi.GoogleMusicApi()
def play(self, params):
song_id = params.pop('song_id')
if song_id[0] == 't': song_id = song_id.capitalize()
params = self.__getSongStreamUrl(song_id, params)
url = params.pop('url')
title = params.get('title')
utils.log("Song: %s - %r " % (title, url))
Thanks for help!
RE: Experimental Google Music Addon - foreverguest - 2017-01-23
Hi Shogun, I think the best way to get the song_id from a song being played is through a json rpc call.
Code: import xbmc, json
jsonGetPlaylistPos = '{"jsonrpc":"2.0", "method":"Player.GetProperties", "params":{"playerid":0,"properties":"playlistid","position"]},"id":1}'
jsonGetPlaylistItems = '{"jsonrpc":"2.0", "method":"Playlist.GetItems", "params":{"playlistid":0,"properties":["file"]}, "id":1}'
# get song position in playlist
playerProperties = json.loads(xbmc.executeJSONRPC(jsonGetPlaylistPos))
position = playerProperties['result']['position']
# get song id
playlistItems = json.loads(xbmc.executeJSONRPC(jsonGetPlaylistItems))
song_id = utils.paramsToDict(playlistItems['result']['items'][position]['file']).get("song_id")
RE: Experimental Google Music Addon - Shogun - 2017-01-23
Very much appreciated!
Inserted your code, getting an error:
Code: 22:31:51.433 T:3388 DEBUG: CPythonInvoker(77, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): start processing
22:31:51.451 T:3388 DEBUG: -->Python Interpreter Initialized<--
22:31:51.451 T:3388 DEBUG: CPythonInvoker(77, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): the source file to load is "C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py"
22:31:51.452 T:3388 DEBUG: CPythonInvoker(77, C:\Users\XX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): setting the Python path to C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2;C:\Program Files (x86)\Kodi17\system\python\DLLs;C:\Program Files (x86)\Kodi17\system\python\Lib;C:\Program Files (x86)\Kodi17\python27.zip;C:\Program Files (x86)\Kodi17\system\python\lib\plat-win;C:\Program Files (x86)\Kodi17\system\python\lib\lib-tk;C:\Program Files (x86)\Kodi17;C:\Program Files (x86)\Kodi17\system\python;C:\Program Files (x86)\Kodi17\system\python\lib\site-packages
22:31:51.452 T:3388 DEBUG: CPythonInvoker(77, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): entering source directory C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2
22:31:51.452 T:3388 DEBUG: CPythonInvoker(77, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): instantiating addon using automatically obtained id of "script.exp.title2" dependent on version 2.14.0 of the xbmc.python api
22:31:51.458 T:3388 ERROR: JSONRPC: Failed to parse '{"jsonrpc":"2.0", "method":"Player.GetProperties", "params":{"playerid":0,"properties":"playlistid","position"]},"id":1}'
22:31:51.458 T:3388 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.KeyError'>
Error Contents: ('result',)
Traceback (most recent call last):
File "C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py", line 8, in <module>
position = playerProperties['result']['position']
KeyError: ('result',)
-->End of Python script error report<--
22:31:51.459 T:3388 INFO: Python script stopped
22:31:51.459 T:3388 DEBUG: Thread LanguageInvoker 3388 terminating
So i have to give "result" a definition, right?
Sorry, i am novice, but it would be very helpful to simplify the process instead to going through the menus to start the radio (similar to the lastfm playlist generator, just for your addon)
Again, thank you for your efforts...
RE: Experimental Google Music Addon - nb2a - 2017-01-24
Are there any known issues with Krypton 17? I keep getting invalid credential or connection issues message. Thank you for the fantastic add on.
RE: Experimental Google Music Addon - foreverguest - 2017-01-24
(2017-01-23, 23:44)Shogun Wrote: Very much appreciated!
Inserted your code, getting an error:
So i have to give "result" a definition, right?
Sorry, i am novice, but it would be very helpful to simplify the process instead to going through the menus to start the radio (similar to the lastfm playlist generator, just for your addon)
Again, thank you for your efforts... Sorry, I missed a bracket when posting the code. Before "position"]
Try:
Code: jsonGetPlaylistPos = '{"jsonrpc":"2.0", "method":"Player.GetProperties", "params":{"playerid":0,"properties":"playlistid",["position"]},"id":1}'
RE: Experimental Google Music Addon - foreverguest - 2017-01-24
(2017-01-24, 05:57)nb2a Wrote: Are there any known issues with Krypton 17? I keep getting invalid credential or connection issues message. Thank you for the fantastic add on.
Not that I know of. I use Krypton without issues.
With version 16 it works for you? if so try removing the addon settings and starting fresh.
RE: Experimental Google Music Addon - Shogun - 2017-01-24
(2017-01-24, 14:48)foreverguest Wrote: Sorry, I missed a bracket when posting the code. Before "position"]
Try:
Code: jsonGetPlaylistPos = '{"jsonrpc":"2.0", "method":"Player.GetProperties", "params":{"playerid":0,"properties":"playlistid",["position"]},"id":1}'
I'm am embarressed to say it, but still the same:
Code: 14:41:58.588 T:3020 DEBUG: CPythonInvoker(37, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): start processing
14:41:58.606 T:3020 DEBUG: -->Python Interpreter Initialized<--
14:41:58.606 T:3020 DEBUG: CPythonInvoker(37, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): the source file to load is "C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py"
14:41:58.607 T:3020 DEBUG: CPythonInvoker(37, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): setting the Python path to C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2;C:\Program Files (x86)\Kodi17\system\python\DLLs;C:\Program Files (x86)\Kodi17\system\python\Lib;C:\Program Files (x86)\Kodi17\python27.zip;C:\Program Files (x86)\Kodi17\system\python\lib\plat-win;C:\Program Files (x86)\Kodi17\system\python\lib\lib-tk;C:\Program Files (x86)\Kodi17;C:\Program Files (x86)\Kodi17\system\python;C:\Program Files (x86)\Kodi17\system\python\lib\site-packages
14:41:58.607 T:3020 DEBUG: CPythonInvoker(37, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): entering source directory C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2
14:41:58.607 T:3020 DEBUG: CPythonInvoker(37, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): instantiating addon using automatically obtained id of "script.exp.title2" dependent on version 2.14.0 of the xbmc.python api
14:41:58.612 T:3020 ERROR: JSONRPC: Failed to parse '{"jsonrpc":"2.0", "method":"Player.GetProperties", "params":{"playerid":0,"properties":"playlistid",["position"]},"id":1}'
14:41:58.612 T:3020 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.KeyError'>
Error Contents: ('result',)
Traceback (most recent call last):
File "C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py", line 8, in <module>
position = playerProperties['result']['position']
KeyError: ('result',)
-->End of Python script error report<--
14:41:58.613 T:3020 INFO: Python script stopped
14:41:58.613 T:3020 DEBUG: Thread LanguageInvoker 3020 terminating
RE: Experimental Google Music Addon - foreverguest - 2017-01-24
My bad again, I didn't try the code.
Bracket in right place:
Code: jsonGetPlaylistPos = '{"jsonrpc":"2.0", "method":"Player.GetProperties", "params":{"playerid":0,"properties":["playlistid","position"]},"id":1}'
RE: Experimental Google Music Addon - Shogun - 2017-01-24
Still no dice, i am puzzeled:
Code: 18:40:35.112 T:4152 DEBUG: CPythonInvoker(39, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): start processing
18:40:35.134 T:4152 DEBUG: -->Python Interpreter Initialized<--
18:40:35.134 T:4152 DEBUG: CPythonInvoker(39, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): the source file to load is "C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py"
18:40:35.134 T:4152 DEBUG: CPythonInvoker(39, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): setting the Python path to C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2;C:\Program Files (x86)\Kodi17\system\python\DLLs;C:\Program Files (x86)\Kodi17\system\python\Lib;C:\Program Files (x86)\Kodi17\python27.zip;C:\Program Files (x86)\Kodi17\system\python\lib\plat-win;C:\Program Files (x86)\Kodi17\system\python\lib\lib-tk;C:\Program Files (x86)\Kodi17;C:\Program Files (x86)\Kodi17\system\python;C:\Program Files (x86)\Kodi17\system\python\lib\site-packages
18:40:35.134 T:4152 DEBUG: CPythonInvoker(39, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): entering source directory C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2
18:40:35.134 T:4152 DEBUG: CPythonInvoker(39, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): instantiating addon using automatically obtained id of "script.exp.title2" dependent on version 2.14.0 of the xbmc.python api
18:40:35.148 T:4152 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.NameError'>
Error Contents: name 'utils' is not defined
Traceback (most recent call last):
File "C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py", line 12, in <module>
song_id = utils.paramsToDict(playlistItems['result']['items'][position]['file']).get("song_id")
NameError: name 'utils' is not defined
-->End of Python script error report<--
18:40:35.150 T:4152 INFO: Python script stopped
18:40:35.150 T:4152 DEBUG: Thread LanguageInvoker 4152 terminating
If it's working for you, maybe another addon is interfering? Checked all the addon.xmls. Last resort would be a fresh install just with your addon to check if something is wrong...
RE: Experimental Google Music Addon - foreverguest - 2017-01-24
(2017-01-24, 20:05)Shogun Wrote: Still no dice, i am puzzeled:
Code: 18:40:35.112 T:4152 DEBUG: CPythonInvoker(39, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): start processing
18:40:35.134 T:4152 DEBUG: -->Python Interpreter Initialized<--
18:40:35.134 T:4152 DEBUG: CPythonInvoker(39, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): the source file to load is "C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py"
18:40:35.134 T:4152 DEBUG: CPythonInvoker(39, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): setting the Python path to C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2;C:\Program Files (x86)\Kodi17\system\python\DLLs;C:\Program Files (x86)\Kodi17\system\python\Lib;C:\Program Files (x86)\Kodi17\python27.zip;C:\Program Files (x86)\Kodi17\system\python\lib\plat-win;C:\Program Files (x86)\Kodi17\system\python\lib\lib-tk;C:\Program Files (x86)\Kodi17;C:\Program Files (x86)\Kodi17\system\python;C:\Program Files (x86)\Kodi17\system\python\lib\site-packages
18:40:35.134 T:4152 DEBUG: CPythonInvoker(39, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): entering source directory C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2
18:40:35.134 T:4152 DEBUG: CPythonInvoker(39, C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py): instantiating addon using automatically obtained id of "script.exp.title2" dependent on version 2.14.0 of the xbmc.python api
18:40:35.148 T:4152 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.NameError'>
Error Contents: name 'utils' is not defined
Traceback (most recent call last):
File "C:\Users\XXX\AppData\Roaming\Kodi\addons\script.exp.title2\default.py", line 12, in <module>
song_id = utils.paramsToDict(playlistItems['result']['items'][position]['file']).get("song_id")
NameError: name 'utils' is not defined
-->End of Python script error report<--
18:40:35.150 T:4152 INFO: Python script stopped
18:40:35.150 T:4152 DEBUG: Thread LanguageInvoker 4152 terminating
If it's working for you, maybe another addon is interfering? Checked all the addon.xmls. Last resort would be a fresh install just with your addon to check if something is wrong...
In last line I used my addon function utils.paramstodict to read the song_id. You will have to add it to your code too.
RE: Experimental Google Music Addon - Shogun - 2017-01-24
Thanks for your great help.
Try to get it working, else it's time to learn to code properly.
RE: Experimental Google Music Addon - Abbaskip - 2017-01-26
Hey mate, my Add-On is suddenly not playing anything. Gives an error when I try to play any song. Log file here
Code: 12:29:16.141 T:11700 NOTICE: [GoogleMusicEXP-1.10.6] ARGV: ['plugin://plugin.audio.googlemusic.exp/', '65', '']
12:29:16.168 T:11700 NOTICE: [GoogleMusicEXP-1.10.6] PATH: root
12:29:16.168 T:11700 NOTICE: [GoogleMusicEXP-1.10.6] Assembling menu for subscriber=True and library=True
12:29:23.553 T:11692 NOTICE: [GoogleMusicEXP-1.10.6] ARGV: ['plugin://plugin.audio.googlemusic.exp/', '66', '?path=search']
12:29:23.581 T:11692 NOTICE: [GoogleMusicEXP-1.10.6] PATH: search
12:29:34.355 T:11692 NOTICE: [GoogleMusicEXP-1.10.6] API getsearch: alanis forgiven
12:29:35.424 T:11692 NOTICE: [GoogleMusicEXP-1.10.6] Loading auth from cache
12:29:36.733 T:11692 NOTICE: [GoogleMusicEXP-1.10.6] Loaded 8 tracks (1 art miss)
12:29:36.733 T:11692 NOTICE: [GoogleMusicEXP-1.10.6] Loaded 1 albums (0 art miss)
12:29:36.733 T:11692 NOTICE: [GoogleMusicEXP-1.10.6] API search results: tracks 8 albums 1 artists 1 stations 6 videos 17
12:29:46.652 T:2728 NOTICE: [GoogleMusicEXP-1.10.6] ARGV: ['plugin://plugin.audio.googlemusic.exp/', '67', '?action=play_song&song_id=Tvoi7qsztpi3qkzxodtf6usn3da&title=Forgiven (Acoustic Album Version)&artist=Alanis Morissette&albumart=http://lh3.googleusercontent.com/Z0pwmk-l2L8NEsDaqs0eq2Hj2Jlq1yJOCknZpIUUmg3XkR0o6oEuH8YGt4qgYlOVrIfkKH29KGQ&tracknumber=6&album=Jagged Little Pill (Acoustic)&year=2005&rating=0&artistart=http://lh3.googleusercontent.com/525JoNFjPL0-i-BCVPgb0Tk-VB4f4E0CV0OgLJG1Nel-jTECOMw3JAczBoSWzpRB1RGZhY4i']
12:29:46.889 T:2728 NOTICE: [GoogleMusicEXP-1.10.6] Loading auth from cache
12:29:46.889 T:2728 NOTICE: [GoogleMusicEXP-1.10.6] getStreamUrl songid: Tvoi7qsztpi3qkzxodtf6usn3da device: quality: hi
12:29:47.401 T:2728 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'gmusicapi.exceptions.CallFailure'>
Error Contents: GetStreamUrl: 403 Client Error: Forbidden for url: https://mclients.googleapis.com/music/mplay?opt=hi&dv=0&hl=en_US&mjck=Tvoi7qsztpi3qkzxodtf6usn3da&sig=RpVAtwwgb2IOPn2fmvnhPvYx3fo&pt=a&audio_formats=mp3&slt=1485394186912&net=mob&tier=fr
(requests kwargs: {'url': 'https://mclients.googleapis.com/music/mplay', 'headers': {'X-Device-ID': '', 'Authorization': '<omitted>'}, 'allow_redirects': False, 'params': {'opt': 'hi', 'dv': 0, 'hl': 'en_US', 'mjck': 'Tvoi7qsztpi3qkzxodtf6usn3da', 'sig': 'RpVAtwwgb2IOPn2fmvnhPvYx3fo', 'pt': 'a', 'audio_formats': 'mp3', 'slt': '1485394186912', 'net': 'mob', 'tier': 'fr'}, 'method': 'GET'})
(response was: u'<HTML>\n<HEAD>\n<TITLE>Forbidden</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Forbidden</H1>\n<H2>Error 403</H2>\n</BODY>\n</HTML>\n')
Traceback (most recent call last):
File "C:\Users\Abba\AppData\Roaming\Kodi\addons\plugin.audio.googlemusic.exp\default.py", line 13, in <module>
GoogleMusicPlaySong.GoogleMusicPlaySong().play(params)
File "C:\Users\Abba\AppData\Roaming\Kodi\addons\plugin.audio.googlemusic.exp\GoogleMusicPlaySong.py", line 13, in play
params = self.__getSongStreamUrl(song_id, params)
File "C:\Users\Abba\AppData\Roaming\Kodi\addons\plugin.audio.googlemusic.exp\GoogleMusicPlaySong.py", line 65, in __getSongStreamUrl
params['url'] = self.api.getSongStreamUrl(song_id, session_token=params.pop('sessiontoken',None), wentry_id=params.pop('wentryid',None))
File "C:\Users\Abba\AppData\Roaming\Kodi\addons\plugin.audio.googlemusic.exp\GoogleMusicApi.py", line 85, in getSongStreamUrl
stream_url = self.getLogin().getStreamUrl(song_id, session_token=session_token, wentry_id=wentry_id)
File "C:\Users\Abba\AppData\Roaming\Kodi\addons\plugin.audio.googlemusic.exp\GoogleMusicLogin.py", line 43, in getStreamUrl
return self.gmusicapi.get_stream_url(song_id, device_id, quality, session_token, wentry_id)
File "C:\Users\Abba\AppData\Roaming\Kodi\addons\plugin.audio.googlemusic.exp\gmusicapi\clients\mobileclient.py", line 361, in get_stream_url
return self._make_call(mobileclient.GetStreamUrl, song_id, device_id, quality, session_token, wentry_id)
File "C:\Users\Abba\AppData\Roaming\Kodi\addons\plugin.audio.googlemusic.exp\gmusicapi\clients\shared.py", line 81, in _make_call
return protocol.perform(self.session, self.validate, *args, **kwargs)
File "C:\Users\Abba\AppData\Roaming\Kodi\addons\plugin.audio.googlemusic.exp\gmusicapi\protocol\shared.py", line 225, in perform
raise CallFailure(err_msg, call_name)
CallFailure: GetStreamUrl: 403 Client Error: Forbidden for url: https://mclients.googleapis.com/music/mplay?opt=hi&dv=0&hl=en_US&mjck=Tvoi7qsztpi3qkzxodtf6usn3da&sig=RpVAtwwgb2IOPn2fmvnhPvYx3fo&pt=a&audio_formats=mp3&slt=1485394186912&net=mob&tier=fr
(requests kwargs: {'url': 'https://mclients.googleapis.com/music/mplay', 'headers': {'X-Device-ID': '', 'Authorization': '<omitted>'}, 'allow_redirects': False, 'params': {'opt': 'hi', 'dv': 0, 'hl': 'en_US', 'mjck': 'Tvoi7qsztpi3qkzxodtf6usn3da', 'sig': 'RpVAtwwgb2IOPn2fmvnhPvYx3fo', 'pt': 'a', 'audio_formats': 'mp3', 'slt': '1485394186912', 'net': 'mob', 'tier': 'fr'}, 'method': 'GET'})
(response was: u'<HTML>\n<HEAD>\n<TITLE>Forbidden</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Forbidden</H1>\n<H2>Error 403</H2>\n</BODY>\n</HTML>\n')
-->End of Python script error report<--
RE: Experimental Google Music Addon - foreverguest - 2017-01-26
Your device id is missing too:
Code: 12:29:46.889 T:2728 NOTICE: [GoogleMusicEXP-1.10.6] getStreamUrl songid: Tvoi7qsztpi3qkzxodtf6usn3da device: quality: hi
If you didn't remove your Android device from your account, try using what user procmon in post #930 did: uninstalling the add-on, deleting the settings.xml, rebooting device and installing again.
RE: Experimental Google Music Addon - AshG - 2017-01-30
hi foreverguest,
This is a great addon, works flawlessly, I'm using it on the latest Beta Libreelec build... every now and again it's asking me for my credentials? once logged back in it works ok... is there anything I can do to stop this?
I have a single account (e.g. not a family account) however I am using Google music on several other devices including another RPI, it would have anything to do with this would it?
RE: Experimental Google Music Addon - foreverguest - 2017-01-30
Hi AshG, something is deleting or corrupting the settings.xml where credentials are stored.
You can't stream simultaneously from more than one device with the same user, but it should show an error '403 forbidden' when this happen.
|