Skip to content

Commit

Permalink
v34 workaround: Get sync time from JJZ's server. Patch by James Burton.
Browse files Browse the repository at this point in the history
Bug: lp:988395
  • Loading branch information
kevinmehall committed Apr 27, 2012
1 parent e619141 commit 049a036
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pithos/pandora/pandora.py
Expand Up @@ -21,7 +21,7 @@
from pithos.pandora.xmlrpc import *
from pithos.pandora.blowfish import Blowfish

PROTOCOL_VERSION = "33"
PROTOCOL_VERSION = "34"
RPC_URL = "www.pandora.com/radio/xmlrpc/v"+PROTOCOL_VERSION+"?"
USER_AGENT = "Mozilla/5.0 (X11; U; Linux i586; de; rv:5.0) Gecko/20100101 Firefox/5.0 (compatible; Pithos/0.3)"
HTTP_TIMEOUT = 30
Expand Down Expand Up @@ -169,13 +169,15 @@ def connect(self, user, password):
self.rid = "%07iP"%(int(time.time()) % 10000000)
self.listenerId = self.authToken = None

pandora_time = self.xmlrpc_call('misc.sync', [], [], secure=True, includeTime=False)
logging.info("Pandora sync reply is %s", pandora_decrypt(pandora_time))
pandora_time = int(pandora_decrypt(pandora_time)[4:14])
logging.info("Attempting to connect...");
timeurl = urllib2.urlopen("http://ridetheclown.com/s2/synctime.php");
pandora_time=int(timeurl.read(),10);
logging.info("Synctime is %s", pandora_time)

self.time_offset = pandora_time - time.time()
logging.info("Time offset is %s", self.time_offset)

user = self.xmlrpc_call('listener.authenticateListener', [user, password], [], secure=True)
user = self.xmlrpc_call('listener.authenticateListener', ["",user, password,"html5tuner","","","HTML5",True], [], secure=True)

self.webAuthToken = user['webAuthToken']
self.listenerId = user['listenerId']
Expand Down

0 comments on commit 049a036

Please sign in to comment.