def traktHiddenManager(self, idx=True): control.busy() try: if trakt.getActivity() > cache.timeout(self.trakt_list, self.progress_link, self.trakt_user): raise Exception() self.list = cache.get(self.trakt_list, 24, self.progress_link, self.trakt_user) except: self.list = cache.get(self.trakt_list, 0, self.progress_link, self.trakt_user) try: hidden = cache.get(trakt.getTrakt, 0, self.hiddenprogress_link) # if this gets cached and user hides an item it's not instantly removed. hidden = jsloads(hidden) hidden = [str(i['show']['ids']['tvdb']) for i in hidden] for i in self.list: i.update({'isHidden': 'true'}) if i['tvdb'] in hidden else i.update({'isHidden': ''}) if idx: self.worker() self.list = sorted(self.list, key=lambda k: re.sub(r'(^the |^a |^an )', '', k['tvshowtitle'].lower()), reverse=False) self.list = sorted(self.list, key=lambda k: k['isHidden'], reverse=True) control.hide() from resources.lib.windows.trakthidden_manager import TraktHiddenManagerXML window = TraktHiddenManagerXML('trakthidden_manager.xml', control.addonPath(control.addonId()), results=self.list) chosen_hide, chosen_unhide = window.run() del window if chosen_unhide: success = trakt.unHideItems(chosen_unhide) if success: control.notification(title='Trakt Hidden Progress Manager', message='Successfully Unhid %s Item%s' % (len(chosen_unhide), 's' if len(chosen_unhide) >1 else '')) if chosen_hide: success = trakt.hideItems(chosen_hide) if success: control.notification(title='Trakt Hidden Progress Manager', message='Successfully Hid %s Item%s' % (len(chosen_hide), 's' if len(chosen_hide) >1 else '')) except: from resources.lib.modules import log_utils log_utils.error()
def load_uncachedTorrents(self): try: from resources.lib.windows.uncached_results import UncachedResultsXML from resources.lib.modules.control import addonPath, addonId window = UncachedResultsXML('uncached_results.xml', addonPath(addonId()), uncached=self.uncached, meta=self.meta) window.run() except: from resources.lib.modules import log_utils log_utils.error()
def show_stillwatching_xml(self): try: next_meta = self.getNext_meta() if not next_meta: raise Exception() from resources.lib.windows.playnext_stillwatching import StillWatchingXML window = StillWatchingXML('playnext_stillwatching.xml', control.addonPath(control.addonId()), meta=next_meta) window.run() del window self.play_next_triggered = True except: log_utils.error() self.play_next_triggered = True
def get(file): venom_path = addonPath(addonId()) venom_version = getVenomVersion() helpFile = joinPath(venom_path, 'resources', 'help', file + '.txt') r = open(helpFile) text = r.read() r.close() heading = '[B]Venom - v%s - %s[/B]' % (venom_version, file) windows = TextViewerXML('textviewer.xml', venom_path, heading=heading, text=text) windows.run() del windows
def get(file): venom_path = addonPath(addonId()) venom_version = getVenomVersion() helpFile = joinPath(venom_path, 'resources', 'help', file + '.txt') f = open(helpFile, 'r', encoding='utf-8', errors='ignore') text = f.read() f.close() heading = '[B]Venom - v%s - %s[/B]' % (venom_version, file) windows = TextViewerXML('textviewer.xml', venom_path, heading=heading, text=text) windows.run() del windows
def get(): venom_path = addonPath(addonId()) venom_version = getVenomVersion() changelogfile = joinPath(venom_path, 'changelog.txt') r = open(changelogfile) text = r.read() r.close() heading = '[B]Venom - v%s - ChangeLog[/B]' % venom_version windows = TextViewerXML('textviewer.xml', venom_path, heading=heading, text=text) windows.run() del windows
def account_info_to_dialog(self): if not self.api_key: return from resources.lib.windows.textviewer import TextViewerXML try: control.busy() url = (self.base_link + self.account_info_link % (self.api_key)) account_info = requests.get(url, timeout=20).json() if not account_info: control.hide() return control.notification(message=32221, icon=en_icon) account_type = account_info['premium']['name'] month_time_left = float(account_info['premium']['bw_month_time_left']) / 60 / 60 / 24 try: total_time_left = float(account_info['premium']['time_left']) / 60 / 60 / 24 except: total_time_left = '' try: renewal_date = account_info['premium']['to_dt'] except: renewal_date = '' try: is_not_last_month = account_info['premium']['is_not_last_month'] except: is_not_last_month = '' try: bw_used_month = float(account_info['premium']['bw_used_month']) / 1073741824 except: bw_used_month = '' try: bw_limit_month = float(account_info['premium']['bw_limit_month']) / 1073741824 except: bw_limit_month = '' try: rem_bw_limit_month = bw_limit_month - bw_used_month except: rem_bw_limit_month = '' body = [] append = body.append append(getLS(32489) % account_type.upper()) # Account append(getLS(32490) % str(round(bw_limit_month, 0))) # Monthly Limit append(getLS(32491)) # Current Month append(' - %s' % getLS(32492) % str(round(month_time_left, 2))) # Days Remaining append(' - %s GB' % getLS(32493) % str(round(bw_used_month, 2))) # Data Used append(' - %s GB' % getLS(32494) % str(round(rem_bw_limit_month, 2))) # Data Remaining if not account_type == 'LIFETIME': append(getLS(32495)) # Current Subscription append('[B] - %s' % getLS(32492) % str(round(total_time_left, 0))) # Days Remaining if is_not_last_month == '1': append(' - %s' % getLS(32496) % renewal_date) # Resets On else: append(' - %s' % getLS(32497) % renewal_date) # Renewal Needed On control.hide() windows = TextViewerXML('textviewer.xml', control.addonPath(control.addonId()), heading='[B]FURK[/B]', text='\n\n'.join(body)) windows.run() del windows except: from resources.lib.modules import log_utils log_utils.error()
def account_info_to_dialog(self): from datetime import datetime import time from resources.lib.windows.textviewer import TextViewerXML try: control.busy() account_info, usage_info = self.account() if not account_info or not usage_info: control.hide() return control.notification(message=32221, icon=en_icon) expires = datetime.fromtimestamp( time.mktime(time.strptime(account_info[2], '%Y-%m-%d'))) days_remaining = (expires - datetime.today()).days expires = expires.strftime('%Y-%m-%d') body = [] append = body.append append(getLS(40036) % account_info[0]) # Username append(getLS(40066) % account_info[1]) # Plan append(getLS(40037) % account_info[3]) # Status append(getLS(40041) % expires) # Expires append(getLS(40042) % days_remaining) # Days Remaining append(getLS(32218) % usage_info[2]) # Loyalty append(getLS(32219) % usage_info[0].replace('Gigs', 'GB')) # Data Used append( getLS(32220) % re.sub(r'[</].+?>', '', usage_info[1].replace( 'Gigs', 'GB'))) # Data Remaining control.hide() windows = TextViewerXML('textviewer.xml', control.addonPath(control.addonId()), heading='[B]EasyNews[/B]', text='\n\n'.join(body)) windows.run() del windows except: from resources.lib.modules import log_utils log_utils.error() control.hide()
# -*- coding: utf-8 -*- """ Venom Add-on """ from resources.lib.modules import control venom_path = control.addonPath(control.addonId()) venom_version = control.getVenomVersion() changelogfile = control.joinPath(venom_path, 'changelog.txt') def get(): r = open(changelogfile) text = r.read() r.close() control.dialog.textviewer( '[COLOR red]Venom[/COLOR] - v%s - ChangeLog' % venom_version, text)
# -*- coding: utf-8 -*- """ Venom Add-on """ from urllib.request import urlopen, Request from resources.lib.modules.control import addonPath, addonId, joinPath from resources.lib.windows.textviewer import TextViewerXML venom_path = addonPath(addonId()) news_file = 'https://raw.githubusercontent.com/123Venom/plugin.video.venom/matrix/newsinfo.txt' local_news = joinPath(venom_path, 'newsinfo.txt') def news(): message = open_news_url(news_file) compfile = open(local_news).read() if len(message) > 1: if compfile == message: pass else: text_file = open(local_news, "wb") text_file.write(message) text_file.close() compfile = message showText('[B]News and Info[/B]', compfile) def open_news_url(url): req = Request(url) req.add_header('User-Agent', 'klopp') response = urlopen(req)
# -*- coding: utf-8 -*- """ Venom Add-on """ from resources.lib.modules import control venom_path = control.addonPath(control.addonId()) venom_version = control.addonVersion(control.addonId()) changelogfile = control.joinPath(venom_path, 'changelog.txt') def get(): r = open(changelogfile) text = r.read() r.close() control.dialog.textviewer( '[COLOR red]Venom[/COLOR] - v%s - %s' % (venom_version, 'changelog.txt'), text)
# -*- coding: utf-8 -*- """ dg Add-on """ from urllib.request import urlopen, Request from resources.lib.modules.control import addonPath, addonId, joinPath from resources.lib.windows.textviewer import TextViewerXML dg_path = addonPath(addonId()) news_file = 'https://raw.githubusercontent.com/deangrice07/dg.github.io/master/Matrix/wiz/newsinfo.txt' local_news = joinPath(dg_path, 'newsinfo.txt') def news(): message = open_news_url(news_file) compfile = open(local_news).read() if len(message) > 1: if compfile == message: pass else: text_file = open(local_news, "wb") text_file.write(message) text_file.close() compfile = message showText('[B]News and Info[/B]', compfile) def open_news_url(url): req = Request(url) req.add_header('User-Agent', 'klopp') response = urlopen(req)
# -*- coding: utf-8 -*- """ Kraken Add-on """ from resources.lib.modules import control kraken_path = control.addonPath(control.addonId()) kraken_version = control.addonVersion(control.addonId()) def get(file): helpFile = control.joinPath(kraken_path, 'resources', 'help', file + '.txt') r = open(helpFile) text = r.read() r.close() control.dialog.textviewer( '[COLOR red]Kraken[/COLOR] - v%s - %s' % (kraken_version, file), text)
def show_stillwatching_xml(self): from resources.lib.windows.playnext_stillwatching import StillWatchingXML window = StillWatchingXML('playnext_stillwatching.xml', control.addonPath(control.addonId()), meta=self.getNext_meta()) window.run() del window self.play_next_triggered = True
def show_playnext_xml(self): from resources.lib.windows.playnext import PlayNextXML window = PlayNextXML('playnext.xml', control.addonPath(control.addonId()), meta=self.getNext_meta()) window.run() del window self.play_next_triggered = True