def _showEasyNews(self): choice = self._option(33948, 33897, 33898) if choice == Wizard.ChoiceLeft: return Wizard.OptionCancelStep choice = self._option(33949, 33899, 33900) if choice == Wizard.ChoiceLeft: tools.System.openLink(tools.Settings.getString('link.easynews', raw = True)) choice = self._option(33988, 33743, 33898) if choice == Wizard.ChoiceLeft: return self._cancel() user = userOriginal = tools.Settings.getString('accounts.debrid.easynews.user') password = passwordOriginal = tools.Settings.getString('accounts.debrid.easynews.pass') while True: choice = self._option(33950, 33743, 33994) if choice == Wizard.ChoiceLeft: return self._cancel() user = self._input(default = user) choice = self._option(33951, 33743, 33995) if choice == Wizard.ChoiceLeft: return self._cancel() password = self._input(default = password) interface.Loader.show() tools.Settings.set('accounts.debrid.easynews.enabled', True) tools.Settings.set('accounts.debrid.easynews.user', user) tools.Settings.set('accounts.debrid.easynews.pass', password) valid = debrid.EasyNews().accountVerify() interface.Loader.hide() if valid: tools.Settings.set('providers.universal.premium.member.easynews', True) choice = self._option(33953, 33743, 33821) if choice == Wizard.ChoiceLeft: return self._cancel() return Wizard.OptionContinue else: tools.Settings.set('accounts.debrid.easynews.enabled', False) tools.Settings.set('accounts.debrid.easynews.user', userOriginal) tools.Settings.set('accounts.debrid.easynews.pass', passwordOriginal) choice = self._option(33991, 33743, 33902) if choice == Wizard.ChoiceLeft: return self._cancel() return Wizard.OptionContinue
def _verifyAccountsEasynews(self, checkDisabled=True): name = 'EasyNews' if self.__done(name): return try: if not checkDisabled or self.__enabled( 'accounts.debrid.easynews.enabled'): if debrid.EasyNews().accountVerify(): status = Verification.StatusOperational else: status = Verification.StatusFailure else: status = Verification.StatusDisabled except: status = Verification.StatusFailure return self.__append(name=name, status=status)
def popup(self, time = 2000, wait = True): try: from resources.lib.extensions import debrid versionCurrent = tools.System.version() version = tools.Settings.getString('general.launch.splash.previous') tools.Settings.set('general.launch.splash.previous', versionCurrent) # Popup on every minor version update, if and only if the user has now premiumi account already. special = not versionCurrent == version and versionCurrent.endswith('.0') special = special and not debrid.Premiumize().accountValid() special = special and not debrid.RealDebrid().accountValid() special = special and not debrid.EasyNews().accountValid() if version == None or version == '' or special: self.popupFull(wait = wait) return True elif tools.Settings.getBoolean('general.launch.splash'): self.popupMini(time = time) # Do not wait on the mini splash. return True except: pass return False
def sources(self, url, hostDict, hostprDict): sources = [] try: if url == None: raise Exception() easynews = debrid.EasyNews() if not easynews.accountValid(): raise Exception() cookie = easynews.accountCookie() data = urlparse.parse_qs(url) data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data]) if 'exact' in data and data['exact']: query = title = data[ 'tvshowtitle'] if 'tvshowtitle' in data else data['title'] year = None season = None episode = None pack = False packCount = None else: movie = not 'tvshowtitle' in data title = data['title'] if movie else data['tvshowtitle'] year = int( data['year'] ) if 'year' in data and not data['year'] == None else None season = int( data['season'] ) if 'season' in data and not data['season'] == None else None episode = int( data['episode']) if 'episode' in data and not data[ 'episode'] == None else None if movie: query = '%s %d' % (title, year) else: query = '%s S%02dE%02d' % (title, season, episode) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query) query = urllib.quote_plus(query) query = self.search_link % (query, query) query = urlparse.urljoin(self.base_link, query) results = [] data = client.request(query, cookie=cookie) data = json.loads(data) results += data['data'] # EasyNews often does not return all the results on search. # Try a second time and combine the results. data = client.request(query, cookie=cookie) data = json.loads(data) results += data['data'] links = [] for result in results: try: jsonName = result['10'] try: jsonSize = result['rawSize'] except: jsonSize = result['4'] jsonExtension = result['2'].replace('.', '') try: jsonLanguage = tools.Language.code(result['alangs'][0]) if jsonLanguage == None: raise Exception() except: jsonLanguage = self.language[0] jsonPassword = result['passwd'] jsonVirus = result['virus'] jsonDuration = result['14'] jsonAudio = result['18'] if not jsonAudio == None: jsonName += ' ' + jsonAudio jsonVideo = result['12'] if not jsonVideo == None: jsonName += ' ' + jsonVideo try: jsonWidth = int(result['width']) except: jsonWidth = 0 try: jsonHeight = int(result['height']) except: jsonHeight = 0 if jsonWidth == 0 and jsonHeight == 0: jsonQuality = meta.videoQuality() else: jsonQuality = metadata.Metadata.videoResolutionQuality( width=jsonWidth, height=jsonHeight) jsonLink = urllib.quote( '%s%s/%s%s' % (result['0'], result['11'], result['10'], result['11'])) jsonLink = '%s/dl/%s|Cookie=%s' % ( self.base_link, jsonLink, urllib.quote_plus(cookie)) jsonLink = jsonLink.encode('utf-8') if jsonLink in links: continue # Metadata meta = metadata.Metadata(name=jsonName, title=title, year=year, season=season, episode=episode, link=jsonLink, size=jsonSize, quality=jsonQuality) # Ignore if meta.ignore(False): continue if jsonPassword or jsonVirus: continue if jsonDuration.lower().startswith( ('0m', '1m', '2m', '3m', '4m')): continue # Add sources.append({ 'url': jsonLink, 'premium': True, 'debridonly': False, 'direct': True, 'memberonly': True, 'source': 'EasyNews', 'language': jsonLanguage, 'quality': meta.videoQuality(), 'metadata': meta, 'file': jsonName }) links.append(jsonLink) except: pass return sources except: return sources
def instanceEnabled(self): easynews = debrid.EasyNews() return easynews.accountEnabled() and easynews.accountValid()
#################################################### # EASYNEWS #################################################### elif action == 'easynewsNavigator': from resources.lib.indexers import navigator navigator.navigator(type = type, kids = kids).easynewsNavigator() elif action == 'easynewsAccount': from resources.lib.extensions import debrid debrid.EasyNewsInterface().account() elif action == 'easynewsWebsite': from resources.lib.extensions import debrid debrid.EasyNews().website(open = True) elif action == 'easynewsVpn': from resources.lib.extensions import debrid debrid.EasyNews().vpn(open = True) elif action == 'easynewsSettings': from resources.lib.extensions import tools tools.Settings.launch(category = tools.Settings.CategoryAccounts) #################################################### # QUASAR #################################################### elif action == 'quasarNavigator': from resources.lib.indexers import navigator
def _showAccounts(self, first = True): if first: choice = self._option(35288, 33743, 33821) if choice == Wizard.ChoiceLeft: return self._cancel() orion = orionoid.Orionoid() enabled = interface.Format.fontBold(interface.Format.fontColor(interface.Translation.string(32301), interface.Format.ColorExcellent)) disabled = interface.Format.fontBold(interface.Format.fontColor(interface.Translation.string(32302), interface.Format.ColorBad)) special = interface.Translation.string(33105) premium = interface.Translation.string(33768) provider = interface.Translation.string(33681) general = interface.Translation.string(32310) items = [ interface.Format.fontBold(interface.Translation.string(33821)), interface.Format.fontBold('[' + special + '] ' + interface.Translation.string(35400) + ': ') + (enabled if orion.accountValid() else disabled), interface.Format.fontBold('[' + general + '] ' + interface.Translation.string(32315) + ': ') + (enabled if tools.Settings.getBoolean('accounts.informants.trakt.enabled') else disabled), interface.Format.fontBold('[' + general + '] ' + interface.Translation.string(32034) + ': ') + (enabled if tools.Settings.getBoolean('accounts.informants.imdb.enabled') else disabled), interface.Format.fontBold('[' + general + '] ' + interface.Translation.string(35260) + ': ') + (enabled if tools.Settings.getBoolean('accounts.artwork.fanart.enabled') else disabled), interface.Format.fontBold('[' + premium + '] ' + interface.Translation.string(33566) + ': ') + (enabled if debrid.Premiumize().accountValid() else disabled), interface.Format.fontBold('[' + premium + '] ' + interface.Translation.string(35200) + ': ') + (enabled if debrid.OffCloud().accountValid() else disabled), interface.Format.fontBold('[' + premium + '] ' + interface.Translation.string(33567) + ': ') + (enabled if debrid.RealDebrid().accountValid() else disabled), interface.Format.fontBold('[' + premium + '] ' + interface.Translation.string(33794) + ': ') + (enabled if debrid.EasyNews().accountValid() else disabled), interface.Format.fontBold('[' + premium + '] ' + interface.Translation.string(33568) + ': ') + (enabled if debrid.AllDebrid().accountValid() else disabled), interface.Format.fontBold('[' + premium + '] ' + interface.Translation.string(33569) + ': ') + (enabled if debrid.RapidPremium().accountValid() else disabled), ] choice = interface.Dialog.options(title = 32346, items = items) if choice < 0: return self._cancel() if choice == 0: return Wizard.OptionContinue elif choice == 1: if self._showOrion() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard elif choice == 2: if self._showTrakt() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard elif choice == 3: if self._showImdb() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard elif choice == 4: if self._showFanart() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard elif choice == 5: if self._showPremiumize() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard elif choice == 6: if self._showOffCloud() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard elif choice == 7: if self._showRealDebrid() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard elif choice == 8: if self._showEasyNews() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard elif choice == 9: if self._showAllDebrid() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard elif choice == 10: if self._showRapidPremium() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard return self._showAccounts(first = False)