Update gmusicapi and changes webclient with mobileclient#13
Update gmusicapi and changes webclient with mobileclient#13pablorusso wants to merge 2 commits intojwdempsey:masterfrom
Conversation
|
This is fantastic! I'll give this a try locally and make sure it works in OSX as well. |
|
It works nice. Thank you :) |
|
I'm getting this error on PMS v0.9.12.11 and Ubuntu Server 15.04. |
|
The fix includes the binaries only for windows. For all on Linux: You have to download Crypto from https://pypi.python.org/pypi/pycrypto, and then build it: python setup.py build. Then copy the Crypto from the "build" directory to replace the Crypto directory. The entire path to the folder you need to copy is 'build/lib.linux-x86_64-2.7/Crypto'. It needs to go into '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/GoogleMusic.bundle/Contents/Libraries/Shared'. Make sure you copy the 'Crypto' folder and not just the contents of it. Also make sure plex has proper access to it by doing 'sudo chown -R plex:plex Crypto' (or whatever user runs your Plex server). Would be nice if someone on linux send a PR with this binaries to help others in linux. |
|
Exact steps on Ubuntu
After doing this I can get the plugin to load when I don't have a username/password set. I get into it and I get a refresh Library button. After I set login credentials. (I use an a google App password since I have two-factor authentication enabled.) I get the same "This channel is not responding" error. Log with no credentials set: 2015-09-16 12:33:10,203 (7fec53bde700) : DEBUG (runtime:717) - Handling request GET /music/googlemusic Setting credentials and trying to open plugin 2015-09-16 12:34:31,135 (7fec53bde700) : DEBUG (runtime:717) - Handling request GET /music/googlemusic/:/prefs 2015-09-16 12:34:48,636 (7fec53bde700) : DEBUG (runtime:106) - Sending packed state data (112 bytes) |
|
@r0n0c Were you able to get it to work with those steps? |
|
@imthenachoman nope. Kept getting errors. Then I realized everything I play plex on is either a nexus player or chromecast enabled so I don't need it. And once All Access Family plan is up and running girlfriend won't need it either. |
|
@r0n0c Oh. Thanks! |
|
This fix works nicely! Now I'm just having an issue on my Roku 3. Any chance we could get this fix merged into master? |
|
Hi all! Thanks Pablo for your efforts! I really appreciate it! |
|
I can confirm, it does not work on OSX with Crypto installed: Update: it works when pycrypto compiled for the py-27 |
|
For some reasons I started getting the error I mentioned above - #13 (comment) |
|
I finally been able to get it running, thank you! When testing i found one very easy to fix error - for the artists in non-ASCII it wont work correctly. I patches this issue and now it works fine. Patch provided below: diff --git a/Contents/Libraries/Shared/gmusic.py b/Contents/Libraries/Shared/gmusic.py
index 94417ad..7aa3b5a 100644
--- a/Contents/Libraries/Shared/gmusic.py
+++ b/Contents/Libraries/Shared/gmusic.py
@@ -133,13 +133,13 @@ class GMusic(object):
def get_tracks_for_type(self, type, name):
type = type.lower()
if type == 'artists':
- return self.tracks_by_artist[name]
+ return self.tracks_by_artist[name.decode('utf_8')]
elif type == 'albums':
- return self.tracks_by_album[name]
+ return self.tracks_by_album[name.decode('utf_8')]
elif type == 'genres':
- return self.tracks_by_genre[name]
+ return self.tracks_by_genre[name.decode('utf_8')]
elif type == 'songs by letter':
- return self.tracks_by_letter[name]
+ return self.tracks_by_letter[name.decode('utf_8')]
else:
return {} |
|
And one more unicode related fix: display title2 for non-ASCII songs/artists: diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py
index 1a9b51b..a4f2998 100644
--- a/Contents/Code/__init__.py
+++ b/Contents/Code/__init__.py
@@ -288,7 +288,7 @@ def ShowSongs(title, shuffle=False, page=1):
################################################################################
@route(PREFIX + '/getalbumsinlibrary')
def GetAlbumsInLibrary(name):
- oc = ObjectContainer(title2=name)
+ oc = ObjectContainer(title2=unicode(name))
albums = API.get_albums_in_library(name)
for album in sorted(albums['albums'], key = lambda x: x.get('year')):
@@ -307,7 +307,7 @@ def GetAlbumsInLibrary(name):
################################################################################
@route(PREFIX + '/gettracklist')
def GetTrackList(name, type):
- oc = ObjectContainer(title2=name)
+ oc = ObjectContainer(title2=unicode(name))
tracks = API.get_tracks_for_type(type, name)
sort = 'title' if type == 'Songs By Letter' else 'trackType'
for track in sorted(tracks, key = lambda x: x['track'].get(sort)):
@@ -318,7 +318,7 @@ def GetTrackList(name, type):
################################################################################
@route(PREFIX + '/getplaylistcontents')
def GetPlaylistContents(name, id):
- oc = ObjectContainer(title2=name)
+ oc = ObjectContainer(title2=unicode(name))
tracks = API.get_all_user_playlist_contents(id)
for track in tracks:
@@ -334,7 +334,7 @@ def GetPlaylistContents(name, id):
################################################################################
@route(PREFIX + '/getsharedplaylist')
def GetSharedPlaylist(name, token):
- oc = ObjectContainer(title2=name)
+ oc = ObjectContainer(title2=unicode(name))
tracks = API.get_shared_playlist_contents(token)
for track in tracks:
@@ -345,7 +345,7 @@ def GetSharedPlaylist(name, token):
################################################################################
@route(PREFIX + '/getstationtracks')
def GetStationTracks(name, id):
- oc = ObjectContainer(title2=name)
+ oc = ObjectContainer(title2=unicode(name))
tracks = API.get_station_tracks(id)
for track in tracks:
@@ -363,7 +363,7 @@ def GetStationTracks(name, id):
################################################################################
@route(PREFIX + '/genressubmenu', children=list)
def GenresSubMenu(name, id, children=None):
- oc = ObjectContainer(title2=name)
+ oc = ObjectContainer(title2=unicode(name))
oc.add(DirectoryObject(key=Callback(CreateStation, id=id), title='Play ' + name))
if children != None:
@@ -381,7 +381,7 @@ def CreateStation(id):
################################################################################
@route(PREFIX + '/getartistinfo')
def GetArtistInfo(name, id, inLibrary=False):
- oc = ObjectContainer(title2=name)
+ oc = ObjectContainer(title2=unicode(name))
artist = API.get_artist_info(id)
for album in sorted(artist['albums'], key = lambda x: x.get('year')):
@@ -400,7 +400,7 @@ def GetArtistInfo(name, id, inLibrary=False):
################################################################################
@route(PREFIX + '/getalbuminfo')
def GetAlbumInfo(name, id):
- oc = ObjectContainer(title2=name)
+ oc = ObjectContainer(title2=unicode(name))
album = API.get_album_info(id)
for track in album['tracks']: |
|
new version here => #20 |
Web protocol was deprecated by google, so I have updated the gmusicapi and changes gmusic to use only mobileclient.
The new gmusicapi depends on pycrypto which was a PITA to build and use inside a windows plex, but its is working. I had tested it only in a windows server.
The trick is to compile it with plex python and vs2013 as plex uses a custom python 2.7 build (plexsripthost) that depednds on msvcrt120 instead of msvcrt90 (like regular python 2.7 does)