def updateToken(self): http = mc.Http() http.SetHttpHeader("X-Plex-Platform", "Boxee") http.SetHttpHeader("X-Plex-Platform-Version", mc.GetInfoString("System.BuildVersion")) http.SetHttpHeader("X-Plex-Provides", "player") http.SetHttpHeader("X-Plex-Product", "Plexee") http.SetHttpHeader("X-Plex-Version", "1.0") try: http.SetHttpHeader("X-Plex-Device", mc.GetPlatform()) except: http.SetHttpHeader("X-Plex-Device", "Boxee") try: http.SetHttpHeader("X-Plex-Client-Identifier", mc.GetDeviceId()) except: http.SetHttpHeader("X-Plex-Client-Identifier", str(uuid.getnode())) base64String = base64.encodestring( "%s:%s" % (self.username, self.password)).replace('\n', '') http.SetHttpHeader("Authorization", "Basic %s" % base64String) postData = "username=%s&password=%s" % (self.username, self.password) data = http.Post(MyPlexService.AUTH_URL, postData) http.Reset() if data: tree = ElementTree.fromstring(data) self.authenticationToken = tree.findtext("authentication-token", None)
def __init__( self, uacode=False, ): self.uacode = uacode self.debug = False self.version = "1.0" self.domain = 'boxee.bartsidee.nl' self.application = mc.GetApp().GetId() if 'linux' in sys.platform: self.os = 'Linux' elif 'win32' in sys.platform: self.os = 'Windows' elif 'darwin' in sys.platform: self.os = 'Macintosh' try: self.platform = mc.GetPlatform() except: self.platform = 'Boxee' try: self.deviceid = mc.GetDeviceId() except: self.deviceid = 'None' try: self.boxeeid = mc.GetUniqueId() except: self.boxeeid = 'None'