def play(self, name, title, service, meta): syshandle = int(sys.argv[1]) sysaddon = sys.argv[0] #control.log('xxx BBB3 %s | %s ' % (syshandle, sysaddon)) #control.log('BBB1 %s %s %s %s' % (name, title, meta,service)) try: if not control.infoLabel('Container.FolderPath').startswith('plugin://'): control.log('BBB2' ) control.playlist.clear() #control.resolve(int(sys.argv[1]), True, control.item(path='')) #control.execute('Dialog.Close(okdialog)') url = self.sourcesDirect(service, meta) if url == None: raise Exception() if url == 'close://': return from resources.lib.lib.player import player player().run(name, url, meta,service) return url except: control.infoDialog(control.lang(30501).encode('utf-8'),time=4000)
def play(self, name, title, service, meta, url): #control.log('BBB1 %s %s %s %s' % (name, title, meta,service)) try: if not control.infoLabel('Container.FolderPath').startswith( 'plugin://'): control.playlist.clear() control.resolve(int(sys.argv[1]), True, control.item(path='')) #control.execute('Dialog.Close(okdialog)') content = 'movie' url = self.sourcesDirect(service, meta) if url == None: raise Exception() if url == 'close://': return control.sleep(200) from resources.lib.lib.player import player player().run(name, url, meta, service) return url except: control.infoDialog(control.lang(30501).encode('utf-8'))
def playItem(self, content, name, year, imdb, tvdb, source): try: control.resolve(int(sys.argv[1]), True, control.item(path='')) control.execute('Dialog.Close(okdialog)') next = [] ; prev = [] ; total = [] meta = None for i in range(1,10000): try: u = control.infoLabel('ListItem(%s).FolderPath' % str(i)) if u in total: raise Exception() total.append(u) u = dict(urlparse.parse_qsl(u.replace('?',''))) if 'meta' in u: meta = u['meta'] u = json.loads(u['source'])[0] next.append(u) except: break for i in range(-10000,0)[::-1]: try: u = control.infoLabel('ListItem(%s).FolderPath' % str(i)) if u in total: raise Exception() total.append(u) u = dict(urlparse.parse_qsl(u.replace('?',''))) if 'meta' in u: meta = u['meta'] u = json.loads(u['source'])[0] prev.append(u) except: break items = json.loads(source) 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: 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() try: self.progressDialog.close() except: pass control.sleep(200) if control.setting('playback_info') == 'true': control.infoDialog(items[i]['label'], heading=name) from resources.lib.lib.player import player player().run(content, name, self.url, year, imdb, tvdb, meta) return self.url except: pass try: self.progressDialog.close() except: pass raise Exception() except: control.infoDialog(control.lang(30501).encode('utf-8')) pass
def playItem(self, content, name, year, imdb, tvdb, source): try: control.resolve(int(sys.argv[1]), True, control.item(path='')) control.execute('Dialog.Close(okdialog)') next = [] prev = [] total = [] meta = None for i in range(1, 10000): try: u = control.infoLabel('ListItem(%s).FolderPath' % str(i)) if u in total: raise Exception() total.append(u) u = dict(urlparse.parse_qsl(u.replace('?', ''))) if 'meta' in u: meta = u['meta'] u = json.loads(u['source'])[0] next.append(u) except: break for i in range(-10000, 0)[::-1]: try: u = control.infoLabel('ListItem(%s).FolderPath' % str(i)) if u in total: raise Exception() total.append(u) u = dict(urlparse.parse_qsl(u.replace('?', ''))) if 'meta' in u: meta = u['meta'] u = json.loads(u['source'])[0] prev.append(u) except: break items = json.loads(source) 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: 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() try: self.progressDialog.close() except: pass control.sleep(200) if control.setting('playback_info') == 'true': control.infoDialog(items[i]['label'], heading=name) from resources.lib.lib.player import player player().run(content, name, self.url, year, imdb, tvdb, meta) return self.url except: pass try: self.progressDialog.close() except: pass raise Exception() except: control.infoDialog(control.lang(30501).encode('utf-8')) pass