Kodi Community Forum
[OBSOLETE] Pandora Radio (Script) Music Addon - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Music Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=148)
+---- Thread: [OBSOLETE] Pandora Radio (Script) Music Addon (/showthread.php?tid=70471)



RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - jcooper138 - 2012-05-27

My steps to get a working pandora:

1. Clone rivy's git: https://gitorious.org/~rivy/xbmc-pandora/rivy-xbmc-pandora
Code:
git clone git://gitorious.org/~rivy/xbmc-pandora/rivy-xbmc-pandora.git

2. Change BASE_URL_KEY in keys.py to:
Code:
BASE_KEY_URL = "https://raw.github.com/PromyLOPh/pianobar/94c1eec169db66bb4ad9d633342aead3b0f35b9f/src/libpiano/"

ETA replace the Commit bit as in post 1299. Don't go to this URL in a browser as it will show you a 404. What's important is that the script can pickup crypt_key_input.h and crypt_key_output.h from that location.

3. Create a zip of the directory and put it in .xbmc/addons/packages
Code:
zip -r rivy.xbmc.pandora.zip rivy-xbmc-pandora/
cp rivy.xbmc.pandora.zip ~/.xbmc/addons/packages

4. Install addon from zip file in XBMC interface.

5. Add username/password and force a key fetch.

Hope this helps someone.


RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - jawilljr - 2012-05-27

(2012-05-27, 01:31)jcooper138 Wrote: My steps to get a working pandora:

1. Clone rivy's git: https://gitorious.org/~rivy/xbmc-pandora/rivy-xbmc-pandora
Code:
git clone git://gitorious.org/~rivy/xbmc-pandora/rivy-xbmc-pandora.git

2. Change BASE_URL_KEY in keys.py to:
Code:
BASE_KEY_URL = "https://raw.github.com/PromyLOPh/pianobar/94c1eec169db66bb4ad9d633342aead3b0f35b9f/src/libpiano/"

ETA replace the Commit bit as in post 1299. Don't go to this URL in a browser as it will show you a 404. What's important is that the script can pickup crypt_key_input.h and crypt_key_output.h from that location.

3. Create a zip of the directory and put it in .xbmc/addons/packages
Code:
zip -r rivy.xbmc.pandora.zip rivy-xbmc-pandora/
cp rivy.xbmc.pandora.zip ~/.xbmc/addons/packages

4. Install addon from zip file in XBMC interface.

5. Add username/password and force a key fetch.

Hope this helps someone.

Doesn't work.

Jerry


RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - SumOne - 2012-05-28

Make sure your paying heed to Legoguys earlier post, in particular

Quote:[edit] looks like vBulletin has some code enabled to auto link git commit links. So where it says "Commit:xxxxxxx" above, it should actually be 94c1eec169db66bb4ad9d6 33342aead3b0f35b9f without the space.



RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - tknorris - 2012-05-28

(2012-05-27, 01:31)jcooper138 Wrote: My steps to get a working pandora:

1. Clone rivy's git: https://gitorious.org/~rivy/xbmc-pandora/rivy-xbmc-pandora
Code:
git clone git://gitorious.org/~rivy/xbmc-pandora/rivy-xbmc-pandora.git

2. Change BASE_URL_KEY in keys.py to:
Code:
BASE_KEY_URL = "https://raw.github.com/PromyLOPh/pianobar/94c1eec169db66bb4ad9d633342aead3b0f35b9f/src/libpiano/"

ETA replace the Commit bit as in post 1299. Don't go to this URL in a browser as it will show you a 404. What's important is that the script can pickup crypt_key_input.h and crypt_key_output.h from that location.

3. Create a zip of the directory and put it in .xbmc/addons/packages
Code:
zip -r rivy.xbmc.pandora.zip rivy-xbmc-pandora/
cp rivy.xbmc.pandora.zip ~/.xbmc/addons/packages

4. Install addon from zip file in XBMC interface.

5. Add username/password and force a key fetch.

Hope this helps someone.

These steps worked for me also. Installing from the xbmc-pandora repository on the other hand did not. I kept getting error:
Code:
23:56:20 T:140329567799040  NOTICE: Error:
23:56:20 T:140329567799040  NOTICE: com.savagebeast.radio.api.protocol.xmlrpc.RadioXmlRpcException: unrecognized clientKey 00000000000000000000000000000000
23:56:20 T:140329567799040  NOTICE: Code:
23:56:20 T:140329567799040  NOTICE: 0



Workaround that works, Thanks - shanemc - 2012-05-28

(2012-05-27, 01:31)jcooper138 Wrote: My steps to get a working pandora:

1. Clone rivy's git: https://gitorious.org/~rivy/xbmc-pandora/rivy-xbmc-pandora
Code:
git clone git://gitorious.org/~rivy/xbmc-pandora/rivy-xbmc-pandora.git

2. Change BASE_URL_KEY in keys.py to:
Code:
BASE_KEY_URL = "https://raw.github.com/PromyLOPh/pianobar/94c1eec169db66bb4ad9d633342aead3b0f35b9f/src/libpiano/"

ETA replace the Commit bit as in post 1299. Don't go to this URL in a browser as it will show you a 404. What's important is that the script can pickup crypt_key_input.h and crypt_key_output.h from that location.

3. Create a zip of the directory and put it in .xbmc/addons/packages
Code:
zip -r rivy.xbmc.pandora.zip rivy-xbmc-pandora/
cp rivy.xbmc.pandora.zip ~/.xbmc/addons/packages

4. Install addon from zip file in XBMC interface.

5. Add username/password and force a key fetch.

Hope this helps someone.

This method worked like a champ for me (of course with the caveat of replacing the "Commit:94c1eec" to "94c1eec169db66bb4a d9d633342aead3b0f35b9f" (sans space) per post 1299 and other commenters.)

Thanks for your assistance.


RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - kobyboy - 2012-05-28

Can you upload a zip with all the fixes.Iam no scripter but this addy is very good Thanks Kobyboy


RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - jawilljr - 2012-05-29

(2012-05-28, 00:06)SumOne Wrote: Make sure your paying heed to Legoguys earlier post, in particular

Quote:[edit] looks like vBulletin has some code enabled to auto link git commit links. So where it says "Commit:xxxxxxx" above, it should actually be 94c1eec169db66bb4ad9d6 33342aead3b0f35b9f without the space.

Below is my keys.py file:

Code:
import urllib2
import pickle
import pianoparser
import os
import sys

BASE_KEY_URL = "https://raw.github.com/PromyLOPh/pianobar/Commit:94c1eec169db66bb4ad9d633342aead3b0f35b9f/src/libpiano/"

class Key:
    def __init__( self, proto, key ):
        self._key = {}
        ( n, p, s ) = key
        self._proto = proto
        self._key["n"] = n
        self._key["p"] = p
        self._key["s"] = s

    def __getitem__( self, key ):
        return self._key[key]

    def _toDict( self ):
        return { 'proto' : self._proto,
                 'key' : (self._key['n'],self._key['p'],self._key['s']) }

class Keys:
    _keys = None

    def __init__( self, dataDir, proto ):
        self._proto = proto
        self._dataDir = dataDir
        self._keys = {}

    def __getitem__( self, key ):
        return self._keys[key]

    def loadKeys( self, save=True ):
        fromFile = 0
        key_in = self._loadKeyFromFile( os.path.join( self._dataDir,\
                                                      "key_in" ) )
        if key_in and key_in._proto == self._proto:
            fromFile += 1
        else:
            key_in = self._loadKeyFromURL( BASE_KEY_URL + \
                                          "crypt_key_input.h" )
            if key_in:
                key_in = Key( self._proto, key_in )
            else:
                print "PANDORA: No valid Input key"
                return False

        key_out = self._loadKeyFromFile( os.path.join( self._dataDir,\
                                                       "key_out" ) )
        if key_out and key_out._proto == self._proto:
            fromFile += 1
        else:
            key_out = self._loadKeyFromURL( BASE_KEY_URL + \
                                          "crypt_key_output.h" )
            if key_out:
                key_out = Key( self._proto, key_out )
            else:
                print "PANDORA: No valid Output key"
                return False

        self._keys['in'] = key_in
        self._keys['out'] = key_out
        if save and fromFile < 2:
            self.saveKeys()
        return True

    def saveKeys( self ):
        print "PANDORA: Saving keys"
        f = None
        print "PANDORA: dataDir = \"%s\"" %self._dataDir
        print "PANDORA: dataDir.isDir? %s" %os.path.isdir( self._dataDir )
        try:
            f = open( os.path.join( self._dataDir, "key_in" ), "wb" )
            pickle.dump( self._keys['in']._toDict(), f, -1 )
        finally:
            if f: f.close()

        try:
            f = open( os.path.join( self._dataDir, "key_out" ), "wb" )
            pickle.dump( self._keys['out']._toDict(), f, -1 )
        finally:
            if f: f.close()

    def forceReFetch( self ):
        print "PANDORA: Forcing key ReDownload"
        if os.path.exists( os.path.join( self._dataDir, "key_in" ) ):
            os.remove( os.path.join( self._dataDir, "key_in" ) )
        if os.path.exists( os.path.join( self._dataDir, "key_out" ) ):
            os.remove( os.path.join( self._dataDir, "key_out" ) )
        return self.loadKeys( True );

    def _loadKeyFromFile( self, keyFile ):
        print "PANDORA: Loading key from file \"%s\"" %keyFile
        if not os.path.isfile( keyFile ):
            return False

        try:
            try:
                f = open( keyFile, "rb" )
                tmp = pickle.load( f )
                key = Key( tmp['proto'], tmp['key'] )
            except IOError, e:
                print "PANDORA: IOError %d:%s" %( e.errno, e.stderror )
                return False
            except pickle.UnpicklingError, e:
                print "PANDORA: UnpicklingError: %s" %e
                return False
            except:
                print "PANDORA: Unexpected error:%s:%s" %sys.exc_info()[0:2]
                raise
        finally:
            f.close()

        return key

    def _loadKeyFromURL( self, keyUrl ):
        print "PANDORA: Downloading key from url \"%s\"" %keyUrl
        try:
            f = urllib2.urlopen( keyUrl )
        except urllib2.URLError, e:
            print "PANDORA: URLError: %s" %e.reason
            return False
        key = pianoparser.parse_file( f )
        f.close()
        return key

Doesn't work... Get script error when "Force Re-Retch Keys"

Yes I copy and pasted the steps above...doesn't work.

Jerry

Edit:
The code tags removed the extra Commit: stuff.

Here is pastebin

And there is no newline after "pianobar" in the file. for some reason pastebin made it 2 lines.




RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - jawilljr - 2012-05-29

Relevant part of debug log:

Code:
17:50:06 T:140459084248832  NOTICE: PANDORA: Initializing v1.2.10-git
17:50:06 T:140459084248832  NOTICE: PANDORA: sys.platform = linux2
17:50:06 T:140459084248832    INFO: Loading skin file: DialogProgress.xml
17:50:06 T:140459084248832   DEBUG: DialogProgress::StartModal called
17:50:06 T:140459084248832   DEBUG: ------ Window Init (DialogProgress.xml) ------
17:50:06 T:140459084248832  NOTICE: PANDORA: Loading key from file "/home/kjawhtpc/.xbmc/userdata/addon_data/script.xbmc.pandora/key_in"
17:50:06 T:140459084248832  NOTICE: PANDORA: Downloading key from url "https://raw.github.com/PromyLOPh/pianobar/Commit:94c1eec169db66bb4ad9d633342aead3b0f35b9f/src/libpiano/crypt_key_input.h"
17:50:06 T:140459422640064    INFO: LIRC Initialize: using: /dev/lircd
17:50:06 T:140459422640064   DEBUG: Failed to connect to LIRC. Retry in 20s.
17:50:07 T:140459084248832    INFO: -->Python script returned the following error<--
17:50:07 T:140459084248832   ERROR: Error Type: <type 'exceptions.AttributeError'>
17:50:07 T:140459084248832   ERROR: Error Contents: 'HTTPError' object has no attribute 'reason'
17:50:07 T:140459084248832   ERROR: Traceback (most recent call last):
                                              File "/home/kjawhtpc/.xbmc/addons/rivy-xbmc-pandora/default.py", line 250, in <module>
                                                panda = Panda()
                                              File "/home/kjawhtpc/.xbmc/addons/rivy-xbmc-pandora/default.py", line 63, in __init__
                                                self.pandora = Pandora( dataDir, fmt )
                                              File "/home/kjawhtpc/.xbmc/addons/rivy-xbmc-pandora/libpandora/pandora.py", line 34, in __init__
                                                if not self.keys.loadKeys():
                                              File "/home/kjawhtpc/.xbmc/addons/rivy-xbmc-pandora/libpandora/keys.py", line 44, in loadKeys
                                                "crypt_key_input.h" )
                                              File "/home/kjawhtpc/.xbmc/addons/rivy-xbmc-pandora/libpandora/keys.py", line 124, in _loadKeyFromURL
                                                print "PANDORA: URLError: %s" %e.reason
                                            AttributeError: 'HTTPError' object has no attribute 'reason'
17:50:07 T:140459084248832    INFO: -->End of Python script error report<--

Jerry

This forum messed up the Commit: again... Pastebin

As you can see I added the rest of the Commit: in there.



RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - tknorris - 2012-05-29

(2012-05-29, 00:52)jawilljr Wrote: ...

This forum messed up the Commit: again... Pastebin

As you can see I added the rest of the Commit: in there.

Take out the "Commit:" part. Only the Hex number belongs in the URL...


RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - Rayor - 2012-05-29

(2012-05-27, 01:31)jcooper138 Wrote: My steps to get a working pandora:

1. Clone rivy's git: https://gitorious.org/~rivy/xbmc-pandora/rivy-xbmc-pandora
Code:
git clone git://gitorious.org/~rivy/xbmc-pandora/rivy-xbmc-pandora.git

2. Change BASE_URL_KEY in keys.py to:
Code:
BASE_KEY_URL = "https://raw.github.com/PromyLOPh/pianobar/94c1eec169db66bb4ad9d633342aead3b0f35b9f/src/libpiano/"

ETA replace the Commit bit as in post 1299. Don't go to this URL in a browser as it will show you a 404. What's important is that the script can pickup crypt_key_input.h and crypt_key_output.h from that location.

3. Create a zip of the directory and put it in .xbmc/addons/packages
Code:
zip -r rivy.xbmc.pandora.zip rivy-xbmc-pandora/
cp rivy.xbmc.pandora.zip ~/.xbmc/addons/packages

4. Install addon from zip file in XBMC interface.

5. Add username/password and force a key fetch.

Hope this helps someone.

I can confirm that this method works.


RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - optimatez - 2012-05-29

I am having some issues and it is not working for me, but i think it is user error on my part. Would anyone be willing to see what i am doing wrong? I am running windows, and i have no linux experience so i was having to do this through best guesses from the instructions. I went to the link in 1 and through clicking around manage to download a tar file, which i opened with winrar and extracted the xbmc-pandora-and so forth folder to my desktop, i edited the keys.py with wordpad with the code as instructed, with the commit:94c1eec replaced as instructed. I then made a .zip file of the folder with the edited .py file and placed it into "c:\program files (x86)\xbmc\addons" because i didnt have a addons/packages folder. I then added the plugin through xbmc and clicked force a key fetch and it gave a script error due to refetch.py. Pandora also does not open due to a script error. can anyone let me know where i went wrong? Here is the contents of my refetch.py if it helps:

import xbmc
import xbmcgui
import libpandora.keys
import libpandora.pandora

if __name__ == '__main__':
dlg = xbmcgui.DialogProgress()
dlg.create( "PANDORA", "ReFetching Keys..." )
dlg.update( 0 )
dataDir = "special://profile/addon_data/script.xbmc.pandora"
dataDir = xbmc.translatePath( dataDir )
proto = libpandora.pandora.PROTOCOL_VERSION
keys = libpandora.keys.Keys( dataDir, proto )
keys.forceReFetch()
dlg.close()



RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - luciferin - 2012-05-29

This is ridiculous. I've uploaded a working zip of rivy's repository. Just use the Install from Zip functionality of XBMC. If a legal representative of Pandora asks me to I will take it down.

Rivy's v 1.2.10-git with key update.

Google Drive is weird, so go to File then Download.


RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - ptzink - 2012-05-29

@luciferin, thanks for the zip. I uninstalled and deleted all traces of the Pandora plugin and then installed Rivy's version from your zip. It ran great the first time, but once I exited the plugin and tried to go back in, I got the script error again.

Edit: Went into configuration and forced key refresh a few times and it seems to work again now.


RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - lanynya - 2012-05-29

I register to thanks you.I installed the same way as ptzink work perfect.Thanks!


RE: [RELEASE] Pandora Radio (Script) Music Addon (Updated 2011-11-13 : V1.2.8) - jawilljr - 2012-05-30

(2012-05-29, 06:52)tknorris Wrote:
(2012-05-29, 00:52)jawilljr Wrote: ...

This forum messed up the Commit: again... Pastebin

As you can see I added the rest of the Commit: in there.

Take out the "Commit:" part. Only the Hex number belongs in the URL...

Got it... sorry for the wasted bandwidth... didn't know about removing the "Commit:" part.

All is working now...BTW I am a paid Pandora One member.

Again thanx for the help.

Jerry