def _set_settings_kodi(**kwargs): _close() try: xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"videoplayer.preferdefaultflag", "value":"true"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"locale.audiolanguage", "value":"default"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"locale.subtitlelanguage", "value":"default"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"pvrmanager.preselectplayingchannel", "value":"false"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"pvrmanager.syncchannelgroups", "value":"true"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"pvrmanager.backendchannelorder", "value":"true"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"pvrmanager.usebackendchannelnumbers", "value":"true"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"epg.selectaction", "value":"5"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"epg.pastdaystodisplay", "value":"7"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"epg.futuredaystodisplay", "value":"1"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"epg.hidenoinfoavailable", "value":"true"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"epg.epgupdate", "value":"720"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"epg.preventupdateswhileplayingtv", "value":"true"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"epg.ignoredbforclient", "value":"true"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"pvrrecord.instantrecordaction", "value":"2"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"pvrpowermanagement.enabled", "value":"false"}, "id":1}' ) xbmc.executeJSONRPC( '{"jsonrpc":"2.0", "method":"settings.SetSettingValue", "params":{"setting":"pvrparental.enabled", "value":"false"}, "id":1}' ) gui.notification(_.DONE_NOREBOOT) except: pass
def _reset(**kwargs): if not gui.yes_no(_.PLUGIN_RESET_YES_NO): return _close() try: xbmc.executeJSONRPC( '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":false}}}}' .format(ADDON_ID)) profile_settings = load_profile(profile_id=1) proxyserver_port = int(profile_settings['proxyserver_port']) system = profile_settings['system'] arch = profile_settings['arch'] shutil.rmtree(ADDON_PROFILE) directory = os.path.dirname(ADDON_PROFILE + os.sep + "images") try: if not os.path.exists(directory): os.makedirs(directory) except: pass directory = os.path.dirname(ADDON_PROFILE + os.sep + "cache") try: if not os.path.exists(directory): os.makedirs(directory) except: pass query = "UPDATE `vars` SET `arch`='{arch}', `system`='{system}', `test_running`=0, `proxyserver_port`={proxyserver_port} WHERE profile_id={profile_id}".format( arch=arch, system=system, proxyserver_port=proxyserver_port, profile_id=1) query_settings(query=query, return_result=False, return_insert=False, commit=True) download_files() update_settings() update_prefs() except: pass xbmc.executeJSONRPC( '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":true}}}}' .format(ADDON_ID)) gui.notification(_.PLUGIN_RESET_OK) signals.emit(signals.AFTER_RESET) gui.refresh()
def _download_settings(**kwargs): _close() try: download_settings() except: pass gui.notification(_.DONE_NOREBOOT)
def _download_epg(**kwargs): _close() try: profile_settings = load_profile(profile_id=1) if int(profile_settings['epgrun']) == 0 or int( profile_settings['epgruntime']) < (int(time.time()) - 300): download_epg() gui.notification(_.DONE_NOREBOOT) except: pass
def _reset(**kwargs): if not gui.yes_no(_.PLUGIN_RESET_YES_NO): return _close() try: method = 'Addons.SetAddonEnabled' json_rpc(method, {"addonid": ADDON_ID, "enabled": "false"}) remove_dir(directory="cache", ext=False) remove_dir(directory="tmp", ext=False) for file in glob.glob(os.path.join(ADDON_PROFILE, "stream*")): remove_file(file=file, ext=True) for file in glob.glob(os.path.join(ADDON_PROFILE, "*.json")): remove_file(file=file, ext=True) for file in glob.glob(os.path.join(ADDON_PROFILE, "*.xml")): remove_file(file=file, ext=True) if not os.path.isdir(os.path.join(ADDON_PROFILE, "cache")): os.makedirs(os.path.join(ADDON_PROFILE, "cache")) if not os.path.isdir(os.path.join(ADDON_PROFILE, "tmp")): os.makedirs(os.path.join(ADDON_PROFILE, "tmp")) if not os.path.isdir(os.path.join(ADDON_PROFILE, "movies")): os.makedirs(os.path.join(ADDON_PROFILE, "movies")) if not os.path.isdir(os.path.join(ADDON_PROFILE, "shows")): os.makedirs(os.path.join(ADDON_PROFILE, "shows")) except: pass method = 'Addons.SetAddonEnabled' json_rpc(method, {"addonid": ADDON_ID, "enabled": "true"}) gui.notification(_.PLUGIN_RESET_OK) signals.emit(signals.AFTER_RESET) gui.refresh()
def _reset(**kwargs): if not gui.yes_no(_.PLUGIN_RESET_YES_NO): return _close() try: xbmc.executeJSONRPC( '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":false}}}}' .format(ADDON_ID)) shutil.rmtree(ADDON_PROFILE) directory = os.path.dirname(ADDON_PROFILE + os.sep + "images/empty.jpg") try: if not os.path.exists(directory): os.makedirs(directory) except: pass directory = os.path.dirname(ADDON_PROFILE + os.sep + "cache/empty.json") try: if not os.path.exists(directory): os.makedirs(directory) except: pass except: pass xbmc.executeJSONRPC( '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":true}}}}' .format(ADDON_ID)) gui.notification(_.PLUGIN_RESET_OK) signals.emit(signals.AFTER_RESET) gui.refresh()
def _set_settings_iptv(**kwargs): _close() try: IPTV_SIMPLE_ADDON_ID = "pvr.iptvsimple" try: IPTV_SIMPLE = xbmcaddon.Addon(id=IPTV_SIMPLE_ADDON_ID) except: xbmc.executebuiltin( 'InstallAddon({})'.format(IPTV_SIMPLE_ADDON_ID), True) if IPTV_SIMPLE.getSettingBool("epgCache") != True: IPTV_SIMPLE.setSettingBool("epgCache", True) if IPTV_SIMPLE.getSettingInt("epgPathType") != 0: IPTV_SIMPLE.setSettingInt("epgPathType", 0) if IPTV_SIMPLE.getSetting("epgPath") != ADDON_PROFILE + "epg.xml": IPTV_SIMPLE.setSetting("epgPath", ADDON_PROFILE + "epg.xml") if IPTV_SIMPLE.getSetting("epgTimeShift") != "0": IPTV_SIMPLE.setSetting("epgTimeShift", "0") if IPTV_SIMPLE.getSettingBool("epgTSOverride") != False: IPTV_SIMPLE.setSettingBool("epgTSOverride", False) if get_kodi_version() > 18: if IPTV_SIMPLE.getSettingInt("m3uRefreshMode") != 2: IPTV_SIMPLE.setSettingInt("m3uRefreshMode", 2) if IPTV_SIMPLE.getSettingInt("m3uRefreshIntervalMins") != 60: IPTV_SIMPLE.setSettingInt("m3uRefreshIntervalMins", 60) if IPTV_SIMPLE.getSettingInt("m3uRefreshHour") != 4: IPTV_SIMPLE.setSettingInt("m3uRefreshHour", 4) if IPTV_SIMPLE.getSettingBool("catchupEnabled") != True: IPTV_SIMPLE.setSettingBool("catchupEnabled", True) if IPTV_SIMPLE.getSetting( "catchupQueryFormat" ) != 'plugin://' + ADDON_ID + '/?_=play_video&type=program&id={catchup-id}': IPTV_SIMPLE.setSetting( "catchupQueryFormat", 'plugin://' + ADDON_ID + '/?_=play_video&type=program&id={catchup-id}') if IPTV_SIMPLE.getSettingInt("catchupDays") != 7: IPTV_SIMPLE.setSettingInt("catchupDays", 7) if IPTV_SIMPLE.getSettingInt("allChannelsCatchupMode") != 1: IPTV_SIMPLE.setSettingInt("allChannelsCatchupMode", 1) if IPTV_SIMPLE.getSettingBool("catchupPlayEpgAsLive") != True: IPTV_SIMPLE.setSettingBool("catchupPlayEpgAsLive", True) if IPTV_SIMPLE.getSettingInt( "catchupWatchEpgBeginBufferMins") != 5: IPTV_SIMPLE.setSettingInt("catchupWatchEpgBeginBufferMins", 5) if IPTV_SIMPLE.getSettingInt("catchupWatchEpgEndBufferMins") != 15: IPTV_SIMPLE.setSettingInt("catchupWatchEpgEndBufferMins", 15) if IPTV_SIMPLE.getSettingBool( "catchupOnlyOnFinishedProgrammes") != True: IPTV_SIMPLE.setSettingBool("catchupOnlyOnFinishedProgrammes", True) if IPTV_SIMPLE.getSettingBool("m3uCache") != True: IPTV_SIMPLE.setSettingBool("m3uCache", True) if IPTV_SIMPLE.getSettingInt("m3uPathType") != 0: IPTV_SIMPLE.setSettingInt("m3uPathType", 0) if IPTV_SIMPLE.getSetting( "m3uPath") != ADDON_PROFILE + "playlist.m3u8": IPTV_SIMPLE.setSetting("m3uPath", ADDON_PROFILE + "playlist.m3u8") profile_settings = load_profile(profile_id=1) if IPTV_SIMPLE.getSetting( "userAgent") != profile_settings['user_agent']: IPTV_SIMPLE.setSetting("userAgent", profile_settings['user_agent']) xbmc.executeJSONRPC( '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":false}}}}' .format(IPTV_SIMPLE_ADDON_ID)) xbmc.sleep(2000) xbmc.executeJSONRPC( '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":true}}}}' .format(IPTV_SIMPLE_ADDON_ID)) settings.setBool('enable_simple_iptv', True) gui.notification(_.DONE_REBOOT) except: pass
def _set_settings_kodi(**kwargs): _close() try: method = 'settings.SetSettingValue' json_rpc(method, { "setting": "videoplayer.preferdefaultflag", "value": "true" }) json_rpc(method, { "setting": "videoplayer.preferdefaultflag", "value": "true" }) json_rpc(method, { "setting": "locale.audiolanguage", "value": "default" }) json_rpc(method, { "setting": "locale.subtitlelanguage", "value": "default" }) json_rpc(method, { "setting": "pvrmanager.preselectplayingchannel", "value": "false" }) json_rpc(method, { "setting": "pvrmanager.syncchannelgroups", "value": "true" }) json_rpc(method, { "setting": "pvrmanager.backendchannelorder", "value": "true" }) json_rpc(method, { "setting": "pvrmanager.usebackendchannelnumbers", "value": "true" }) json_rpc(method, {"setting": "epg.selectaction", "value": 5}) json_rpc(method, {"setting": "epg.pastdaystodisplay", "value": 7}) json_rpc(method, {"setting": "epg.futuredaystodisplay", "value": 1}) json_rpc(method, { "setting": "epg.hidenoinfoavailable", "value": "true" }) json_rpc(method, {"setting": "epg.epgupdate", "value": 720}) json_rpc(method, { "setting": "epg.preventupdateswhileplayingtv", "value": "true" }) json_rpc(method, {"setting": "epg.ignoredbforclient", "value": "true"}) json_rpc(method, { "setting": "pvrrecord.instantrecordaction", "value": 2 }) json_rpc(method, { "setting": "pvrpowermanagement.enabled", "value": "false" }) json_rpc(method, {"setting": "pvrparental.enabled", "value": "false"}) gui.notification(_.DONE_NOREBOOT) except: pass
def api_remove_from_watchlist(id, **kwargs): if api_remove_from_watchlist(id=id): gui.refresh() gui.notification(_.REMOVED_FROM_WATCHLIST) else: gui.notification(_.REMOVE_FROM_WATCHLIST_FAILED)
def api_add_to_watchlist(id, type, **kwargs): if api_add_to_watchlist(id=id, type=type): gui.notification(_.ADDED_TO_WATCHLIST) else: gui.notification(_.ADD_TO_WATCHLIST_FAILED)