Kodi Community Forum

Full Version: Experimental Google Music Addon
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

when trying to update library (initial import, wiped everything before installing alpha3 to get a clean testing environment):

Code:
19:39:45 T:140393505036032  NOTICE: Thread LanguageInvoker start, auto delete: false
19:39:45 T:140393505036032  NOTICE: -->Python Interpreter Initialized<--
19:39:45 T:140393505036032  NOTICE: GoogleMusicEXP-1.3alpha3 ARGV: ['plugin://plugin.audio.googlemusic.exp/', '-1', '']
19:39:45 T:140393505036032  NOTICE: [GoogleMusicEXP-1.3alpha3] Trying to fetch the device_id
19:39:45 T:140393505036032  NOTICE: [GoogleMusicEXP-1.3alpha3] Logging in
19:39:45 T:140393505036032  NOTICE: [GoogleMusicEXP-1.3alpha3] Login succeeded
19:39:45 T:140393505036032   ERROR: /home/kodi/.kodi/addons/script.module.requests/lib/requests/packages/urllib3/connectionpool.py:730: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html (This warning will only appear once by default.)
                                              InsecureRequestWarning)
19:39:46 T:140393505036032  NOTICE: [GoogleMusicEXP-1.3alpha3] [{u'date': 1391727954571, u'lastUsedMs': 1391727954571, u'type': u'DESKTOP_APP', u'id': u'00:01:2E:2B:2A:D8', u'name': u'riva'}, {u'name': u'Nexus 5', u'lastUsedMs': 1420654064825, u'carrier': u'Google', u'date': 1413625427603, u'model': u'Nexus 5', u'type': u'PHONE', u'id': u'0x308d4f2f4469e273', u'manufacturer': u'LGE'}, {u'name': u'', u'lastUsedMs': 1413881723737, u'carrier': u'Google', u'date': 1410823110127, u'model': u'Nexus 4', u'type': u'PHONE', u'id': u'0x3bb77a283ad6470f', u'manufacturer': u'LGE'}, {u'name': u'Transformer Prime (alt 2)', u'lastUsedMs': 1414381572907, u'carrier': u'Asus', u'date': 1409877774277, u'model': u'Tf300t', u'type': u'PHONE', u'id': u'0x3c362343a8eceb88', u'manufacturer': u'ASUS'}, {u'date': 1390246138983, u'lastUsedMs': 1390246138983, u'type': u'DESKTOP_APP', u'id': u'2C:D0:5A:B8:27:D0', u'name': u''}]
19:39:46 T:140393505036032  NOTICE: [GoogleMusicEXP-1.3alpha3] Found device_id: 308d4f2f4469e273
19:39:46 T:140393505036032  NOTICE: [GoogleMusicEXP-1.3alpha3] Loading library
19:39:46 T:140393505036032  NOTICE: [GoogleMusicEXP-1.3alpha3] Loading auth from cache
19:39:47 T:140393505036032  NOTICE: [GoogleMusicEXP-1.3alpha3] Library Size: 2694
19:39:48 T:140393505036032 WARNING: Attempt to use invalid handle -1
19:39:48 T:140393505036032   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.TypeError'>
                                            Error Contents: an integer is required
                                            Traceback (most recent call last):
                                              File "/home/kodi/.kodi/addons/plugin.audio.googlemusic.exp/default.py", line 75, in <module>
                                                navigation.listMenu()
                                              File "/home/kodi/.kodi/addons/plugin.audio.googlemusic.exp/GoogleMusicNavigation.py", line 92, in listMenu
                                                self.xbmcplugin.addSortMethod(handle1, self.xbmcplugin.SORT_METHOD_UNSORTED)
                                            TypeError: an integer is required
                                            -->End of Python script error report<--

It seems the library is updated anyway though, I can browse songs, artists, albums and genres just fine and open the streams. When trying to browse a composer, I run into the following error though:

Code:
19:57:04 T:140393513428736  NOTICE: Thread LanguageInvoker start, auto delete: false
19:57:04 T:140393513428736  NOTICE: -->Python Interpreter Initialized<--
19:57:04 T:140393513428736  NOTICE: GoogleMusicEXP-1.3alpha3 ARGV: ['plugin://plugin.audio.googlemusic.exp/', '247', '?albums=Alice%20Cooper&path=composer']
19:57:04 T:140393513428736   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.AttributeError'>
                                            Error Contents: 'NoneType' object has no attribute 'replace'
                                            Traceback (most recent call last):
                                              File "/home/kodi/.kodi/addons/plugin.audio.googlemusic.exp/default.py", line 80, in <module>
                                                navigation.listMenu(params)
                                              File "/home/kodi/.kodi/addons/plugin.audio.googlemusic.exp/GoogleMusicNavigation.py", line 71, in listMenu
                                                listItems = self.listFilterSongs(self.path, get('album'), get('artist'))
                                              File "/home/kodi/.kodi/addons/plugin.audio.googlemusic.exp/GoogleMusicNavigation.py", line 193, in listFilterSongs
                                                songs = self.api.getFilterSongs(filter_type, urllib.unquote_plus(filter_criteria), albums )
                                              File "/usr/lib/python2.7/urllib.py", line 1240, in unquote_plus
                                                s = s.replace('+', ' ')
                                            AttributeError: 'NoneType' object has no attribute 'replace'
                                            -->End of Python script error report<--
19:57:04 T:140396853020608   ERROR: GetDirectory - Error getting plugin://plugin.audio.googlemusic.exp/?albums=Alice%20Cooper&path=composer
19:57:04 T:140396853020608   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.audio.googlemusic.exp/?albums=Alice%20Cooper&path=composer) failed
19:57:04 T:140393513428736  NOTICE: Thread LanguageInvoker start, auto delete: false
19:57:04 T:140393513428736  NOTICE: -->Python Interpreter Initialized<--
19:57:04 T:140393513428736  NOTICE: GoogleMusicEXP-1.3alpha3 ARGV: ['plugin://plugin.audio.googlemusic.exp/', '248', '?criteria=composer&path=filter']
19:57:04 T:140393513428736  NOTICE: [GoogleMusicEXP-1.3alpha3] CRITERIA: 'composer' ''
19:57:04 T:140393454679808  NOTICE: Thread BackgroundLoader start, auto delete: false

Also, there is a unicode problem in search again (search string was "toto"):

Code:
19:58:37 T:140393270204160  NOTICE: [GoogleMusicEXP-1.3alpha3] RESULT ALBUMS: u'El Asunto (Track by Track Commentary)' - u'Tot\xf3 la Momposina' B556lerfr2cooqps6sxsudje6ei
19:58:37 T:140393270204160   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.UnicodeDecodeError'>
                                            Error Contents: 'ascii' codec can't decode byte 0xc3 in position 16: ordinal not in range(128)
                                            Traceback (most recent call last):
                                              File "/home/kodi/.kodi/addons/plugin.audio.googlemusic.exp/default.py", line 80, in <module>
                                                navigation.listMenu(params)
                                              File "/home/kodi/.kodi/addons/plugin.audio.googlemusic.exp/GoogleMusicNavigation.py", line 77, in listMenu
                                                listItems = self.getSearch(query)
                                              File "/home/kodi/.kodi/addons/plugin.audio.googlemusic.exp/GoogleMusicNavigation.py", line 319, in getSearch
                                                listItems.append(self.addFolderListItem("["+album[1]+"] "+album[0],{'path':"search_result",'query':album[0].encode('utf8')},cm,album_art_url=album[2]))
                                            UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 16: ordinal not in range(128)
                                            -->End of Python script error report<--
19:58:37 T:140396853020608   ERROR: GetDirectory - Error getting plugin://plugin.audio.googlemusic.exp/?path=search
19:58:37 T:140396853020608   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.audio.googlemusic.exp/?path=search) failed
19:58:37 T:140393270204160  NOTICE: Thread BackgroundLoader start, auto delete: false

I also played around with different views a bit. It kinda works, meaning kodi remembers the view I used last time for a specific folder. However, unfortunately I have to change the view for every single folder, it's not like I change it to a specific view mode for album list of one artist and it's remembered for all other artists album lists, too. No idea if that's even possible here or what exactly would be required to make it behave that way but at least that's how it works in tv shows for example.

-- wrayan
Hi all.

First I want to thank you for this app. But I have a problem by opening a new stream. 5 sec before the actual song ends the app opens the new stream and I get lags in these 5 sec of the song. The visualization has lags as well. I think it would be usefull if the user can choose when the app starts to open the new stream. Because a lag is even worse for me as a bigger gap between songs. Is this problem known or do I have it exclusively?

Some more information:
Raspberry Pi B+ (900MHz)
OS: 13.2
App: 1.2



Regards
deckard
@foreverguest album_id works ok.

for play_songs seems there's no metadata set in the player and only a videoplayback title Sad

I did not find how to use the play_all for playlists (AMxxxxx) and maybe if possible add support for artists Axxxxxxxxx.

This would make the API complete.

Thanks.
SWEET!!!! I am so glad I kept going back and forth to get this to work with the Yatse remote. It is the hands down best remote. Torliq I also myself just noticed the t and b difference myself. I was about to post in the thread I had on your site. Just happened to look here first.
@deckard1984, actually it is XBMC who opens the stream, the addon just provide the url. Check if you have crossfade enabled in XBMC settings and try disabling it.

@wrayan, thanks for testing I'll look into these errors. About view modes, yes you have to select the view mode for each and all folders, AFAIK the default view mode is defined by the skin and the user can't do nothing about it, the addon can override the default view mode for the artists and albums listing if you don't disable the option in settings.

@Tolriq, not sure if it is possible for Yatse to pass metadata in the addon call with parameters title, artist and albumart(url), the addon will use these if found. I will work in the playlist and artist call, thanks for your support.
I do not have the meta data so can't send it to you.

Sounds more like a change to make on plugin side when starting the player for songs.

For albums all metadata are correctly filled.
Great add-on. Definitely makes Kodi a more complete solution for me, thanks for the hard work.

I still don't want to accept that we can't add albums from Google Music's library to Kodi's library. I read in past posts that this isn't possible because the song link only lasts one minute. On Google Music on the browser there is an option to share a song/album/artist. It gives a URL link that seems to be persistent. So I created a strm file (Artist/Album/## - Track.strm) that contains the following:
Code:
plugin://plugin.audio.googlemusic.exp/?action=play_song&song_id=XXXXXXXXXX
where XXXXXXXXXX is the song url from the browser.
This works if I go through Music -> Files and browse to where the strm files are. The stream plays but there is no metadata (title, artist, artwork) shown while it plays. They don't scan into the library and I tried creating an NFO file but it didn't work so I think I've gone as far as a can with this.

Are the links obtained by this addon through the API different than the links given on the browser?
hmm, I thought XBMC only accepted stream urls inside strm files. If it accepts plugin urls then library integration is possible.

Try using this for metadata:
Code:
plugin://plugin.audio.googlemusic.exp/?action=play_song&song_id=XXXXXXXXXX&title=XXXXX&artist=XXXXXXXX&albumart=http://XXXXXX
(2015-01-20, 17:39)foreverguest Wrote: [ -> ]hmm, I thought XBMC only accepted stream urls inside strm files. If it accepts plugin urls then library integration is possible.

Try using this for metadata:
Code:
plugin://plugin.audio.googlemusic.exp/?action=play_song&song_id=XXXXXXXXXX&title=XXXXX&artist=XXXXXXXX&albumart=http://XXXXXX

I got the idea from the NetfliXBMC addon. Any movie or TV show can be added to the library from the context menu. Movie strm files, for example, go to ~/.kodi/userdata/addon_data/plugin.video.netflixbmc/library/Movies and that directory has to be added as a source. When I looked at the netflixbmc strm files I realized that they were plugin urls just like the url you gave for yatse.

So is this something that can be implemented in the future?
I think so, after we finish 1.3 version I'll look into it.
@Tolriq, version bellow accept commands with params:
- action=play_all & artist_id=Axxxxx
- action=play_all & share_token=AMxxxxx

plugin.audio.googlemusic.exp-1.3alpha4
Also:
- fetch metadata for tracks when not received
- fixes for errors reported
I haven't checked in lately, but you've definitely made great progress. I can actually search all-access now! Getting lots of errors, though, which lead to a lot of blank albums after searching for one:

22:45:31 T:3640 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.ImportError'>
Error Contents: Failed to import _strptime because the import lockis held by another thread.
Traceback (most recent call last):
File "C:\Users\XBMC\AppData\Roaming\Kodi\addons\plugin.audio.googlemusic.exp\default.py", line 65, in <module>
login.checkCookie()
File "C:\Users\XBMC\AppData\Roaming\Kodi\addons\plugin.audio.googlemusic.exp\GoogleMusicLogin.py", line 19, in checkCookie
if (datetime.now() - datetime(*time.strptime(self.settings.getSetting('cookie-date'), '%Y-%m-%d %H:%M:%S.%f')[0:6])).days >= 7:
ImportError: Failed to import _strptime because the import lockis held by another thread.
-->End of Python script error report<--
corpgator, could you upload your full log to pastebin, this error doesn't seem to be related to search.
@foreverguest : All works in a4, thanks.
Great work man! The main problem with this plugin is something that I'm sure you have no control over, which is the idiotic structure which Google has with the music library. Rather than browsing Genre/Artist/Album/Song like most other services, they insist on Genre/All Artists and Albums/Songs.

Drives me nuts and makes it a nightmare to browse on my many android devices.

Anyway, keep up the excellent work.