def getResponse(silent=False): if not dixie.validToRun(silent): return {'Error' : 'Failed to obtain a valid response from On-Tapp.TV'} url = dixie.GetDixieUrl() + 'update.txt' request = requests.get(url, cookies=dixie.loadCookies(cookiefile), verify=False) code = request.status_code response = request.content if (code == 200) and ('no-access-redirect' not in response): dixie.log ('OTT response status_code %s ' % code) return json.loads(u"" + (response)) if (code == 401) or (code == 404) or (code == 503): try: response = re.compile('<div id="login_error">(.+?)<br />').search(code).groups(1)[0] response = response.replace('<strong>', '') response = response.replace('</strong>', '') response = response.replace('<a href="https://www.on-tapp.tv/wp-login.php?action=lostpassword">Lost your password?</a>', '') response = response.strip() dixie.log ('OTT response error code %s ' % code) except: response = '' return {'Error' : response} if 'no-access-redirect' in response: response = 'It appears that your subscription has expired.' dixie.log ('OTT error code 301 %s ' % code) return {'Error' : response}
def GetChannels(): path = os.path.join(datapath, 'chan.xml') url = dixie.GetDixieUrl(DIXIEURL) + 'chan.xml' r = requests.get(url, auth=(username, password)) with open(path, 'wb') as f: for chunk in r.iter_content(512): f.write(chunk)
def getResponse(): try: url = dixie.GetDixieUrl(DIXIEURL) + 'update.txt' response = urllib2.urlopen(url).read() except: return [] return json.loads(u"" + (response))
def getFiles(url): url = dixie.GetDixieUrl(DIXIEURL) + 'update.txt' request = requests.get(url, allow_redirects=False, auth=(getUsername(), getPassword())) response = request.text return response
def checkFiles(url): url = dixie.GetDixieUrl(DIXIEURL) + 'update.txt' request = requests.get(url, allow_redirects=False, auth=(getUsername(), getPassword())) response = request.text code = request.status_code reason = request.reason dixie.log('----- Check OnTapp.TV Files -----') dixie.log('---------- status code ----------') dixie.Log(code) return code
def checkFiles(url): url = dixie.GetDixieUrl(DIXIEURL) + 'update.txt' request = requests.get(url, allow_redirects=False, auth=(username, password)) response = request.text code = request.status_code reason = request.reason print '----- Check OnTapp.TV Files -----' print '---------- status code ----------' print code return code
def getResponse(): try: url = dixie.GetDixieUrl(DIXIEURL) + 'update.txt' request = requests.get(url, allow_redirects=False, auth=(username, password)) code = request.status_code response = request.content if not code == 200: response = re.sub('<(.+?)>', '', response) return {'Error': response} except: pass return json.loads(u"" + (response))
def GetDixieUrl(): return dixie.GetDixieUrl(DIXIEURL)
def main(doLogin=True): busy = None try: busy = xbmcgui.WindowXMLDialog('DialogBusy.xml', '') busy.show() try: busy.getControl(10).setVisible(False) except: pass except: busy = None import buggalo import gui buggalo.GMAIL_RECIPIENT = '*****@*****.**' try: if doLogin: url = dixie.GetDixieUrl(DIXIEURL) + 'update.txt' code = session.doLogin() response = session.checkFiles(url) else: code = 200 response = '' if code == 503: d = xbmcgui.Dialog() d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % code, 'Something went wrong with your login', 'Please check your settings.') d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % code, 'Daily IP Address limit reached.', 'Restricted for 2 hours.') print '****** OnTapp.TV Error 503. Too many login attempts/IPs exceeded *******' return if response == 401: d = xbmcgui.Dialog() d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % response, 'Something went wrong with your login', 'Check your settings, or subscribe at www.on-tapp.tv.') print '****** OnTapp.TV Error 401. Access Denied. Not a paid member. *******' return if response == 301: xbmc.executebuiltin('XBMC.RunScript($CWD/deleteDB.py)') d = xbmcgui.Dialog() d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % response, 'It looks like you do not have a paid subcription.', 'Check your settings, or subscribe at www.on-tapp.tv.') print '****** OnTapp.TV Error 301. Free member. No paid subscription. *******' return if doLogin: # CheckDixieURL() CheckVersion() GetChannels() GetCats() CheckSkin() CheckSkinVersion() CheckIniVersion() CheckForUpdate() CheckForChannels() print '****** OnTapp.TV - All OK *******' xbmcgui.Window(10000).setProperty('OTT_RUNNING', 'True') xbmc.executebuiltin('XBMC.ActivateWindow(home)') w = gui.TVGuide() if busy: busy.close() busy = None CopyKeymap() w.doModal() RemoveKeymap() del w xbmcgui.Window(10000).clearProperty('OTT_RUNNING') except Exception: buggalo.onExceptionRaised()
def main(doLogin=True): busy = None try: busy = xbmcgui.WindowXMLDialog('DialogBusy.xml', '') busy.show() try: busy.getControl(10).setVisible(False) except: pass except: busy = None import buggalo import gui buggalo.GMAIL_RECIPIENT = '*****@*****.**' try: if doLogin: url = dixie.GetDixieUrl(DIXIEURL) + 'update.txt' code = session.doLogin() response = session.checkFiles(url) else: code = 200 response = '' if code == 503: d = xbmcgui.Dialog() d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % code, 'Something went wrong with your login', 'Please check your settings.') d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % code, 'Daily IP Address limit reached.', 'Restricted for 2 hours.') return if response == 401: d = xbmcgui.Dialog() d.ok(TITLE + ' Error', 'OnTapp.TV failed with error code - %s.' % response, 'Something went wrong with your login', 'You will now get Basic Channels.') d.ok(TITLE + ' Error - %s.' % response, 'OnTapp.TV failed to log in', 'Check your settings.', 'Please subscribe at www.on-tapp.tv.') dixie.SetSetting('dixie.url', 'Basic Channels') dixie.SetSetting('DIXIEURL', 'Basic Channels') return else: # if doLogin: # xbmcgui.Dialog().ok(TITLE + ' Status', 'Status - %s' % response, 'Login OK.', 'Thank you.') CheckDixieURL() CheckVersion() GetCats() CheckSkin() CheckSkinVersion() CheckIniVersion() CheckForUpdate() xbmcgui.Window(10000).setProperty('OTT_RUNNING', 'True') xbmc.executebuiltin('XBMC.ActivateWindow(home)') w = gui.TVGuide() if busy: busy.close() busy = None CopyKeymap() w.doModal() RemoveKeymap() del w xbmcgui.Window(10000).clearProperty('OTT_RUNNING') except Exception: buggalo.onExceptionRaised()