Saturday, October 15, 2016

Google Music Plex Plugin on Linux

The wife and I use our Rokus for media consumption on the TVs in our house, and as cord cutters we wanted to be able to access South Park episodes and Google Music recently through the Roku. The way to do that is with plug-ins on your plex server streaming to your Roku. You can get the South Park plugin easily through the Plex channel area. The Google Music plug in is a community deal with multiple versions floating around out there. I tried both, and neither worked for me out of the box as of October 14, 2016 on Linux Mint 17 (analogous to Ubuntu 14.04  Trusty Tahr)

The two variations of this plugin are by jwdempsey (last commit 9bea5fb Apr 1, 2015)and pablorusso (last commit d8145ee Sep 13, 2016).

The jwdempsey version doesn't currently work with google play music because of some auth changes I believe, so in the web interface to plex it will show you messages such as "This Channel is Not Responding" and have a message in the plugin log saying "raise NotLoggedIn" even if you put in the right credentials.

The pablorusso version has enhancements to handle this, but at the time of this writing his version only worked for Windows because Pablo stated that there wasn't an updated version of pycryptodomex binaries for Linux or MacOS [source].

Luckily, using the pablorusso plugin version and by compiling pycryptodomex to get the required shared object library files using instructions found here, I was able to get everything working.

Solution (Linux):
  1. Go to your plugin directory
    1. cd /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/
  2. Pull down (clone) a copy of pablorusso's plex plugin using git which you will have to have installed on your system
    1. git clone
  3. Go to a different directory like your home directory and create a new subdirectory there to download and compile the python Cryptodomex package
    1. cd ~
    2. mkdir pycryptodomex
    3. cd pycryptodomex
    4. wget
      1. this is just the URL from the latest verison of pycryptodomex on pypi 
    5. tar xzvf pycryptodomex*.tar.gz #decompress it
    6. cd pycryptodomex-*/
    7. python build            # compile it
    8. cd build/lib.linux-x86_64-2.7/Cryptodome/Cipher   
    9. cp *.so /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/GoogleMusic.bundle/Contents/Libraries/Shared/Cryptodome/Cipher/
    10. cd ../Util/
    11. cp *.so /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/GoogleMusic.bundle/Contents/Libraries/Shared/Cryptodome/Util/
    12. cd ../Hash/
    13. cp *.so /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/GoogleMusic.bundle/Contents/Libraries/Shared/Cryptodome/Hash/
  4. Lastly we'll need to adjust the ownership of the files so that Plex can use the plugin
    1. cd /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/
    2. chown -R plex:plex GoogleMusic.bundle
Now you should have the plugin working in Plex. Enjoy.