def set_home_enabled_strings(): homeitems = get_home_enabled_default_list().split(",") for item in homeitems: item = item.split("|")[0] common.set_string("homeenabled-%s" % item, get_homeenabled(item)) common.set_string("home-%s-replacement" % item, get_homereplacement(item))
def toggle_boot_to_xbmc(): bootenabled = get_boot_to_xbmc_enabled() if bootenabled == "1": bootenabled = "0" else: bootenabled = "1" common.file_put_contents("/data/etc/.boot_to_xbmc_enabled", bootenabled) common.set_string("boot-to-xbmc", bootenabled)
def toggle_jump_to_last_unwatched(): jumpenabled = get_jump_to_last_unwatched_value() if jumpenabled == "1": jumpenabled = "0" else: jumpenabled = "1" common.file_put_contents("/data/etc/.jump_to_unwatched_enabled", jumpenabled) common.set_string("jump-to-unwatched", jumpenabled)
def featured_previous(): replace = get_featured_feed_value() num = int(replace) - 1 if num < 0: num = 4 replace = "%s" % num common.file_put_contents("/data/etc/.replace_featured_enabled", replace) common.set_string("featured-feed", get_featured_feed() ) common.set_string("featured-name", get_featured_name() )
def set_browser_homepage(): homepage = get_browser_homepage() kb = xbmc.Keyboard('default', 'heading', True) kb.setDefault(homepage) kb.setHeading('Enter homepage URL') # optional kb.setHiddenInput(False) # optional kb.doModal() if kb.isConfirmed(): homepage = kb.getText() common.file_put_contents("/data/etc/.browser_homepage", homepage) template = common.file_get_contents("/data/hack/apps/browser2/template.xml") template = homepage.join(template.split("$URL$")) common.file_put_contents("/data/hack/apps/browser2/descriptor.xml", template) os.system("sh /data/hack/apps.sh") common.set_string("browser-homepage", "".join(get_browser_homepage().split("http://")) )
def toggle_subtitles(mode, current): if mode == "all": subtitles = get_subtitles_enabled() if subtitles == "1": subtitles = "0" else: subtitles = "1" common.file_put_contents("/data/etc/.subtitles_enabled", subtitles) os.system("sh /data/hack/subtitles.sh") common.set_string("subtitles-plugin", subtitles) if mode == "language": if get_subtitles_language_filter() == "0" and current != "1": common.set_string("subtitles-plugin-language","1") else: config = ConfigParser.SafeConfigParser({"lang": "All", "plugins" : "BierDopje,OpenSubtitles", "tvplugins" : "BierDopje,OpenSubtitles", "movieplugins" : "OpenSubtitles" }) if os.path.exists("/data/etc/.subtitles"): config.read("/data/etc/.subtitles") config.set("DEFAULT", "lang", "All") if os.path.exists("/data/etc/.subtitles"): configfile = open("/data/etc/.subtitles", "w") config.write(configfile) configfile.close() common.set_string("subtitles-plugin-language","0")
def subtitle_provider(method, section, provider=None): config = ConfigParser.SafeConfigParser({ "lang": "All", "plugins": "BierDopje,OpenSubtitles", "tvplugins": "BierDopje,OpenSubtitles", "movieplugins": "OpenSubtitles" }) if os.path.exists("/data/etc/.subtitles"): config.read("/data/etc/.subtitles") plugins = config.get("DEFAULT", "plugins") plugin_section = "default" config_section = "plugins" if section == "tv": plugins = config.get("DEFAULT", "tvplugins") plugin_section = "tv" config_section = "tvplugins" if section == "movie": plugins = config.get("DEFAULT", "movieplugins") plugin_section = "movie" config_section = "movieplugins" enabled_providers = plugins.split(',') if method == "get": if provider != None: if provider in enabled_providers: return 1 else: return 0 for checkprovider in available_providers: result = 0 if checkprovider in enabled_providers: result = 1 common.set_string( "subtitles-plugin-%s-%s" % (plugin_section, checkprovider), result) if method == "set": provider_status = 1 if provider in enabled_providers: provider_status = 0 if provider_status == 1: enabled_providers.append(provider) common.set_string( "subtitles-plugin-%s-%s" % (plugin_section, provider), "1") else: enabled_providers.remove(provider) common.set_string( "subtitles-plugin-%s-%s" % (plugin_section, provider), "0") config.set("DEFAULT", config_section, ",".join(enabled_providers).strip(',')) if os.path.exists("/data/etc/.subtitles"): configfile = open("/data/etc/.subtitles", "w") config.write(configfile) configfile.close()
def set_squeezecontroller(): squeezecontroller = get_squeezecontroller() kb = xbmc.Keyboard('default', 'heading', True) kb.setDefault(squeezecontroller) kb.setHeading('Enter squeezecontroller hostname or IP') # optional kb.setHiddenInput(False) # optional kb.doModal() if kb.isConfirmed(): squeezecontroller = kb.getText() squeezecontroller = squeezecontroller.strip() if running_squeezeslave() == 1: mc.ShowDialogNotification("Killing squeezeslave") try: os.system("killall squeezeslave") time.sleep(2) except: pass else: mc.ShowDialogNotification("Squeezeslave is not running") if squeezecontroller == "": dialog = xbmcgui.Dialog() if dialog.yesno('Squeezeslave', 'Unsetting squeezecontroller disables squeezeslave! Do you want to disable squeezeslave?'): os.system("rm /data/etc/squeezecontroller") else: mc.ShowDialogNotification("Updating squeezeslave settings") common.file_put_contents("/data/etc/squeezecontroller", squeezecontroller) mc.ShowDialogNotification("Starting squeezeslave") os.system("sh /data/hack/squeezeslave.sh") # wait 2 seconds, usually squeezeslave crashes when settings are wrong time.sleep(2) if running_squeezeslave() == 1: mc.ShowDialogNotification("Squeezeslave started successfully") else: mc.ShowDialogNotification("Squeezeslave start failed, check settings!") common.set_string("squeezecontroller", get_squeezecontroller() )
def subtitle_provider(method, section, provider=None): config = ConfigParser.SafeConfigParser({"lang": "All", "plugins" : "BierDopje,OpenSubtitles", "tvplugins" : "BierDopje,OpenSubtitles", "movieplugins" : "OpenSubtitles" }) if os.path.exists("/data/etc/.subtitles"): config.read("/data/etc/.subtitles") plugins = config.get("DEFAULT", "plugins") plugin_section = "default" config_section = "plugins" if section == "tv": plugins = config.get("DEFAULT", "tvplugins") plugin_section = "tv" config_section = "tvplugins" if section == "movie": plugins = config.get("DEFAULT", "movieplugins") plugin_section = "movie" config_section = "movieplugins" enabled_providers = plugins.split(',') if method == "get": if provider != None: if provider in enabled_providers: return 1 else: return 0 for checkprovider in available_providers: result = 0 if checkprovider in enabled_providers: result = 1 common.set_string("subtitles-plugin-%s-%s" % (plugin_section, checkprovider), result) if method == "set": provider_status = 1 if provider in enabled_providers: provider_status = 0 if provider_status == 1: enabled_providers.append(provider) common.set_string("subtitles-plugin-%s-%s" % (plugin_section, provider), "1") else: enabled_providers.remove(provider) common.set_string("subtitles-plugin-%s-%s" % (plugin_section, provider), "0") config.set("DEFAULT", config_section, ",".join(enabled_providers).strip(',')) if os.path.exists("/data/etc/.subtitles"): configfile = open("/data/etc/.subtitles", "w") config.write(configfile) configfile.close()
def register_defaults(): subtitle_provider("get", "default") subtitle_provider("get", "tv") subtitle_provider("get", "movie") common.set_string("subtitles-plugin-language", get_subtitles_language_filter() ) common.set_string("subtitles-plugin", get_subtitles_enabled() ) common.set_string("featured-feed", get_featured_feed() ) common.set_string("featured-name", get_featured_name() ) common.set_string("browser-homepage", "".join(get_browser_homepage().split("http://")) ) if not os.path.exists("/data/etc/.subtitles"): common.file_put_contents("/data/etc/.subtitles", """[DEFAULT] lang = All movieplugins = OpenSubtitles,Undertexter tvplugins = BierDopje,OpenSubtitles,Addic7ed,Subtitulos,SubsWiki,Undertexter plugins = BierDopje,OpenSubtitles,Subtitulos,SubsWiki,Addic7ed,Undertexter [BierDopje] key = C2FAFCBE34610608 """) set_home_enabled_strings() version_local = get_local_version() if version_local != "": common.set_string("boxeeplus-version", version_local )