def toggle_cache(state): cachelist = [ 'includevideo', 'includeall', 'includeexodusredux', 'includegaia', 'includenumbers', 'includescrubs', 'includeseren', 'includethecrew', 'includevenom' ] titlelist = [ 'Include Video Addons', 'Include All Addons', 'Include Exodus Redux', 'Include Gaia', 'Include NuMb3r5', 'Include Scrubs v2', 'Include Seren', 'Include THE CREW', 'Include Venom' ] if state in ['true', 'false']: for item in cachelist: CONFIG.set_setting(item, state) else: if state not in ['includevideo', 'includeall' ] and CONFIG.get_setting('includeall') == 'true': try: dialog = xbmcgui.Dialog() item = titlelist[cachelist.index(state)] dialog.ok( CONFIG.ADDONTITLE, "[COLOR {0}]You will need to turn off [COLOR {1}]Include All Addons[/COLOR] to disable[/COLOR] [COLOR {2}]{3}[/COLOR]" .format(CONFIG.COLOR2, CONFIG.COLOR1, CONFIG.COLOR1, item)) except: logging.log_notify( "[COLOR {0}]Toggle Cache[/COLOR]".format(CONFIG.COLOR1), "[COLOR {0}]Invalid Add-on ID: {1}[/COLOR]".format( CONFIG.COLOR2, state)) else: new = 'true' if CONFIG.get_setting(state) == 'false' else 'false' CONFIG.set_setting(state, new)
def set_view(): auto_view = CONFIG.get_setting('auto-view') if auto_view == 'true': view_type = CONFIG.get_setting('viewType') xbmc.executebuiltin("Container.SetViewMode({0})".format(view_type))
def inputurl(name): if name == 'buildlink': keyboardHandle = xbmc.Keyboard( CONFIG.get_setting('buildlink'), '[COLOR yellow]Nhập link chứa list Build của bạn: (hỗ trợ bit.ly, gg.gg)[/COLOR]\n[I](Xem cách tạo list tại https://hieuit.net/hieuitwizard)[/I]' ) elif name == 'datalink': keyboardHandle = xbmc.Keyboard( CONFIG.get_setting('datalink'), '[COLOR yellow]Nhập link chứa list Datafile của bạn: (hỗ trợ bit.ly, gg.gg)[/COLOR]\n[I](Xem cách tạo list tại https://hieuit.net/hieuitwizard)[/I]' ) keyboardHandle.doModal() if (keyboardHandle.isConfirmed()): queryText = keyboardHandle.getText() if len(queryText) == 0: sys.exit() else: working = _check_url(queryText, cred=None) if not working == True: dialog = xbmcgui.Dialog() dialog.ok(CONFIG.ADDONTITLE, 'Sai URL\nVui lòng nhập lại') inputurl(name) else: # link = name CONFIG.set_setting(name, queryText)
def reload_fix(default=None): from resources.libs import db from resources.libs.common import logging from resources.libs import skin from resources.libs import update dialog = xbmcgui.Dialog() dialog.ok( CONFIG.ADDONTITLE, "[COLOR red]ADVERTENCIA:[/COLOR] [COLOR {0}] A veces, Recargando el Perfil hace que Kodi se bloquee. Mientras Kodi está Recargando el Perfil, Por Favor No Presione Ningún Botón![/COLOR]" .format(CONFIG.COLOR2)) if not os.path.exists(CONFIG.PACKAGES): os.makedirs(CONFIG.PACKAGES) if default is None: skin.look_and_feel_data('save') redo_thumbs() xbmc.executebuiltin('ActivateWindow(Home)') reload_profile() xbmc.sleep(10000) if CONFIG.KODIV >= 17: db.kodi_17_fix() if default is None: logging.log("Switching to: {0}".format( CONFIG.get_setting('defaultskin'))) gotoskin = CONFIG.get_setting('defaultskin') skin.switch_to_skin(gotoskin) skin.look_and_feel_data('restore') update.addon_updates('reset') update.force_update() xbmc.executebuiltin("ReloadSkin()")
def reload_fix(default=None): from resources.libs import db from resources.libs.common import logging from resources.libs import skin from resources.libs import update dialog = xbmcgui.Dialog() dialog.ok( CONFIG.ADDONTITLE, "[COLOR {0}]AVISO: Às vezes, recarregar o perfil causa o travamento do Kodi. Enquanto Kodi estiver recarregando o perfil, não pressione nenhum botão![/COLOR]" .format(CONFIG.COLOR2)) if not os.path.exists(CONFIG.PACKAGES): os.makedirs(CONFIG.PACKAGES) if default is None: skin.look_and_feel_data('save') redo_thumbs() xbmc.executebuiltin('ActivateWindow(Home)') reload_profile() xbmc.sleep(10000) if CONFIG.KODIV >= 17: db.kodi_17_fix() if default is None: logging.log("Switching to: {0}".format( CONFIG.get_setting('defaultskin'))) gotoskin = CONFIG.get_setting('defaultskin') skin.switch_to_skin(gotoskin) skin.look_and_feel_data('restore') update.addon_updates('reset') update.force_update() xbmc.executebuiltin("ReloadSkin()")
def reload_fix(default=None): from resources.libs import db from resources.libs.common import logging from resources.libs import skin from resources.libs import update dialog = xbmcgui.Dialog() dialog.ok(CONFIG.ADDONTITLE, "[COLOR {0}]WARNING: Sometimes Reloading the Profile causes Kodi to crash. While Kodi is Reloading the Profile Please Do Not Press Any Buttons![/COLOR]".format(CONFIG.COLOR2)) if not os.path.exists(CONFIG.PACKAGES): os.makedirs(CONFIG.PACKAGES) if default is None: skin.look_and_feel_data('save') redo_thumbs() xbmc.executebuiltin('ActivateWindow(Home)') reload_profile() xbmc.sleep(10000) if CONFIG.KODIV >= 17: db.kodi_17_fix() if default is None: logging.log("Switching to: {0}".format(CONFIG.get_setting('defaultskin'))) gotoskin = CONFIG.get_setting('defaultskin') skin.switch_to_skin(gotoskin) skin.look_and_feel_data('restore') update.addon_updates('reset') update.force_update() xbmc.executebuiltin("ReloadSkin()")
def stop_if_duplicate(): NOW = datetime.now() temp = CONFIG.get_setting('time_started') if not temp == '': if temp > str(NOW - timedelta(minutes=2)): logging.log("Killing Start Up Script") sys.exit() logging.log("{0}".format(NOW)) CONFIG.set_setting('time_started', str(NOW)) xbmc.sleep(1000) if not CONFIG.get_setting('time_started') == str(NOW): logging.log("Killing Start Up Script") sys.exit() else: logging.log("Continuing Start Up Script")
def addon_updates(do=None): setting = '"general.addonupdates"' if do == 'set': query = '{{"jsonrpc":"2.0", "method":"Settings.GetSettingValue","params":{{"setting":{0}}}, "id":1}}'.format( setting) response = xbmc.executeJSONRPC(query) match = re.compile('{"value":(.+?)}').findall(response) if len(match) > 0: default = match[0] else: default = 0 CONFIG.set_setting('default.addonupdate', str(default)) query = '{{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{{"setting":{0},"value":{1}}}, "id":1}}'.format( setting, '2') response = xbmc.executeJSONRPC(query) elif do == 'reset': try: value = int(float(CONFIG.get_setting('default.addonupdate'))) except: value = 0 if value not in [0, 1, 2]: value = 0 query = '{{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{{"setting":{0},"value":{1}}}, "id":1}}'.format( setting, value) response = xbmc.executeJSONRPC(query)
def look_and_feel_data(do='save'): from resources.libs.common import logging scan = [ 'lookandfeel.enablerssfeeds', 'lookandfeel.font', 'lookandfeel.rssedit', 'lookandfeel.skincolors', 'lookandfeel.skintheme', 'lookandfeel.skinzoom', 'lookandfeel.soundskin', 'lookandfeel.startupwindow', 'lookandfeel.stereostrength' ] if do == 'save': for item in scan: query = '{{"jsonrpc":"2.0", "method":"Settings.GetSettingValue","params":{{"setting":"{0}"}}, "id":1}}'.format( item) response = xbmc.executeJSONRPC(query) if 'error' not in response: match = re.compile('{"value":(.+?)}').findall(str(response)) CONFIG.set_setting(item.replace('lookandfeel', 'default'), match[0]) logging.log("%s saved to %s" % (item, match[0])) else: for item in scan: value = CONFIG.get_setting(item.replace('lookandfeel', 'default')) query = '{{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{{"setting":"{0}","value":{1}}}, "id":1}}'.format( item, value) response = xbmc.executeJSONRPC(query) logging.log("{0} restored to {1}".format(item, value))
def do_dismiss(self): from resources.libs.common import logging if not test: CONFIG.set_setting("notedismiss", "true") logging.log("[Notification] NotifyID {0} Dismissed".format(CONFIG.get_setting('noteid')), level=xbmc.LOGNOTICE) self.close()
def auto_update(who): if who == 'all': for log in DEBRIDID: if os.path.exists(DEBRIDID[log]['path']): auto_update(log) elif DEBRIDID[who]: if os.path.exists(DEBRIDID[who]['path']): u = debrid_user(who) su = CONFIG.get_setting(DEBRIDID[who]['saved']) n = DEBRIDID[who]['name'] if not u or u == '': return elif su == '': debrid_it('update', who) elif not u == su: dialog = xbmcgui.Dialog() if dialog.yesno( CONFIG.ADDONTITLE, "Would you like to save the [COLOR {0}]Debrid Info[/COLOR] for [COLOR {1}]{2}[/COLOR]?" .format(CONFIG.COLOR2, CONFIG.COLOR1, n), "Addon: [COLOR springgreen][B]{0}[/B][/COLOR]".format( u), "Saved:[/COLOR] [COLOR red][B]{0}[/B][/COLOR]".format( su) if not su == '' else 'Saved:[/COLOR] [COLOR red][B]None[/B][/COLOR]', yeslabel="[B][COLOR springreen]Save Debrid[/COLOR][/B]", nolabel="[B][COLOR red]No, Cancel[/COLOR][/B]"): debrid_it('update', who) else: debrid_it('update', who)
def auto_update(who): if who == 'all': for log in DEBRIDID: if os.path.exists(DEBRIDID[log]['path']): auto_update(log) elif DEBRIDID[who]: if os.path.exists(DEBRIDID[who]['path']): u = debrid_user(who) su = CONFIG.get_setting(DEBRIDID[who]['saved']) n = DEBRIDID[who]['name'] if not u or u == '': return elif su == '': debrid_it('update', who) elif not u == su: dialog = xbmcgui.Dialog() if dialog.yesno( CONFIG.ADDONTITLE, "Le gustaría salvar la [COLOR {0}]Info Debrid[/COLOR] para [COLOR {1}]{2}[/COLOR]?" .format(CONFIG.COLOR2, CONFIG.COLOR1, n) + '\n' + "Addon: [COLOR springgreen][B]{0}[/B][/COLOR]".format( u) + '\n' + "Salvado:[/COLOR] [COLOR red][B]{0}[/B][/COLOR]". format(su) if not su == '' else 'Salvado:[/COLOR] [COLOR red][B]Ninguno[/B][/COLOR]', yeslabel= "[B][COLOR springreen]Salvar Debrid[/COLOR][/B]", nolabel="[B][COLOR red]No, Cancelar[/COLOR][/B]"): debrid_it('update', who) else: debrid_it('update', who)
def import_list(who): if who == 'all': for log in DEBRIDID: if os.path.exists(DEBRIDID[log]['file']): import_list(log) elif DEBRIDID[who]: if os.path.exists(DEBRIDID[who]['file']): file = DEBRIDID[who]['file'] addonid = tools.get_addon_by_id(DEBRIDID[who]['plugin']) saved = DEBRIDID[who]['saved'] default = DEBRIDID[who]['default'] suser = CONFIG.get_setting(saved) name = DEBRIDID[who]['name'] tree = ElementTree.parse(file) root = tree.getroot() for setting in root.findall('debrid'): id = setting.find('id').text value = setting.find('value').text addonid.setSetting(id, value) logging.log_notify( "[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, name), '[COLOR {0}]Debrid Info: Imported![/COLOR]'.format( CONFIG.COLOR2))
def auto_update(who): if who == 'all': for log in TRAKTID: if os.path.exists(TRAKTID[log]['path']): auto_update(log) elif TRAKTID[who]: if os.path.exists(TRAKTID[who]['path']): u = trakt_user(who) su = CONFIG.get_setting(TRAKTID[who]['saved']) n = TRAKTID[who]['name'] if not u or u == '': return elif su == '': trakt_it('update', who) elif not u == su: dialog = xbmcgui.Dialog() if dialog.yesno(CONFIG.ADDONTITLE, "[COLOR {0}]Would you like to save the [COLOR {1}]Trakt Data[/COLOR] for [COLOR {2}]{3}[/COLOR]?".format(CONFIG.COLOR2, CONFIG.COLOR1, CONFIG.COLOR1, n), "Addon: [COLOR springgreen][B]{0}[/B][/COLOR]".format(u), "Saved:[/COLOR] [COLOR red][B]{0}[/B][/COLOR]".format(su) if not su == '' else 'Saved:[/COLOR] [COLOR red][B]None[/B][/COLOR]', yeslabel="[B][COLOR springgreen]Save Data[/COLOR][/B]", nolabel="[B][COLOR red]No Cancel[/COLOR][/B]"): trakt_it('update', who) else: trakt_it('update', who)
def do_remind(self): if not test: CONFIG.set_setting('notedismiss', 'false') logging.log( '[Notifications] Notification {0} Remind Me Later'.format( CONFIG.get_setting('noteid'))) self.close()
def do_remind(self): if not test: CONFIG.set_setting("notedismiss", "false") logging.log("[Notification] NotifyID {0} Remind Me Later".format( CONFIG.get_setting('noteid')), level=xbmc.LOGNOTICE) self.close()
def onInit(self): self.title = 101 self.okbutton = 201 self.trakt = 301 self.debrid = 302 self.login = 303 self.sources = 304 self.profiles = 305 self.playercore = 314 self.advanced = 306 self.favourites = 307 self.superfav = 308 self.repo = 309 self.whitelist = 310 self.cache = 311 self.packages = 312 self.thumbs = 313 self.show_dialog() self.controllist = [self.trakt, self.debrid, self.login, self.sources, self.profiles, self.playercore, self.advanced, self.favourites, self.superfav, self.repo, self.whitelist, self.cache, self.packages, self.thumbs] self.controlsettings = ['keeptrakt', 'keepdebrid', 'keeplogin', 'keepsources', 'keepprofiles', 'keepplayercore', 'keepadvanced', 'keepfavourites', 'keeprepos', 'keepsuper', 'keepwhitelist', 'clearcache', 'clearpackages', 'clearthumbs'] for item in self.controllist: if CONFIG.get_setting(self.controlsettings[self.controllist.index(item)]) == 'true': self.getControl(item).setSelected(True)
def do_dismiss(self): if not test: CONFIG.set_setting('notedismiss', 'true') logging.log('[Notifications] Notification {0} Dismissed'.format( CONFIG.get_setting('noteid'))) self.close() if 57 - 57: i11iIiiIii.I1ii11iIi11i - Ii1I - oO0o + OoOoOO00
def gui(self, name, over=False): if name == CONFIG.get_setting('buildname'): if over: yes_pressed = 1 else: yes_pressed = self.dialog.yesno(CONFIG.ADDONTITLE, '[COLOR {0}]Would you like to apply the guifix for:'.format(CONFIG.COLOR2) + '\n' + '[COLOR {0}]{1}[/COLOR]?[/COLOR]'.format(CONFIG.COLOR1, name), nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]', yeslabel='[B][COLOR springgreen]Apply Fix[/COLOR][/B]') else: yes_pressed = self.dialog.yesno("{0} - [COLOR red]WARNING!![/COLOR]".format(CONFIG.ADDONTITLE), "[COLOR {0}][COLOR {1}]{2}[/COLOR] community build is not currently installed.".format(CONFIG.COLOR2, CONFIG.COLOR1, name) + '\n' + "Would you like to apply the guiFix anyways?.[/COLOR]", nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]', yeslabel='[B][COLOR springgreen]Apply Fix[/COLOR][/B]') if yes_pressed: guizip = check.check_build(name, 'gui') zipname = name.replace('\\', '').replace('/', '').replace(':', '').replace('*', '').replace('?', '').replace('"', '').replace('<', '').replace('>', '').replace('|', '') response = tools.open_url(guizip, check=True) if not response: logging.log_notify(CONFIG.ADDONTITLE, '[COLOR {0}]GuiFix: Invalid Zip Url![/COLOR]'.format(CONFIG.COLOR2)) return self.dialogProgress.create(CONFIG.ADDONTITLE, '[COLOR {0}][B]Downloading GuiFix:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR2, CONFIG.COLOR1, name), '', 'Please Wait') lib = os.path.join(CONFIG.PACKAGES, '{0}_guisettings.zip'.format(zipname)) try: os.remove(lib) except: pass Downloader().download(guizip, lib) xbmc.sleep(500) if os.path.getsize(lib) == 0: try: os.remove(lib) except: pass return title = '[COLOR {0}][B]Installing:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR2, CONFIG.COLOR1, name) self.dialogProgress.update(0, title + '\n' + 'Please Wait') extract.all(lib, CONFIG.USERDATA, title=title) self.dialogProgress.close() skin.skin_to_default('Build Install') skin.look_and_feel_data('save') installed = db.grab_addons(lib) db.addon_database(installed, 1, True) self.dialog.ok(CONFIG.ADDONTITLE, "[COLOR {0}]To save changes you now need to force close Kodi, Press OK to force close Kodi[/COLOR]".format(CONFIG.COLOR2)) tools.kill_kodi(over=True) else: logging.log_notify(CONFIG.ADDONTITLE, '[COLOR {0}]GuiFix: Cancelled![/COLOR]'.format(CONFIG.COLOR2))
def stop_if_duplicate(): NOW = time.time() temp = CONFIG.get_setting('time_started') if temp: if temp > NOW - (60 * 2): logging.log('Killing Start Up Script') sys.exit() logging.log("{0}".format(NOW)) CONFIG.set_setting('time_started', NOW) xbmc.sleep(1000) if not CONFIG.get_setting('time_started') == NOW: logging.log('Killing Start Up Script') sys.exit() else: logging.log('Continuing Start Up Script')
def check_data(name, ret): from resources.libs.common import tools if CONFIG.get_setting('choicelink') == 'true': response = tools.open_url(CONFIG.DATAFILE) elif CONFIG.get_setting('choicelink') == 'false': response = tools.open_url(CONFIG.CUSTOMLINK) if not response: return False link = response.text.replace('\n', '').replace('\r', '').replace('\t', '')\ .replace('gui=""', 'gui="http://"').replace('theme=""', 'theme="http://"') match = re.compile( 'name="%s".+?ersion="(.+?)".+?rl="(.+?)".+?inor="(.+?)".+?ui="(.+?)".+?odi="(.+?)".+?heme="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?review="(.+?)".+?dult="(.+?)".+?nfo="(.+?)".+?escription="(.+?)"' % name).findall(link) if len(match) > 0: for version, url, minor, gui, kodi, theme, icon, fanart, preview, adult, info, description in match: if ret == 'version': return version elif ret == 'url': return url elif ret == 'minor': return minor elif ret == 'gui': return gui if ret == 'kodi': return kodi elif ret == 'theme': return theme elif ret == 'icon': return icon elif ret == 'fanart': return fanart elif ret == 'preview': return preview elif ret == 'adult': return adult elif ret == 'description': return description elif ret == 'info': return info elif ret == 'all': return name, version, url, minor, gui, kodi, theme, icon, fanart, preview, adult, info, description else: return False
def save_login(): current_time = time.mktime( time.strptime(tools.get_date(formatted=True), "%Y-%m-%d %H:%M:%S")) next_save = time.mktime( time.strptime(CONFIG.get_setting('loginnextsave'), "%Y-%m-%d %H:%M:%S")) if next_save <= current_time: from resources.libs import loginit logging.log("[Login Info] Saving all Data", level=xbmc.LOGINFO) loginit.auto_update('all') CONFIG.set_setting('loginnextsave', tools.get_date(days=3, formatted=True)) else: logging.log( "[Login Info] Next Auto Save isn't until: {0} / TODAY is: {1}". format(CONFIG.get_setting('loginnextsave'), tools.get_date(formatted=True)), level=xbmc.LOGINFO)
def save_trakt(): current_time = time.mktime( time.strptime(tools.get_date(formatted=True), "%Y-%m-%d %H:%M:%S")) next_save = time.mktime( time.strptime(CONFIG.get_setting('traktnextsave'), "%Y-%m-%d %H:%M:%S")) if next_save <= current_time: from resources.libs import traktit logging.log("[Trakt Data] Guardar todos los datos", level=xbmc.LOGINFO) traktit.auto_update('all') CONFIG.set_setting('traktnextsave', tools.get_date(days=3, formatted=True)) else: logging.log( "[Trakt Data] Next Auto Save isn't until: {0} / TODAY is: {1}". format(CONFIG.get_setting('traktnextsave'), tools.get_date(formatted=True)), level=xbmc.LOGINFO)
def save_login(): current_time = time.mktime( time.strptime(tools.get_date(formatted=True), "%Y-%m-%d %H:%M:%S")) next_save = time.mktime( time.strptime(CONFIG.get_setting('loginnextsave'), "%Y-%m-%d %H:%M:%S")) if next_save <= current_time: from resources.libs import loginit logging.log("[Login Info] Guardar todos los datos", level=xbmc.LOGINFO) loginit.auto_update('all') CONFIG.set_setting('loginnextsave', tools.get_date(days=3, formatted=True)) else: logging.log( "[Login Info] El siguiente guardado automático no es hasta: {0} / hoy es: {1}" .format(CONFIG.get_setting('loginnextsave'), tools.get_date(formatted=True)), level=xbmc.LOGINFO)
def save_trakt(): if CONFIG.TRAKTSAVE <= str(tools.get_date()): from resources.libs import traktit logging.log("[Trakt Data] Saving all Data", level=xbmc.LOGNOTICE) traktit.auto_update('all') CONFIG.set_setting('traktlastsave', str(tools.get_date(days=3))) else: logging.log( "[Trakt Data] Next Auto Save isn't until: {0} / TODAY is: {1}". format(CONFIG.get_setting('traktlastsave'), str(tools.get_date())), level=xbmc.LOGNOTICE)
def save_login(): if CONFIG.LOGINSAVE <= str(tools.get_date()): from resources.libs import loginit logging.log("[Login Info] Saving all Data", level=xbmc.LOGNOTICE) loginit.auto_update('all') CONFIG.set_setting('loginlastsave', str(tools.get_date(days=3))) else: logging.log( "[Login Info] Next Auto Save isn't until: {0} / TODAY is: {1}". format(CONFIG.get_setting('loginlastsave'), str(tools.get_date())), level=xbmc.LOGNOTICE)
def save_debrid(): if CONFIG.DEBRIDSAVE <= str(tools.get_date()): from resources.libs import debridit logging.log("[Debrid Data] Saving all Data", level=xbmc.LOGNOTICE) debridit.auto_update('all') CONFIG.set_setting('debridlastsave', str(tools.get_date(days=3))) else: logging.log( "[Debrid Data] Next Auto Save isn't until: {0} / TODAY is: {1}". format(CONFIG.get_setting('debridlastsave'), str(tools.get_date())), level=xbmc.LOGNOTICE)
def auto_clean(): service = False days = [ tools.get_date(), tools.get_date(days=1), tools.get_date(days=3), tools.get_date(days=7), tools.get_date(days=30) ] freq = int(float(CONFIG.AUTOFREQ)) if CONFIG.get_setting('nextautocleanup') <= str( tools.get_date()) or freq == 0: service = True next_run = days[freq] CONFIG.set_setting('nextautocleanup', str(next_run)) else: logging.log("[Auto Clean Up] Next Clean Up {0}".format( CONFIG.get_setting('nextautocleanup')), level=xbmc.LOGNOTICE) if service: if CONFIG.AUTOCACHE == 'true': logging.log('[Auto Clean Up] Cache: On', level=xbmc.LOGNOTICE) clear.clear_cache(True) else: logging.log('[Auto Clean Up] Cache: Off', level=xbmc.LOGNOTICE) if CONFIG.AUTOTHUMBS == 'true': logging.log('[Auto Clean Up] Old Thumbs: On', level=xbmc.LOGNOTICE) clear.old_thumbs() else: logging.log('[Auto Clean Up] Old Thumbs: Off', level=xbmc.LOGNOTICE) if CONFIG.AUTOPACKAGES == 'true': logging.log('[Auto Clean Up] Packages: On', level=xbmc.LOGNOTICE) clear.clear_packages_startup() else: logging.log('[Auto Clean Up] Packages: Off', level=xbmc.LOGNOTICE)
def debrid_menu(): from resources.libs import debridit keep_debrid = '[COLOR springgreen]ON[/COLOR]' if CONFIG.KEEPDEBRID == 'true' else '[COLOR red]OFF[/COLOR]' last = str(CONFIG.DEBRIDSAVE) if not CONFIG.DEBRIDSAVE == '' else 'Debrid authorizations haven\'t been saved yet.' directory.add_file('[I]https://www.real-debrid.com/ is a PAID service.[/I]', icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3) directory.add_file('[I]https://www.premiumize.me/ is a PAID service.[/I]', icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3) directory.add_file('Save Debrid Data: {0}'.format(keep_debrid), {'mode': 'togglesetting', 'name': 'keepdebrid'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3) if CONFIG.KEEPDEBRID == 'true': directory.add_file('Last Save: {0}'.format(str(last)), icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3) directory.add_separator(icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3) for debrid in debridit.ORDER: if xbmc.getCondVisibility('System.HasAddon({0})'.format(debridit.DEBRIDID[debrid]['plugin'])): name = debridit.DEBRIDID[debrid]['name'] path = debridit.DEBRIDID[debrid]['path'] saved = debridit.DEBRIDID[debrid]['saved'] file = debridit.DEBRIDID[debrid]['file'] user = CONFIG.get_setting(saved) auser = debridit.debrid_user(debrid) icon = debridit.DEBRIDID[debrid]['icon'] if os.path.exists(path) else CONFIG.ICONDEBRID fanart = debridit.DEBRIDID[debrid]['fanart'] if os.path.exists(path) else CONFIG.ADDON_FANART menu = create_addon_data_menu('Debrid', debrid) menu2 = create_save_data_menu('Debrid', debrid) menu.append((CONFIG.THEME2.format('{0} Settings'.format(name)), 'RunPlugin(plugin://{0}/?mode=opensettings&name={1}&url=debrid)'.format(CONFIG.ADDON_ID, debrid))) directory.add_file('[+]-> {0}'.format(name), icon=icon, fanart=fanart, themeit=CONFIG.THEME3) if not os.path.exists(path): directory.add_file('[COLOR red]Addon Data: Not Installed[/COLOR]', icon=icon, fanart=fanart, menu=menu) elif not auser: directory.add_file('[COLOR red]Addon Data: Not Registered[/COLOR]', {'mode': 'authdebrid', 'name': debrid}, icon=icon, fanart=fanart, menu=menu) else: directory.add_file('[COLOR springgreen]Addon Data: {0}[/COLOR]'.format(auser), {'mode': 'authdebrid', 'name': debrid}, icon=icon, fanart=fanart, menu=menu) if user == "": if os.path.exists(file): directory.add_file('[COLOR red]Saved Data: Save File Found (Import Data)[/COLOR]', {'mode': 'importdebrid', 'name': debrid}, icon=icon, fanart=fanart, menu=menu2) else: directory.add_file('[COLOR red]Saved Data: Not Saved[/COLOR]', {'mode': 'savedebrid', 'name': debrid}, icon=icon, fanart=fanart, menu=menu2) else: directory.add_file('[COLOR springgreen]Saved Data: {0}[/COLOR]'.format(user), icon=icon, fanart=fanart, menu=menu2) directory.add_separator(themeit=CONFIG.THEME3) directory.add_file('Save All Debrid Data', {'mode': 'savedebrid', 'name': 'all'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3) directory.add_file('Recover All Saved Debrid Data', {'mode': 'restoredebrid', 'name': 'all'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3) directory.add_file('Import Debrid Data', {'mode': 'importdebrid', 'name': 'all'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3) directory.add_file('Clear All Addon Debrid Data', {'mode': 'addondebrid', 'name': 'all'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3) directory.add_file('Clear All Saved Debrid Data', {'mode': 'cleardebrid', 'name': 'all'}, icon=CONFIG.ICONDEBRID, themeit=CONFIG.THEME3)
def login_menu(): from resources.libs import loginit keep_login = '******' if CONFIG.KEEPLOGIN == 'true' else '[COLOR red]OFF[/COLOR]' last = str(CONFIG.LOGINSAVE) if not CONFIG.LOGINSAVE == '' else 'Login data hasn\'t been saved yet.' directory.add_file('[I]Several of these addons are PAID services.[/I]', icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3) directory.add_file('Save API Keys: {0}'.format(keep_login), {'mode': 'togglesetting', 'name': 'keeplogin'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3) if CONFIG.KEEPLOGIN == 'true': directory.add_file('Last Save: {0}'.format(str(last)), icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3) directory.add_separator(icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3) for login in loginit.ORDER: if xbmc.getCondVisibility('System.HasAddon({0})'.format(loginit.LOGINID[login]['plugin'])): name = loginit.LOGINID[login]['name'] path = loginit.LOGINID[login]['path'] saved = loginit.LOGINID[login]['saved'] file = loginit.LOGINID[login]['file'] user = CONFIG.get_setting(saved) auser = loginit.login_user(login) icon = loginit.LOGINID[login]['icon'] if os.path.exists(path) else CONFIG.ICONLOGIN fanart = loginit.LOGINID[login]['fanart'] if os.path.exists(path) else CONFIG.ADDON_FANART menu = create_addon_data_menu('Login', login) menu2 = create_save_data_menu('Login', login) menu.append((CONFIG.THEME2.format('{0} Settings'.format(name)), 'RunPlugin(plugin://{0}/?mode=opensettings&name={1}&url=login)'.format(CONFIG.ADDON_ID, login))) directory.add_file('[+]-> {0}'.format(name), icon=icon, fanart=fanart, themeit=CONFIG.THEME3) if not os.path.exists(path): directory.add_file('[COLOR red]Addon Data: Not Installed[/COLOR]', icon=icon, fanart=fanart, menu=menu) elif not auser: directory.add_file('[COLOR red]Addon Data: Not Registered[/COLOR]', {'mode': 'authlogin', 'name': login}, icon=icon, fanart=fanart, menu=menu) else: directory.add_file('[COLOR springgreen]Addon Data: {0}[/COLOR]'.format(auser), {'mode': 'authlogin', 'name': login}, icon=icon, fanart=fanart, menu=menu) if user == "": if os.path.exists(file): directory.add_file('[COLOR red]Saved Data: Save File Found (Import Data)[/COLOR]', {'mode': 'importlogin', 'name': login}, icon=icon, fanart=fanart, menu=menu2) else: directory.add_file('[COLOR red]Saved Data: Not Saved[/COLOR]', {'mode': 'savelogin', 'name': login}, icon=icon, fanart=fanart, menu=menu2) else: directory.add_file('[COLOR springgreen]Saved Data: {0}[/COLOR]'.format(user), icon=icon, fanart=fanart, menu=menu2) directory.add_separator(themeit=CONFIG.THEME3) directory.add_file('Save All Login Info', {'mode': 'savelogin', 'name': 'all'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3) directory.add_file('Recover All Saved Login Info', {'mode': 'restorelogin', 'name': 'all'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3) directory.add_file('Import Login Info', {'mode': 'importlogin', 'name': 'all'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3) directory.add_file('Clear All Addon Login Info', {'mode': 'addonlogin', 'name': 'all'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3) directory.add_file('Clear All Saved Login Info', {'mode': 'clearlogin', 'name': 'all'}, icon=CONFIG.ICONLOGIN, themeit=CONFIG.THEME3)