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)



- thrillerbee - 2011-06-08

Is anyone having experiencing XBMC crashes when using this pandora script?


- n899 - 2011-06-12

spbogie / DamianXD - any help would be greatly appreciated Smile

When enabling the proxy I always get:

13:40:47 T:2899729264 M:3420258304 INFO: -->Python script returned the following error<--
13:40:47 T:2899729264 M:3420258304 ERROR: Error Type: exceptions.AttributeError
13:40:47 T:2899729264 M:3420258304 ERROR: Error Contents: Pandora instance has no attribute 'setProxy'
13:40:47 T:2899729264 M:3420258304 ERROR: Traceback (most recent call last):
File "/home/mike/.xbmc/addons/script.xbmc.pandora/default.py", line 241, in ?
panda = Panda()
File "/home/mike/.xbmc/addons/script.xbmc.pandora/default.py", line 72, in __init__
self.pandora.setProxy( proxy_info )
AttributeError: Pandora instance has no attribute 'setProxy'
13:40:47 T:2899729264 M:3420258304 INFO: -->End of Python script error report<--


----

I modded the script as follows (pretty much identical to the old proxy script)

self.pandora = Pandora( fmt )
if True: #GetGuiSetting( 1, "network.usehttpproxy" ):
proxy_info = {
"host" : "xxxx", #GetGuiSetting( 3, "network.httpproxyserver" ),
"port" : "8080", #GetGuiSetting( 3, "network.httpproxyport" ),
"user" : "username", #GetGuiSetting( 3, "network.httpproxyusername" ),
"pass" : "password" #GetGuiSetting( 3, "network.httpproxypassword" )

}
self.pandora.setProxy( proxy_info )

self.pandora.sync()


- xxturbowesxx - 2011-06-13

How do I know which are the encryption keys in the pianobar link.. Sorry Newb here


- htpc guy - 2011-06-13

Don't worry about those. There is a link to a new version just a few pages back. It has all the files needed.


- DamianXD - 2011-06-13

n899 Wrote:spbogie / DamianXD - any help would be greatly appreciated Smile

When enabling the proxy I always get:

13:40:47 T:2899729264 M:3420258304 INFO: -->Python script returned the following error<--
13:40:47 T:2899729264 M:3420258304 ERROR: Error Type: exceptions.AttributeError
13:40:47 T:2899729264 M:3420258304 ERROR: Error Contents: Pandora instance has no attribute 'setProxy'
13:40:47 T:2899729264 M:3420258304 ERROR: Traceback (most recent call last):
File "/home/mike/.xbmc/addons/script.xbmc.pandora/default.py", line 241, in ?
panda = Panda()
File "/home/mike/.xbmc/addons/script.xbmc.pandora/default.py", line 72, in __init__
self.pandora.setProxy( proxy_info )
AttributeError: Pandora instance has no attribute 'setProxy'
13:40:47 T:2899729264 M:3420258304 INFO: -->End of Python script error report<--


----

I modded the script as follows (pretty much identical to the old proxy script)

self.pandora = Pandora( fmt )
if True: #GetGuiSetting( 1, "network.usehttpproxy" ):
proxy_info = {
"host" : "xxxx", #GetGuiSetting( 3, "network.httpproxyserver" ),
"port" : "8080", #GetGuiSetting( 3, "network.httpproxyport" ),
"user" : "username", #GetGuiSetting( 3, "network.httpproxyusername" ),
"pass" : "password" #GetGuiSetting( 3, "network.httpproxypassword" )

}
self.pandora.setProxy( proxy_info )

self.pandora.sync()

But you actually changed those variables with the ones you have right?
For example, where it says "username" did you enter the username for your proxy?

EDITED:
Seems like this fix don't work on v1.1.1

EDITED AGAIN:
Please replace your libpandora/pandora.py with this code:
Code:
import xmlrpclib
import urllib2
import time

import crypt

PROTOCOL_VERSION=30
BASE_URL = "http://www.pandora.com/radio/xmlrpc/v%d?" %PROTOCOL_VERSION
BASE_URL_RID = BASE_URL + "rid=%sP&method=%s"
BASE_URL_LID = BASE_URL + "rid=%sP&lid=%s&method=%s"

def _inttime():
    return int( time.time() )

class Pandora:
    rid = ""
    lid = ""
    authToken = ""
    curStation = ""
    curFormat = "mp3-hifi" #Default to mp3 if not specified

    def __init__( self ):
        self.rid = "%07i" %( time.time() % 10000000 )

    def __init__( self, format ):
        self.rid = "%07i" %( time.time() % 10000000 )
        self.curFormat = format

    def setProxy( self, proxy_info ):
        if proxy_info["user"] == "" and proxy_info["pass"] == "":
            proxy_h = urllib2.ProxyHandler( { "http" : \
                "http://%(host)s:%(port)s" %proxy_info } )
        else:
            proxy_h = urllib2.ProxyHandler( { "http" : \
                "http://%(user)s:%(pass)s@%(host)s:%(port)s" %proxy_info } )

        proxy_o = urllib2.build_opener( proxy_h, urllib2.HTTPHandler )

        urllib2.install_opener( proxy_o )

    def sync( self ):
        reqUrl = BASE_URL_RID %( self.rid, "sync" )

        req = xmlrpclib.dumps( (), "misc.sync" ).replace( "\n", "" )
        enc = crypt.encryptString( req )

        u = urllib2.urlopen( reqUrl, enc )
        resp = u.read()
        u.close()

    def authListener( self, user, pwd ):
        reqUrl = BASE_URL_RID %( self.rid, "authenticateListener" )

        req = xmlrpclib.dumps( ( _inttime(), user, pwd ), \
                                "listener.authenticateListener" )
        req = req.replace( "\n", "" )
        enc = crypt.encryptString( req )

        u = urllib2.urlopen( reqUrl, enc )
        resp = u.read()
        u.close()

        try:
            parsed = xmlrpclib.loads( resp )[0][0]
        except xmlrpclib.Fault, fault:
            print "Error:", fault.faultString
            print "Code:", fault.faultCode
            return False

        self.authToken = parsed["authToken"]
        self.lid = parsed["listenerId"]
        
        return True

    def getStations( self ):
        reqUrl = BASE_URL_LID %( self.rid, self.lid, "getStations" )

        req = xmlrpclib.dumps( ( _inttime(), self.authToken ), \
                                "station.getStations" )
        req = req.replace( "\n", "" )
        enc = crypt.encryptString( req )

        u = urllib2.urlopen( reqUrl, enc )
        resp = u.read()
        u.close()

        parsed = xmlrpclib.loads( resp )[0][0]

        return parsed

    def getFragment( self, stationId=None, format=None ):
        if stationId == None:
            stationId = self.curStation
        if format == None:
            format = self.curFormat
        reqUrl = BASE_URL_LID %( self.rid, self.lid, "getFragment" )

        args = ( _inttime(), self.authToken, stationId, "0", "", "", \
                    format, "0", "0" )
        req = xmlrpclib.dumps( args, "playlist.getFragment" )
        req = req.replace( "\n", "" )
        enc = crypt.encryptString( req )

        u = urllib2.urlopen( reqUrl, enc )
        resp = u.read()
        u.close()

        parsed = xmlrpclib.loads( resp )[0][0]

        #last 48 chars of URL encrypted, padded w/ 8 * '\x08'
        for i in range( len( parsed ) ):
            url = parsed[i]["audioURL"]
            url = url[:-48] + crypt.decryptString( url[-48:] )[:-8]
            parsed[i]["audioURL"] = url

        self.curStation = stationId
        self.curFormat = format

        return parsed

    def addFeedback( self, stationId, musicId, likeFlag ):
    
        print "addFeedback - stationId: ", stationId
        print "addFeedback - musicId: ", musicId
        print "addFeedback - likeFlag: ", likeFlag
        reqUrl = BASE_URL_LID %( self.rid, self.lid, "addFeedback" )

        matchingSeed = ""
        userSeed = ""
        focusTraitId = ""
        
        args = ( _inttime(), self.authToken, stationId, musicId, matchingSeed, userSeed, focusTraitId, "", likeFlag, False )

        req = xmlrpclib.dumps( args, "station.addFeedback" )
        print "addFeedback - req: ", req
        req = req.replace( "\n", "" )
        enc = crypt.encryptString( req )

        u = urllib2.urlopen( reqUrl, enc )
        resp = u.read()
        u.close()

        print "addFeedback resp:", resp

        #parsed = xmlrpclib.loads( resp )[0][0]
        #print "addFeedback return:", parsed

        #return parsed

    def addTiredSong( self, musicId ):
        reqUrl = BASE_URL_LID %( self.rid, self.lid, "addTiredSong" )

        req = xmlrpclib.dumps( ( _inttime(), self.authToken, musicId ), \
                                "listener.addTiredSong" )
        req = req.replace( "\n", "" )
        enc = crypt.encryptString( req )

        u = urllib2.urlopen( reqUrl, enc )
        resp = u.read()
        u.close()

        print "addTiredSong resp:", resp



- Agin - 2011-06-17

apex82 Wrote:What is everyone using to get this up and running in Canada? Other than a paid vpn service... thanks

Have a look at http://unblock-us.com/ , $5/month & 1 week free trial. The trial can be activated just by entering your email address, no payment option needed at that time.


- mrfatboy - 2011-06-17

Never mind I just found it Smile


- n899 - 2011-06-17

Never mind - It's just my crazy proxy settings.

Now it's playing a little fast, strangest thing - might be my audio drivers but everything else plays fine.

Thanks again for all your help DamianXD!


- stergil - 2011-06-17

Hello!

I am brand new to XBMC, coming from using Boxee for a long time. One of the main things that's kept me with Boxee is the Pandora app, which is definitely buggy but they're cosmetic bugs.

I've been using XBMC for a couple of weeks now and have setup this Pandora script about a week ago.

Unfortunately it's crashing XBMC on me left and right. Sometimes I'll get through a few songs, sometimes not. Sometimes it'll hardlock XBMC and sometimes I'll get a 'XBMC has stopped responding, close the app or wait" type message.

I'm using the latest script 1.1.2 (I think, not at home atm) and the latest version of XBMC that was available as of 2 weeks ago. Windows 7 64bit.

Is there anything other info I can provide to help troubleshoot? Or are there any suggestions or alternatives?

I can't live without my Pandora Sad

Thanks!


- Joebeer - 2011-06-19

Is anyone else getting error script failed script xbmc pandora? It was working yesterday. My atv2 was jailbroken with snowbreeze but decided 2 restore and jailbreak with seas0npass and installed the latest nightly build today because I was getting errors on other addons. I haven't had any problems with those other addons but now pandora won't work 4 me. I wasn't able to disable or uninstall pandora before re-jailbreaking so I'm wondering if this has anything to do with it? Any help is appreciated


- htpc guy - 2011-06-19

Joebeer Wrote:Is anyone else getting error script failed script xbmc pandora? It was working yesterday. My atv2 was jailbroken with snowbreeze but decided 2 restore and jailbreak with seas0npass and installed the latest nightly build today because I was getting errors on other addons. I haven't had any problems with those other addons but now pandora won't work 4 me. I wasn't able to disable or uninstall pandora before re-jailbreaking so I'm wondering if this has anything to do with it? Any help is appreciated

I just tried and its working fine for me. What version are you using?


- grypho - 2011-06-20

Just bought an apple tv 2 today. Installed Pandora addon but its not working... it gives an error. Tried the latest 1.1.2 posted a few pages back.
Image


- bac522 - 2011-06-20

smorloc Wrote:Howdy,

I'd like to share an updated Pandora addon with an implementation for the like/dislike buttons and a new "I'm tired of this song" button.

Does the "I'm tired..." button actually send that to Pandora or just skip the song? I hit that button on a song I was tired of and the next day the song played again (same album, same artist).


Failed to Authenticate Listener - kevinpell - 2011-06-21

I read and read all the post but still can't find the solution
Im getting the error Failed to authenticate listener heres my log can anyone help ?

12:16:26 T:158711808 M:121180160 DEBUG: Process - Entering source directory /var/mobile/Library/Preferences/XBMC/addons/script.xbmc.pandora
12:16:26 T:158711808 M:121180160 DEBUG: Instantiating addon using automatically obtained id of "script.xbmc.pandora" dependent on version 1.0 of the xbmc.python api
12:16:26 T:158711808 M:121532416 INFO: Loading skin file: DialogProgress.xml
12:16:26 T:158711808 M:121532416 DEBUG: Load DialogProgress.xml: 221.35ms
12:16:26 T:158711808 M:121532416 DEBUG: DialogProgress::StartModal called
12:16:26 T:158711808 M:121532416 DEBUG: ------ Window Init (DialogProgress.xml) ------
12:16:26 T:158711808 M:121524224 DEBUG: Alloc resources: 50.18ms (0.03 ms skin load)
12:16:37 T:158711808 M:120254464 ERROR: /var/mobile/Library/Preferences/XBMC/addons/script.xbmc.pandora/libpandora/pianoparser.py:6: DeprecationWarning: os.getcwd() currently lies to you so please use addon.getAddonInfo('path') to find the script's root directory and DO NOT make relative path accesses based on the results of 'os.getcwd.'
f = open( os.path.join( os.getcwd(), fname ), 'r' )
12:16:38 T:158711808 M:120238080 ERROR: /var/mobile/Library/Preferences/XBMC/addons/script.xbmc.pandora/default.py:21: DeprecationWarning: os.getcwd() currently lies to you so please use addon.getAddonInfo('path') to find the script's root directory and DO NOT make relative path accesses based on the results of 'os.getcwd.'
scriptPath = os.getcwd().replace(';','')
12:16:40 T:158711808 M:119812096 DEBUG: DialogProgress::StartModal called (already running)!
12:16:40 T:158711808 M:119808000 DEBUG: ------ Window Init (DialogProgress.xml) ------
12:16:40 T:158711808 M:119799808 DEBUG: Alloc resources: 6.23ms (0.03 ms skin load)
12:16:41 T:158711808 M:119721984 NOTICE: Error:
12:16:41 T:158711808 M:119721984 NOTICE: org.apache.xmlrpc.XmlRpcException: 000.000.000.000|0|INCOMPATIBLE_VERSION|Pandora does not support your client version.
12:16:41 T:158711808 M:119721984 NOTICE: Code:
12:16:41 T:158711808 M:119721984 NOTICE: 1
12:16:41 T:158711808 M:119721984 INFO: Loading skin file: DialogYesNo.xml
12:16:41 T:158711808 M:119721984 DEBUG: Load DialogYesNo.xml: 130.62ms
12:16:41 T:100208640 M:119721984 DEBUG: ------ Window Init (DialogYesNo.xml) ------
12:16:41 T:100208640 M:119721984 DEBUG: Alloc resources: 7.12ms (0.03 ms skin load)
12:16:41 T:100208640 M:119812096 DEBUG: ------ Window Deinit (DialogProgress.xml) ------
12:16:47 T:100208640 M:119472128 INFO: CheckIdle - Closing session to http://feeds.feedburner.com (easy=0x5c45000, multi=0x91875a0)


- jsgrif - 2011-06-23

I've been trying for the past few days to get Pandora working on ATV2 with no luck. Here is my error log. Is there anyway someone can help? This is driving me crazy!!!

Thanks...


ERROR: /Applications/XBMC.frappliance/XBMCData/XBMCHome/addons/script.xbmc.pandora/default.py:21: DeprecationWarning: os.getcwd() currently lies to you so please use addon.getAddonInfo('path') to find the script's root directory and DO NOT make relative path accesses based on the results of 'os.getcwd.'