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)) proxyport = settings.getInt(key='_proxyserver_port') shutil.rmtree(ADDON_PROFILE) settings.setInt(key='_proxyserver_port', value=proxyport) system, arch = get_system_arch() settings.set(key="_system", value=system) settings.set(key="_arch", value=arch) download_files() update_settings() change_icon() 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_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 _download_settings(**kwargs): _close() try: download_settings() except: pass gui.notification(_.DONE_NOREBOOT)
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_epg(**kwargs): _close() try: if settings.getInt('_epgrun') == 0 or settings.getInt( '_epgruntime') < (int(time.time()) - 300): download_epg() gui.notification(_.DONE_NOREBOOT) except: pass
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: xbmc.executeJSONRPC( '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":false}}}}' .format(ADDON_ID)) shutil.rmtree(ADDON_PROFILE) 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") != '&catchup={catchup-id}': IPTV_SIMPLE.setSetting("catchupQueryFormat", '&catchup={catchup-id}') if IPTV_SIMPLE.getSettingInt("catchupDays") != 7: IPTV_SIMPLE.setSettingInt("catchupDays", 7) if IPTV_SIMPLE.getSettingInt("allChannelsCatchupMode") != 2: IPTV_SIMPLE.setSettingInt("allChannelsCatchupMode", 2) 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") user_agent = settings.get(key='_user_agent') if IPTV_SIMPLE.getSetting("userAgent") != user_agent: IPTV_SIMPLE.setSetting("userAgent", 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 remove_from_watchlist(id, **kwargs): if api.remove_from_watchlist(id=id) == True: gui.refresh() gui.notification(_.REMOVED_FROM_WATCHLIST) else: gui.notification(_.REMOVE_FROM_WATCHLIST_FAILED)
def add_to_watchlist(id, type, **kwargs): if api.add_to_watchlist(id=id, type=type) == True: gui.notification(_.ADDED_TO_WATCHLIST) else: gui.notification(_.ADD_TO_WATCHLIST_FAILED)