def sourcesDialog(self): try: sources = [{'label': '00 | [B]%s[/B]' % control.lang(30509).encode('utf-8').upper()}] + self.sources labels = [i['label'] for i in sources] select = control.selectDialog(labels) if select == 0: return self.sourcesDirect() if select == -1: return 'close://' items = [self.sources[select-1]] next = [y for x,y in enumerate(self.sources) if x >= select] prev = [y for x,y in enumerate(self.sources) if x < select][::-1] source, quality = items[0]['source'], items[0]['quality'] items = [i for i in items+next+prev if i['quality'] == quality and i['source'] == source][:10] items += [i for i in next+prev if i['quality'] == quality and not i['source'] == source][:10] self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0) block = None for i in range(len(items)): try: if self.progressDialog.iscanceled(): break self.progressDialog.update(int((100 / float(len(items))) * i), str(items[i]['label']), str(' ')) if items[i]['source'] == block: raise Exception() w = workers.Thread(self.sourcesResolve, items[i]['url'], items[i]['provider']) w.start() m = '' for x in range(3600): if self.progressDialog.iscanceled(): return self.progressDialog.close() if xbmc.abortRequested == True: return sys.exit() k = control.condVisibility('Window.IsActive(virtualkeyboard)') if k: m += '1'; m = m[-1] if (w.is_alive() == False or x > 30) and not k: break time.sleep(1) for x in range(30): if m == '': break if self.progressDialog.iscanceled(): return self.progressDialog.close() if xbmc.abortRequested == True: return sys.exit() if w.is_alive() == False: break time.sleep(1) if w.is_alive() == True: block = items[i]['source'] if self.url == None: raise Exception() self.selectedSource = items[i]['label'] self.progressDialog.close() return self.url except: pass try: self.progressDialog.close() except: pass except: try: self.progressDialog.close() except: pass
def sourcesDialog(self): try: sources = [{ 'label': '00 | [B]%s[/B]' % control.lang(30509).encode('utf-8').upper() }] + self.sources labels = [i['label'] for i in sources] select = control.selectDialog(labels) if select == 0: return self.sourcesDirect() if select == -1: return 'close://' items = [self.sources[select - 1]] next = [y for x, y in enumerate(self.sources) if x >= select] prev = [y for x, y in enumerate(self.sources) if x < select][::-1] source, quality = items[0]['source'], items[0]['quality'] items = [ i for i in items + next + prev if i['quality'] == quality and i['source'] == source ][:10] items += [ i for i in next + prev if i['quality'] == quality and not i['source'] == source ][:10] self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0) block = None for i in range(len(items)): try: if self.progressDialog.iscanceled(): break self.progressDialog.update( int((100 / float(len(items))) * i), str(items[i]['label']), str(' ')) if items[i]['source'] == block: raise Exception() w = workers.Thread(self.sourcesResolve, items[i]['url'], items[i]['provider']) w.start() m = '' for x in range(3600): if self.progressDialog.iscanceled(): return self.progressDialog.close() if xbmc.abortRequested == True: return sys.exit() k = control.condVisibility( 'Window.IsActive(virtualkeyboard)') if k: m += '1' m = m[-1] if (w.is_alive() == False or x > 30) and not k: break time.sleep(1) for x in range(30): if m == '': break if self.progressDialog.iscanceled(): return self.progressDialog.close() if xbmc.abortRequested == True: return sys.exit() if w.is_alive() == False: break time.sleep(1) if w.is_alive() == True: block = items[i]['source'] if self.url == None: raise Exception() self.selectedSource = items[i]['label'] self.progressDialog.close() return self.url except: pass try: self.progressDialog.close() except: pass except: try: self.progressDialog.close() except: pass