def _resolve(self, itm): if itm is None: return None; if itm.get('provider') == 'plugin.video.online-files' and itm.get('params').get('cp') == 'webshare.cz': if sctop.getSetting('wsuser') == "": res = sctop.yesnoDialog(sctop.getString(30945), sctop.getString(30946), "") if res == True: sctop.openSettings('201.101') return None try: from myprovider.webshare import Webshare as wx self.ws = wx(sctop.getSetting('wsuser'), sctop.getSetting('wspass'), self.cache) if not self.ws.login(): res = sctop.yesnoDialog(sctop.getString(30945), sctop.getString(30946), "") if res == True: sctop.openSettings('201.101') return None else: udata = self.ws.userData() util.debug("[SC] udata: %s" % str(udata)) if udata == False: util.debug("[SC] NIEJE VIP ucet") sctop.infoDialog(sctop.getString(30947), icon="WARNING") sctop.sleep(5000) elif int(udata) <= 14: sctop.infoDialog(sctop.getString(30948) % str(udata), icon="WARNING") util.debug("[SC] VIP ucet konci") itm['url'] = self.ws.resolve(itm.get('params').get('play').get('ident')) try: if itm['subs'] is not None and "webshare.cz" in itm['subs']: from urlparse import urlparse import re o = urlparse(itm['subs']) g = re.split('/', o[2] if o[5] == '' else o[5]) util.debug("[SC] webshare titulky: %s | %s" % (str(g[2]), itm['subs'])) url = self.ws.resolve(g[2]) itm['subs'] = url content = sctop.request(url) itm['subs'] = self.parent.saveSubtitle(content, 'cs', False) util.debug("[SC] posielam URL na titulky: %s" % itm['subs']) except Exception as e: util.debug("[SC] chyba WS titlkov... %s | %s" % (str(e), str(traceback.format_exc()))) pass itm['headers'] = {'User-Agent': util.UA} except: bug.onExceptionRaised() pass itm['title'] = self.parent.encode(itm['title']) return itm
def createResumePoint(self, seconds, total): try: pomer = seconds / total if pomer < 0.05: return if self.itemType == 'episode': metaReq = { "jsonrpc": "2.0", "method": "VideoLibrary.SetEpisodeDetails", "params": { "episodeid": self.itemDBID, "resume": { "position": seconds, "total": total } }, "id": 1 } ret = self.executeJSON(metaReq) util.debug("[SC] resumepoint: %s %s" % (str(metaReq), str(ret))) elif self.itemType == 'movie': metaReq = { "jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": { "movieid": self.itemDBID, "resume": { "position": seconds, "total": total } }, "id": 1 } ret = self.executeJSON(metaReq) util.debug("[SC] resumepoint: %s %s" % (str(metaReq), str(ret))) '''resume = self.parent.getResumePoint() resume.update({self.itemDBID: seconds}) self.parent.setResumePoint(resume)''' except Exception: bug.onExceptionRaised({'seconds: ': seconds}) return
def _resolve(self, itm): util.debug("[SC] _resolve") if itm is None: return None if itm.get('provider') == 'plugin.video.online-files': if sctop.getSetting('wsuser') == "": res = sctop.yesnoDialog(sctop.getString(30945), sctop.getString(30946), "") if res == True: sctop.openSettings('201.101') return None try: from myprovider.webshare import Webshare as wx self.ws = wx(sctop.getSetting('wsuser'), sctop.getSetting('wspass'), self.cache) if not self.ws.login(): res = sctop.yesnoDialog(sctop.getString(30945), sctop.getString(30946), "") if res == True: sctop.openSettings('201.101') return None else: udata = self.ws.userData() util.debug("[SC] udata: %s" % str(udata)) if udata == False: util.debug("[SC] NIEJE VIP ucet") sctop.infoDialog(sctop.getString(30947), icon="WARNING") sctop.sleep(5000) elif int(udata) <= 14: sctop.infoDialog(sctop.getString(30948) % str(udata), icon="WARNING") util.debug("[SC] VIP ucet konci") try: util.debug('[SC] ideme pre ident ') ident = self._json(self._url(itm['url']))['ident'] except: ident = '6d8359zW1u' pass try: jsdata = json.loads(sctop.request( self._url('/Stats/file'))) if 'ident' in jsdata: sctop.request(self.ws.resolve(jsdata['ident'])) except Exception as e: pass itm['url'] = self.ws.resolve(ident) try: data = { 'scid': itm['id'], 'action': 'start', } util.debug("[SC] prehravanie %s" % str(data)) sctop.player.scid = itm['id'] sctop.player.action(data) except Exception as e: util.debug( '[SC] nepodarilo sa vykonat akciu "start" %s | %s' % (str(e), str(traceback.format_exc()))) try: if itm['subs'] is not None and "webshare.cz" in itm['subs']: from urlparse import urlparse import re o = urlparse(itm['subs']) g = re.split('/', o[2] if o[5] == '' else o[5]) util.debug("[SC] webshare titulky: %s | %s" % (str(g[2]), itm['subs'])) url = self.ws.resolve(g[2]) itm['subs'] = url content = sctop.request(url) itm['subs'] = self.parent.saveSubtitle( content, 'cs', False) util.debug("[SC] posielam URL na titulky: %s" % itm['subs']) except Exception as e: util.debug("[SC] chyba WS titlkov... %s | %s" % (str(e), str(traceback.format_exc()))) pass itm['headers'] = {'User-Agent': util.UA} except Exception as e: util.debug("[SC] chyba.... %s %s" % (str(e), str(traceback.format_exc()))) bug.onExceptionRaised() pass itm['title'] = self.parent.encode(itm['title']) return itm
def _resolve(self, itm): util.debug("[SC] _resolve") if itm is None: return None if itm.get('provider') == 'plugin.video.online-files' or itm.get( 'provider') == 'webshare': if sctop.getSetting('wsuser') == "": sctop.infoDialog(sctop.getString(30945), sctop.getString(30946)) return None try: if not self.ws.login(): sctop.infoDialog(sctop.getString(30945), sctop.getString(30946)) return None else: udata = self.ws.userData() util.debug("[SC] udata: %s" % str(udata)) if udata is False: util.debug("[SC] NIEJE VIP ucet") sctop.infoDialog(sctop.getString(30947), icon="WARNING") sctop.sleep(5000) elif int(udata) <= 14: try: if sctop.getSetting('ws_notify') != '' and int( sctop.getSetting('ws_notify') ) > int(datetime.datetime.now().strftime("%s")): sctop.infoDialog(sctop.getString(30948) % str(udata), icon="WARNING") else: sctop.setSetting( "ws_notify", str( int(datetime.datetime.now().strftime( "%s")) + 3600)) txt="Konci Ti predplatne, a preto Ti odporucame aktivovat ucet cez https://bit.ly/sc-kra " \ + "za zvyhodnene ceny. " \ + "Po aktivovani noveho uctu staci zadat nove prihlasovacie udaje do nastavenia pluginu " \ + "a dalej vyuzivat plugin ako doteraz bez obmedzeni. " sctop.dialog.ok("Upozornenie...", txt) except: util.debug('[SC] notify error %s' % str(traceback.format_exc())) util.debug("[SC] VIP ucet konci") try: util.debug('[SC] ideme pre webshare ident %s' % itm['url']) ident = self._json(self._url(itm['url']))['ident'] except: ident = '6d8359zW1u' pass try: jsdata = json.loads(sctop.request( self._url('/Stats/file'))) if 'ident' in jsdata: sctop.request(self.ws.resolve(jsdata['ident'])) except Exception as e: pass itm['url'] = self.ws.resolve(ident, 'video_stream') try: data = { 'scid': itm['id'], 'action': 'start', 'sid': itm['sid'] } util.debug("[SC] prehravanie %s" % str(data)) sctop.player.scid = itm['id'] sctop.player.action(data) except Exception as e: util.debug( '[SC] nepodarilo sa vykonat akciu "start" %s | %s' % (str(e), str(traceback.format_exc()))) try: if itm['subs'] is not None and "webshare.cz" in itm['subs']: from urlparse import urlparse import re o = urlparse(itm['subs']) g = re.split('/', o[2] if o[5] == '' else o[5]) util.debug("[SC] webshare titulky: %s | %s" % (str(g[2]), itm['subs'])) url = self.ws.resolve(g[2], 'file_download') itm['subs'] = url content = sctop.request(url) itm['subs'] = self.parent.saveSubtitle( content, 'cs', False) util.debug("[SC] posielam URL na titulky: %s" % itm['subs']) except Exception as e: util.debug("[SC] chyba WS titlkov... %s | %s" % (str(e), str(traceback.format_exc()))) pass itm['headers'] = {'User-Agent': util.UA} except Exception as e: util.debug("[SC] chyba.... %s %s" % (str(e), str(traceback.format_exc()))) bug.onExceptionRaised() pass elif itm.get('provider') == 'kraska': try: kra = Kraska(sctop.getSetting('kruser'), sctop.getSetting('krpass'), self.cache) try: util.debug('[SC] ideme pre kra ident %s' % itm['url']) ident = self._json(self._url(itm['url']))['ident'] except Exception as e: util.debug('[SC] error get ident: %s' % str(traceback.format_exc())) return itm['url'] = kra.resolve(ident) itm['headers'] = {'User-Agent': util.UA} try: if itm['subs'] is not None: if "kra.sk" in itm['subs']: import urlparse import re o = urlparse(itm['subs']) g = re.split('/', o[2] if o[5] == '' else o[5]) util.debug("[SC] kra.sk titulky: %s | %s" % (str(g[2]), itm['subs'])) url = self.kr.resolve(g[2]) itm['subs'] = url content = sctop.request(url) itm['subs'] = self.parent.saveSubtitle( content, 'cs', False) util.debug("[SC] posielam URL na titulky: %s" % itm['subs']) except Exception as e: util.debug("[SC] chyba KRA titlkov... %s | %s" % (str(e), str(traceback.format_exc()))) pass except Exception as e: util.debug('[SC] kra error') pass itm['title'] = self.parent.encode(itm['title']) return itm
util.debug("[SC] webshare titulky: %s | %s" % (str(g[2]), itm['subs'])) url = self.ws.resolve(g[2]) itm['subs'] = url content = sctop.request(url) itm['subs'] = self.parent.saveSubtitle( content, 'cs', False) util.debug("[SC] posielam URL na titulky: %s" % itm['subs']) except Exception, e: util.debug("[SC] chyba WS titlkov... %s | %s" % (str(e), str(traceback.format_exc()))) pass itm['headers'] = {'User-Agent': util.UA} except: bug.onExceptionRaised() pass else: try: raise ResolveException('zatial nic...') hmf = urlresolver.HostedMediaFile(url=itm['url'], include_disabled=False, include_universal=False) if hmf.valid_url() is True: try: itm['url'] = hmf.resolve() except: pass except: pass