예제 #1
0
파일: pandora.py 프로젝트: f4nt/pypandora
 def _decrypt_url(url):
     """ decrypts the song url where the song stream can be downloaded.  the
     last 48 bytes are encrypted, so we pass those bytes to the c extension
     and then tack the decrypted value back onto the url """
     e = url[-48:]
     d = _pandora.decrypt(e)
     url = url.replace(e, d)
     return url[:-8]
예제 #2
0
 def _decrypt_url(url):
     """ decrypts the song url where the song stream can be downloaded.  the
     last 48 bytes are encrypted, so we pass those bytes to the c extension
     and then tack the decrypted value back onto the url """
     e = url[-48:]
     d = _pandora.decrypt(e)
     url = url.replace(e, d)
     return url[:-8]
예제 #3
0
    def sync(self):
        get = {"method": "sync"}
        body = self.get_template("sync")
        timestamp = None

        while timestamp is None:
            xml = self.send(get.copy(), body)
            timestamp = xml.find("params/param/value").text
            timestamp = _pandora.decrypt(timestamp)
            
            timestamp_chars = []
            for c in timestamp:
                if c.isdigit(): timestamp_chars.append(c)
            timestamp = int(time.time() - int("".join(timestamp_chars)))

        self.timeoffset = timestamp	    
        return True
예제 #4
0
파일: pandora.py 프로젝트: f4nt/pypandora
    def sync(self):
        """ synchronizes the times between our clock and pandora's servers by
        recording the timeoffset value, so that for every call made to Pandora,
        we can specify the correct time of their servers in our call """
        get = {"method": "sync"}
        body = self.get_template("sync")
        timestamp = None

        while timestamp is None:
            xml = self.send(get.copy(), body)
            timestamp = xml.find("params/param/value").text
            timestamp = _pandora.decrypt(timestamp)

            timestamp_chars = []
            for c in timestamp:
                if c.isdigit(): timestamp_chars.append(c)
            timestamp = int(time.time() - int("".join(timestamp_chars)))

        self.timeoffset = timestamp
        return True
예제 #5
0
    def sync(self):
        """ synchronizes the times between our clock and pandora's servers by
        recording the timeoffset value, so that for every call made to Pandora,
        we can specify the correct time of their servers in our call """
        get = {"method": "sync"}
        body = self.get_template("sync")
        timestamp = None


        while timestamp is None:
            xml = self.send(get.copy(), body)
            timestamp = xml.find("params/param/value").text
            timestamp = _pandora.decrypt(timestamp)

            timestamp_chars = []
            for c in timestamp:
                if c.isdigit(): timestamp_chars.append(c)
            timestamp = int(time.time() - int("".join(timestamp_chars)))

        self.timeoffset = timestamp	    
        return True
예제 #6
0
 def _decrypt_url(url):
     e = url[-48:]
     d = _pandora.decrypt(e)
     url = url.replace(e, d)
     return url[:-8]