def _is_debugging(): command = {'jsonrpc': '2.0', 'id': 1, 'method': 'Settings.getSettings', 'params': {'filter': {'section': 'system', 'category': 'logging'}}} js_data = kodi.execute_jsonrpc(command) for item in js_data.get('result', {}).get('settings', {}): if item['id'] == 'debug.showloginfo': return item['value'] return False
def showAdult(status, pin='0'): global window if status == None: status = window.getProperty('idolpx.installer.adultstatus') if status == 'true': # Enable Adult Addons if pin == '0': pin = xbmcgui.Dialog().numeric(0,'Enter PIN') if pin == kodi.get_setting('adultpin'): status = 'true' else: status = 'abort' else: # Disable Adult Addons status = 'false' kodi.debug('Adult Addons Enabled: ' + status) if status != 'abort': window.setProperty('idolpx.installer.adultstatus', status) addonPath = xbmc.translatePath(os.path.join('special://home', 'addons')) resourcePath = os.path.join(addonPath, kodi.addon_id(), 'resources') nsfw_addons = os.path.join(resourcePath, 'nsfw_addons.dat') with open(nsfw_addons, 'r') as myfile: addons = myfile.read().split('\n') for addon in addons: try: # Move Addon if status == 'true': shutil.move(os.path.join(resourcePath, addon), os.path.join(addonPath, addon)) #kodi.update_enabled(addon, 1) else: shutil.move(os.path.join(addonPath, addon), os.path.join(resourcePath, addon)) #kodi.update_enabled(addon, 0) # Enable/Disable Addon query = '{"jsonrpc":"2.0", "id":1, "method":"Addons.SetAddonEnabled","params":{"addonid":"%s", "enabled":%s}}' % (addon, status) kodi.execute_jsonrpc(query) kodi.debug(query) xbmc.sleep(200) except: pass kodi.execute('UpdateLocalAddons()') kodi.execute('UpdateAddonRepos()') #xbmc.sleep(1000) #kodi.execute('ReloadSkin()') kodi.set_setting('adultstatus', status) if status == 'true': kodi.notify('Adult Addons','Enabled!') else: kodi.notify('Adult Addons', 'Disabled!') else: kodi.notify('Adult Addons', 'Invalid PIN!')