def auto_weekly_clean_on_off(): if kodi.get_setting("clearday") == '7': if xbmcgui.Dialog().yesno(AddonName, 'Please confirm that you wish to enable weekly automated maintenance.'): kodi.set_setting("clearday", datetime.datetime.today().weekday()) kodi.openSettings(addon_id, id1=5, id2=3) available_space, total_space = get_free_space_mb(xbmc.translatePath('special://home')) if str(available_space) == '0 B Free' and str(total_space) == '0 B Total': xbmcgui.Dialog().ok('Auto Maintenance Error', 'Auto Maintenance encountered a problem and can not be run', 'Maintenace can still be done individually') return mb_settings = (0, 25, 50, 75, 100) while True: allotted_space = 0 for value in ('cachemb', 'thumbsmb', 'packagesmb'): allotted_space += mb_settings[int(kodi.get_setting(value))] * 10**6 if (allotted_space >= available_space) and not kodi.get_setting("automb"): xbmcgui.Dialog().ok("Your settings sizes for Kodi to use are larger than the available drive space", 'Please try lower settings, uninstall uneeded apps and addons,', 'or set kodi size to "Auto" to use the automated settings based on free space') kodi.openSettings(addon_id, id1=5, id2=3) else: break else: if xbmcgui.Dialog().yesno(AddonName, 'Please confirm that you wish to disable weekly automated maintenance.'): kodi.set_setting("clearday", '7') xbmc.executebuiltin("Container.Refresh")
def show_about(): interval = int(kodi.get_setting('last_about')) if interval == 0: interval = 5 try: import xbmc KODI_LANGUAGE = xbmc.getLanguage() except: KODI_LANGUAGE = 'English' path = kodi.vfs.join(kodi.get_path(), 'resources/language/%s/github_help.txt', KODI_LANGUAGE) if not kodi.vfs.exists(path): path = kodi.vfs.join(kodi.get_path(), 'resources/language/English/github_help.txt') text = kodi.vfs.read_file(path) kodi.dialog_textbox('GitHub Browser Instructions', text) else: interval -= 1 kodi.set_setting('last_about', interval)
def List_Adult(url): if settings.getSetting('adult') == 'true': confirm = xbmcgui.Dialog().yesno("Please Confirm", " Please confirm that you are at least 18 years of age.", " ", " ", "NO (EXIT)", "YES (ENTER)") if confirm: url = 'https://indigo.tvaddons.co/installer/sources/xxx.php' link = OPEN_URL(url).replace('\r', '').replace('\n', '').replace('\t', ''); match = re.compile( "'name' => '(.+?)'.+?dataUrl' => '(.+?)'.+?xmlUrl' => '(.+?)'.+?downloadUrl' => '(.+?)'").findall(link) for name, dataurl, url, repourl in match: lang = 'Adults Only' add2HELPDir(name + ' (' + lang + ')', url, 'getaddoninfo', '', fanart, dataurl, repourl) if len(match) == 0: return else: kodi.set_setting('adult', 'false') return viewsetter.set_view("sets")
def toggle_notify(): if kodi.get_setting('notifications-on-startup') == "false": option = 'OPT-out' sub = 'Un' status = 'Disabled' else: option = 'OPT-in' sub = '' status = 'Enabled' confirm = xbmcgui.Dialog() if confirm.yesno('Community Notifications', "Please confirm that you wish to " + option + " of community notifications! ", " "): if status == 'Enabled': kodi.set_setting('notifications-on-startup', "false") else: kodi.set_setting('notifications-on-startup', "true") kodi.logInfo(status + "notifications") dialog = xbmcgui.Dialog() dialog.ok("Notifications " + status, " You have " + sub + "subscribed to notifications!") xbmc.executebuiltin("Container.Refresh()") else: return
def toggle_setting(setting_title, setting, restart=False, silent=False): # kodi.log('TOGGLE SETTING') if not silent: if kodi.get_setting(setting) == "true": status_on_off = 'OFF' else: status_on_off = 'ON' if not xbmcgui.Dialog().yesno(setting_title, 'Please confirm that you wish to TURN %s %s' % (status_on_off, setting_title), '', '', 'Cancel', 'Confirm'): return if kodi.get_setting(setting) == 'true': kodi.set_setting(setting, 'false') else: kodi.set_setting(setting, 'true') kodi.log('Toggled setting for ' + setting_title) if not silent and not restart: xbmcgui.Dialog().notification('', 'Setting Changed!', sound=False) xbmc.executebuiltin("Container.Refresh") if restart: xbmcgui.Dialog().notification('', 'Kodi is shutting down for changes to take effect', sound=False) xbmc.executebuiltin('ShutDown')
def main_menu(): maintool.source_change() maintool.feed_change() # ########## TRY POP ######## if len(kodi.get_setting('notify')) > 0: kodi.set_setting('notify', str(int(kodi.get_setting('notify')) + 1)) else: kodi.set_setting('notify', "1") if int(kodi.get_setting('notify')) == 1: xbmcgui.Dialog().notification('Need Support?', 'www.tvaddons.co', artwork + 'icon.png', 3000, False) elif int(kodi.get_setting('notify')) == 5: kodi.set_setting('notify', "0") # ######## END POP ########### if kodi.get_setting('hasran') == 'false': kodi.set_setting('hasran', 'true') if kodi.get_setting('set_rtmp') == 'false': try: addon_able.set_enabled("inputstream.adaptive") except: pass time.sleep(0.5) try: addon_able.set_enabled("inputstream.rtmp") except: pass time.sleep(0.5) xbmc.executebuiltin("XBMC.UpdateLocalAddons()") kodi.set_setting('set_rtmp', 'true') dp = xbmcgui.DialogProgress() try: if (not os.path.exists(ART)) or (not os.path.exists(ART2)) or (not os.path.exists(ART3)): dp.create(AddonTitle, 'Getting ' + AddonTitle + ' Ready........', 'Downloading ' + AddonTitle + ' Icons......') dp.update(0) icons_zip = os.path.join(packagepath, AddonTitle + '_icons.zip') downloader.download(OPEN_URL('http://indigo.tvaddons.co/graphics/arts.txt'), icons_zip, dp) dp.update(0, 'Getting %s Ready........' % AddonTitle, 'Extracting %s Icons......' % AddonTitle) extract.all(icons_zip, addon_path, dp) dp.close() except: pass # # Check for HUBRepo and install it try: if not os.path.exists(hubpath): installer.HUBINSTALL('repository.xbmchub', 'http://github.com/tvaddonsco/tva-release-repo/raw/master/repository.xbmchub/', 'repository.xbmchub') xbmc.executebuiltin("XBMC.InstallAddon(%s)" % 'repository.xbmchub') addon_able.set_enabled("repository.xbmchub") xbmc.executebuiltin("XBMC.UpdateAddonRepos()") except: pass # Check for Log Uploader and install it try: if not os.path.exists(uploaderpath): installer.HUBINSTALL('script.tvaddons.debug.log', 'http://github.com/tvaddonsco/tva-release-repo/raw/master/script.tvaddons.debug.log/', 'script.tvaddons.debug.log') addon_able.set_enabled('script.tvaddons.debug.log') # xbmc.executebuiltin("InstallAddon(%s)" % 'script.tvaddons.debug.log') xbmc.executebuiltin("XBMC.UpdateLocalAddons()") except: pass # Check for old maintenance tools and remove them old_maintenance = (oldinstaller, oldnotify, oldmain, oldwiz, oldfresh) for old_file in old_maintenance: if os.path.exists(old_file): shutil.rmtree(old_file) if kodi.get_setting('wizardran') == 'false': kodi.addItem("Config Wizard", '', 'call_wizard',artwork+'config_wizard.png', description="Automatically configure Kodi with the best addons and goodies in seconds!") kodi.addDir("Addon Installer", '', 'call_installer', artwork + 'addon_installer.png', description="It’s like an App Store for Kodi addons!") kodi.addDir("Maintenance Tools", '', 'call_maintool', artwork + 'maintool.png', description="Keep your Kodi setup running at optimum performance!") # kodi.addDir("Kodi Librtmp Files", '', 'get_libs', artwork +'librtmp_files.png') kodi.addItem("Rejuvenate Kodi", '', 'call_rejuv', artwork + 'rejuvinate.png', description="Wipe and reconfigure Kodi with the latest Config Wizard setup!") kodi.addDir("Factory Restore", '', 'call_restore', artwork + 'factory_restore.png', description="Start off fresh, wipe your Kodi setup clean!") if os.path.exists(uploaderpath): kodi.addItem("Log Uploader", '', 'log_upload', artwork + 'log_uploader.png', description="Easily upload your error logs for troubleshooting!") kodi.addDir("Network Speed Test", '', 'runspeedtest', artwork + 'speed_test.png', description="How fast is your internet?") kodi.addDir("System Information", '', 'system_info', artwork + 'system_info.png', description="Useful information about your Kodi setup!") kodi.addDir("Sports Listings", '', 'call_sports', artwork + 'sports_list.png', description="Who’s playing what today?") kodi.addDir('Backup / Restore', '', 'backup_restore', artwork + 'backup_restore.png', description="Backup or restore your Kodi configuration in minutes!") kodi.addItem("Log Viewer", '', 'log_view', artwork + 'log_viewer.png', description="Easily view your error log without leaving Kodi!") if kodi.get_setting("notifications-on-startup") == "false": kodi.addItem("Notifications (Opt Out)", '', 'toggle_notify', artwork + 'notification_optout.png', description="Unsubscribe to important TV ADDONS notifications!") else: kodi.addItem("Notifications (Opt In)", '', 'toggle_notify', artwork + 'notification_in.png', description="Subscribe from important TV ADDONS notifications!") viewsetter.set_view("sets")
def HELPWIZARD(name, url, description, filetype): path = xbmc.translatePath( os.path.join('special://home', 'addons', 'packages')) confirm = xbmcgui.Dialog().yesno( "Please Confirm", " Please confirm that you wish to automatically", " configure Kodi with all the best addons and tweaks!", " ", "Cancel", "Install") filetype = filetype.lower() if confirm: path = xbmc.translatePath( os.path.join('special://home', 'addons', 'packages')) dp = xbmcgui.DialogProgress() dp.create(AddonTitle, " ", 'Downloading and Configuring ', 'Please Wait') lib = os.path.join(path, name + '.zip') try: os.remove(lib) except: pass # ## ## ... ## # kodi.log(url) if str(url).endswith('[error]'): print url dialog = xbmcgui.Dialog() dialog.ok("Error!", url) return if '[error]' in url: print url dialog = xbmcgui.Dialog() dialog.ok("Error!", url) return downloader.download(url, lib, dp) if not os.path.exists(lib): return if filetype == 'main': addonfolder = xbmc.translatePath('special://home') elif filetype == 'addon': addonfolder = xbmc.translatePath( os.path.join('special://home', 'addons')) else: print {'filetype': filetype} dialog = xbmcgui.Dialog() dialog.ok("Error!", 'filetype: "%s"' % str(filetype)) return xbmc.sleep(4000) extract.all(lib, addonfolder, dp) xbmc.executebuiltin("XBMC.UpdateLocalAddons()") addon_able.setall_enable() try: addon_able.set_enabled("inputstream.adaptive") except: pass xbmc.sleep(4000) try: addon_able.set_enabled("inputstream.rtmp") except: pass try: os.remove(lib) except: pass if filetype == 'main': link = OPEN_URL(cutslink) shorts = re.compile('shortcut="(.+?)"').findall(link) for shortname in shorts: xEB('Skin.SetString(%s)' % shortname) enableBG16 = "UseCustomBackground,true" enableBG17 = "use_custom_bg,true" xEB('Skin.SetBool(%s)' % enableBG16) xEB('Skin.SetBool(%s)' % enableBG17) xbmc.sleep(4000) xbmc.executebuiltin('XBMC_UpdateLocalAddons()') addon_able.setall_enable() try: addon_able.set_enabled("inputstream.adaptive") except: pass xbmc.sleep(4000) try: addon_able.set_enabled("inputstream.rtmp") except: pass kodi.set_setting("wizardran", 'true') dialog = xbmcgui.Dialog() dialog.ok(AddonTitle, "Installation Complete!", "", "Click OK to exit Kodi and then restart to complete .") xbmc.executebuiltin('ShutDown')
def JUVWIZARD(filetype='main'): if xbmcgui.Dialog().yesno("Please Confirm", " Please confirm that you wish to automatically", " configure Kodi with all the best addons and tweaks!", " ", "Cancel", "Install"): filetype = filetype.lower() if filetype == 'main': addonfolder = xbmc.translatePath('special://home') elif filetype == 'addon': addonfolder = xbmc.translatePath(os.path.join('special://home', 'addons')) else: print({'filetype': filetype}) dialog.ok("Error!", 'filetype: "%s"' % str(filetype)) return link = kodi.read_file(wizlink).replace('\n', '').replace('\r', '').replace('\a', '').strip() # kodi.log(link) if '[error]' in link: print(link) dialog.ok("Error!", link) return path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages')) lib = os.path.join(path, 'rejuv.zip') try: os.remove(lib) except: pass # ## ## ... ## dp = xbmcgui.DialogProgress() dp.create(AddonTitle, " ", 'Downloading and Configuring ', 'Please Wait') downloader.download(link, lib, dp) xbmc.sleep(4000) extract.extract_all(lib, addonfolder, dp) xbmc.executebuiltin("XBMC.UpdateLocalAddons()") addon_able.setall_enable() try: addon_able.set_enabled("inputstream.adaptive") except: pass xbmc.sleep(4000) try: addon_able.set_enabled("inputstream.rtmp") except: pass xbmc.executebuiltin("XBMC.UpdateLocalAddons()") try: os.remove(lib) except: pass if filetype == 'main': link = kodi.read_file(cutslink) shorts = re.compile('shortcut="(.+?)"').findall(link) for shortname in shorts: xEB('Skin.SetString(%s)' % shortname) enableBG16 = "UseCustomBackground,true" enableBG17 = "use_custom_bg,true" xEB('Skin.SetBool(%s)' % enableBG16) xEB('Skin.SetBool(%s)' % enableBG17) kodi.set_setting("wizardran",'true') dialog.ok(AddonTitle, "Installation Complete.", "", "Click OK to exit Kodi and then restart to complete .") xbmc.executebuiltin('ShutDown')
maintool.auto_clean(True) # ################################################## ## if kodi.get_setting('set_rtmp') == 'false': try: addon_able.set_enabled("inputstream.adaptive") except: pass time.sleep(0.5) try: addon_able.set_enabled("inputstream.rtmp") except: pass time.sleep(0.5) # xbmc.executebuiltin("XBMC.UpdateLocalAddons()") kodi.set_setting('set_rtmp', 'true') time.sleep(0.5) # ################################################## ## run_once_path = xbmc.translatePath( os.path.join('special://home', 'addons', addon_id, 'resources', 'run_once.py')) if kodi.get_var(run_once_path, 'hasran') == 'false': kodi.set_setting('sevicehasran', 'false') # Start of notifications if kodi.get_setting('sevicehasran') == 'true': TypeOfMessage = "t" notification.check_news2(TypeOfMessage, override_service=False) # ################################################## ##
def main(): dp = xbmcgui.DialogProgress() dp.create('idolpx Installer', 'Checking for update...', '', 'Please wait...') dp.update(100) # Get Current Version update_file = xbmc.translatePath(os.path.join('special://', 'home')) + 'update.zip' current = json.loads( '{"config_version": "00000000","test_version": "00000000"}') path = xbmc.translatePath(os.path.join('special://', 'userdata')) version_file = path + 'version.json' try: current = json.load(open(version_file)) except: pass # Get Remote Settings try: # Prompt for Device ID if it is not set if not kodi.get_setting('deviceid'): kb = xbmc.Keyboard('default', 'heading') kb.setHeading( 'Enter your name or something so I know who you are \r\nand will allow you access to updates' ) kb.setDefault('') kb.setHiddenInput(False) kb.doModal() if (kb.isConfirmed()): kb_input = kb.getText() if (len(kb_input) > 3): kodi.set_setting('deviceid', kb_input) kodi.notify('Device ID set!', '[' + kb_input + ']') else: kodi.notify('Access denied!', 'Device ID not set.') return else: kodi.notify('Access denied!', 'Device ID not set.') return # Prompt for Configuration Update if kodi.get_setting('update_test') != 'true': current_version = current['config_version'] else: current_version = current['test_version'] params = { 'd': kodi.get_mac(), 'os': kodi.getInfoLabel('System.OSVersionInfo'), 'id': kodi.get_setting('deviceid'), 'kv': kodi.get_version() } params['cv'] = current_version kodi.log('Config URL: ' + kodi.get_setting('update_url')) response = requests.get(kodi.get_setting('update_url'), params=params) remote = json.loads(response.text) kodi.log(json.dumps(remote)) dp.close() if kodi.get_setting('update_test') != 'true': remote_version = remote['config_version'] url = remote['config_url'] hash = remote['config_md5'] else: remote_version = remote['test_version'] url = remote['test_url'] hash = remote['test_md5'] # Prompt for Kodi Update if kodi.get_setting('update_kodi') == 'true': if kodi.platform( ) == 'android' and remote['kodi_version'] != kodi.get_version(): choice = xbmcgui.Dialog().yesno( 'idolpx Installer', 'A new version of Kodi is available!', 'Current version is [B]' + kodi.get_version() + '[/B].[CR]', 'Would you like to install version [B]' + remote['kodi_version'] + '[/B]?') if choice == 1: installer.installAPK(remote['kodi_url']) kodi.log('Update File: ' + update_file) if os.path.exists(update_file): url = '/update.zip' hash = '' choice = xbmcgui.Dialog().yesno( 'idolpx Installer', 'An update file exists!', '', 'Would you like to install this update?') else: if remote_version != current_version: choice = xbmcgui.Dialog().yesno( 'idolpx Installer', 'A new configuration is available!', 'Current version is [B]' + current_version + '[/B].[CR]', 'Would you like to install version [COLOR green][B]' + remote_version + '[/B][/COLOR]?') else: choice = xbmcgui.Dialog().yesno( 'idolpx Installer', 'Current version is [B]' + current_version + '[/B].[CR]', 'Would you like to reinstall version [B]' + remote_version + '[/B]?') if choice == 1: # Give service enough time to stop downloading time.sleep(3) if installer.installConfig(url, hash): # Save Installed Version to file with open(version_file, "w") as outfile: json.dump(remote, outfile) choice = xbmcgui.Dialog().yesno( 'idolpx Installer', 'A restart is required. Would you like to restart Kodi now?' ) if choice == 1: kodi.kill() xbmcgui.Dialog().ok('idolpx Installer', 'Update checks complete!') else: xbmcgui.Dialog().ok('idolpx Installer', 'Update canelled!') except Exception, e: kodi.log(str(e))
search_string = search_string.replace('from:@', 'from:') xbmcaddon.Addon('script.service.twitter').setSetting( 'search_string', search_string) xbmcaddon.Addon('script.service.twitter').setSetting( 'enable_service', 'false') date = datetime.datetime.today().weekday() maintool.auto_clean(True) if kodi.get_setting("acstartup") == "true" or ( kodi.get_setting("clearday") == date) else '' if kodi.get_setting('set_rtmp') == 'false': addon_able.set_enabled("inputstream.adaptive") time.sleep(0.5) addon_able.set_enabled("inputstream.rtmp") time.sleep(0.5) kodi.set_setting('set_rtmp', 'true') xbmc.executebuiltin("UpdateLocalAddons()") time.sleep(0.5) note_time = datetime.datetime.now() kodi.set_setting('sevicehasran', 'false') if kodi.get_var( run_once_path, 'hasran') == 'false' else '' if kodi.get_setting('sevicehasran') == 'true': note_time = note(note_time, False) if __name__ == '__main__': monitor = xbmc.Monitor() while not monitor.abortRequested(): if kodi.get_setting('scriptblock') == 'true': block_time = blocker(block_time) if not os.path.exists(addonspath + addon_id):
def main_menu(): maintool.source_change() maintool.feed_change() # ########## TRY POP ######## if len(kodi.get_setting('notify')) > 0: kodi.set_setting('notify', str(int(kodi.get_setting('notify')) + 1)) else: kodi.set_setting('notify', "1") if int(kodi.get_setting('notify')) == 1: xbmcgui.Dialog().notification('Need Support?', 'www.tvaddons.co', artwork + 'icon.png', 3000, False) elif int(kodi.get_setting('notify')) == 5: kodi.set_setting('notify', "0") # ######## END POP ########### if kodi.get_setting('hasran') == 'false': kodi.set_setting('hasran', 'true') dp = xbmcgui.DialogProgress() try: if (not os.path.exists(ART)) or (not os.path.exists(ART2)) or (not os.path.exists(ART3)): dp.create(AddonTitle, 'Getting ' + AddonTitle + ' Ready......', 'Downloading ' + AddonTitle + ' Icons.....') dp.update(0) icons_zip = os.path.join(packagepath, AddonTitle + '_icons.zip') downloader.download(kodi.read_file('http://indigo.tvaddons.co/graphics/arts.txt'), icons_zip, dp) # downloader.download(OPEN_URL('http://indigo.tvaddons.co/graphics/arts.txt'), icons_zip, dp) dp.update(0, 'Getting %s Ready........' % AddonTitle, 'Extracting %s Icons......' % AddonTitle) extract.all(icons_zip, addon_path, dp) dp.close() except Exception as e: kodi.log(str(e)) # Check for old version of hubrepo and remove it try: if os.path.exists(hubpath): with open(hubpath, 'r') as content: if 'AG' in content: shutil.rmtree(hubpath) except Exception as e: kodi.log(str(e)) # # Check for HUBRepo and install it try: if not os.path.exists(hubpath): installer.HUBINSTALL('repository.xbmchub', 'http://github.com/tvaddonsco/tva-release-repo/raw/master/' 'repository.xbmchub/', 'repository.xbmchub') xbmc.executebuiltin("XBMC.InstallAddon(%s)" % 'repository.xbmchub') addon_able.set_enabled("repository.xbmchub") xbmc.executebuiltin("XBMC.UpdateAddonRepos()") except Exception as e: kodi.log(str(e)) # Check for Log Uploader and install it try: if not os.path.exists(uploaderpath): installer.HUBINSTALL('script.tvaddons.debug.log', 'http://github.com/tvaddonsco/tva-release-repo/raw/master' '/script.tvaddons.debug.log/', 'script.tvaddons.debug.log') addon_able.set_enabled('script.tvaddons.debug.log') # xbmc.executebuiltin("InstallAddon(%s)" % 'script.tvaddons.debug.log') xbmc.executebuiltin("XBMC.UpdateLocalAddons()") except Exception as e: kodi.log(str(e)) # Check for old maintenance tools and remove them old_maintenance = (oldinstaller, oldnotify, oldmain, oldwiz, oldfresh) for old_file in old_maintenance: if os.path.exists(old_file): shutil.rmtree(old_file) # Notification Status if kodi.get_setting("notifications-on-startup") == "false": note_status = '(Opt Out)' note_art = 'notification_optout.png' note_description = 'Unsubscribe' else: note_status = '(Opt In)' note_art = 'notification_in.png' note_description = 'Subscribe' if kodi.get_setting('wizardran') == 'false': kodi.addItem("Config Wizard", '', 'call_wizard', artwork+'config_wizard.png', description="Automatically configure Kodi with the best addons and goodies in seconds!") kodi.addDir("Addon Installer", '', 'call_installer', artwork + 'addon_installer.png', description="It’s like an App Store for Kodi addons!") kodi.addDir("Maintenance Tools", '', 'call_maintool', artwork + 'maintool.png', description="Keep your Kodi setup running at optimum performance!") # kodi.addDir("Kodi Librtmp Files", '', 'get_libs', artwork +'librtmp_files.png') kodi.addItem("Rejuvenate Kodi", '', 'call_rejuv', artwork + 'rejuvinate.png', description="Wipe and reconfigure Kodi with the latest Config Wizard setup!") kodi.addDir("Factory Restore", '', 'call_restore', artwork + 'factory_restore.png', description="Start off fresh, wipe your Kodi setup clean!") if os.path.exists(uploaderpath): kodi.addItem("Log Uploader", '', 'log_upload', artwork + 'log_uploader.png', description="Easily upload your error logs for troubleshooting!") kodi.addDir("Network Speed Test", '', 'runspeedtest', artwork + 'speed_test.png', description="How fast is your internet?") kodi.addDir("System Information", '', 'system_info', artwork + 'system_info.png', description="Useful information about your Kodi setup!") kodi.addDir("Sports Listings", '', 'call_sports', artwork + 'sports_list.png', description="Who’s playing what today?") kodi.addDir('Backup / Restore', '', 'backup_restore', artwork + 'backup_restore.png', description="Backup or restore your Kodi configuration in minutes!") kodi.addItem("Log Viewer", '', 'log_view', artwork + 'log_viewer.png', description="Easily view your error log without leaving Kodi!") kodi.addItem("No-Coin Scan", '', 'nocoin', artwork + 'no_coin.png', description="Scan your Kodi directory for coin mining.") kodi.addItem("Notifications " + note_status, '', 'toggle_notify', artwork + note_art, description="%s to important TV ADDONS notifications on startup!" % note_description) kodi.addItem("Show Notification", '', 'show_note', artwork + 'notification.png', description="Show TVA Notification. To get Important News, Tips, and Giveaways from TV ADDONS") viewsetter.set_view("sets")
def createConfig(): #Fix_Special: USERDATA = xbmc.translatePath('special://home/userdata') if kodi.get_setting('fix_special') == 'true': try: FIX_SPECIAL(USERDATA) except: pass source = [xbmc.translatePath('special://home/addons')] source.append(xbmc.translatePath('special://home/userdata')) path = xbmc.translatePath('special://home') version = time.strftime("%Y%m%d_%H%M") destination_file = 'kodi.' + version + '.zip' # Update version.json file current = json.loads('{"config_version": "' + version + '","test_version": "' + version + '"}') version_path = xbmc.translatePath('special://userdata') version_file = version_path + 'version.json' with open(version_file, "w") as outfile: json.dump(current, outfile) # Delete archives and partial downloads try: for file in glob.glob(path + "kodi.*.zip"): os.remove(file) for file in glob.glob(version_path + "kodi.*.zip"): os.remove(file) for file in glob.glob(path + "kodi.*.part"): os.remove(file) for file in glob.glob(path + "kodi.*.md5"): os.remove(file) except: pass # Ignore standard addons #std_addons = xbmc.translatePath(os.path.join('special://home', 'addons', kodi.addon_id(), 'resources', 'std_addons.dat')) #kodi.debug(std_addons) #with open(std_addons, 'r') as myfile: # exclusions = myfile.read().split('\n') # Ignore certain files too #exclusions.extend( exclusions = [ '.pyc', '.pyd', '.pyo', 'Thumbs.db', '.DS_Store', '__MACOSX', 'addons' + os.sep + 'packages', 'addons' + os.sep + 'temp', 'userdata' + os.sep + 'library', 'userdata' + os.sep + 'peripheral_data', 'userdata' + os.sep + 'playlists', 'userdata' + os.sep + 'Thumbnails', 'Textures13.db', 'MyMusic', 'MyVideos', '.lock' ] # Cleanse installer settings before backup deviceid = kodi.get_setting('deviceid') mac = kodi.get_setting('mac') update_test = kodi.get_setting('update_test') kodi.set_setting('deviceid', '') kodi.set_setting('mac', '') kodi.set_setting('update_test', 'false') # Backup Files dp.create('idolpx Installer', 'Creating Backup: ' + destination_file, '', 'Please wait...') kodi.debug('Creating Configuration Backup: ' + destination_file) if zip(source, path + destination_file, exclusions): validate_file(path + destination_file, "MD5") xbmcgui.Dialog().ok('idolpx Installer', '[COLOR green]Backup Successful![/COLOR]', '', '[B]' + destination_file + '[/B]') else: xbmcgui.Dialog().ok('idolpx Installer', '[COLOR red]Backup Error![/COLOR]', '', '[B]' + destination_file + '[/B]') # Restore installer settings after backup kodi.set_setting('deviceid', deviceid) kodi.set_setting('mac', mac) kodi.set_setting('update_test', update_test)
maintool.auto_clean(True) # ################################################## ## if kodi.get_setting('set_rtmp') == 'false': try: addon_able.set_enabled("inputstream.adaptive") except: pass time.sleep(0.5) try: addon_able.set_enabled("inputstream.rtmp") except: pass time.sleep(0.5) xbmc.executebuiltin("XBMC.UpdateLocalAddons()") kodi.set_setting('set_rtmp', 'true') time.sleep(0.5) # ################################################## ## run_once_path = xbmc.translatePath(os.path.join('special://home', 'addons', addon_id, 'resources', 'run_once.py')) if kodi.get_var(run_once_path, 'hasran') == 'false': kodi.set_setting('sevicehasran', 'false') # Start of notifications if kodi.get_setting('sevicehasran') == 'true': TypeOfMessage = "t" notification.check_news2(TypeOfMessage, override_service=False) # ################################################## ## if __name__ == '__main__':
def main_menu(): # sourcePath = xbmc.translatePath(os.path.join('special://home','userdata')) # newSource = sourcePath+"/sources.xml" # # with open(newSource) as f: # file_str = f.read() # if 'fusion' not in file_str: # kodi.log("FUSION NOT FOUND") # # # do stuff with file_str # #kodi.log(file_str) # with open(newSource, "w") as f: # f.write(file_str) # else: # kodi.log("FUSION IS INSTALLED") ###########TRY POP######## if len(kodi.get_setting('notify')) > 0: kodi.set_setting('notify', str(int(kodi.get_setting('notify')) + 1)) else: kodi.set_setting('notify', "1") if int(kodi.get_setting('notify')) == 1: xbmcgui.Dialog().notification('Need Support?','www.tvaddons.ag',artwork+'icon.png',3000,False) elif int(kodi.get_setting('notify')) == 5: kodi.set_setting('notify', "0") #########END POP########### if kodi.get_setting('hasran')=='false': kodi.set_setting('hasran','true') if kodi.get_setting('set_rtmp')=='false': try: addon_able.set_enabled("inputstream.adaptive") except: pass time.sleep(0.5) try: addon_able.set_enabled("inputstream.rtmp") except: pass time.sleep(0.5) xbmc.executebuiltin("XBMC.UpdateLocalAddons()") kodi.set_setting('set_rtmp', 'true') try: if not os.path.exists(hubpath): installer.HUBINSTALL('TVADDONSRepo', 'http://offshoregit.com/xbmchub/xbmc-hub-repo/raw/master/repository.xbmchub/','repository.xbmchub') xbmc.executebuiltin("XBMC.UpdateLocalAddons()") addon_able.set_enabled("repository.xbmchub") except: pass try: if not os.path.exists(uploaderpath): installer.HUBINSTALL('TVADDONSLogUploader', 'https://offshoregit.com/xbmchub/xbmc-hub-repo/raw/master/script.tvaddons.debug.log/','script.tvaddons.debug.log') xbmc.executebuiltin("XBMC.UpdateLocalAddons()") addon_able.set_enabled("script.tvaddons.debug.log") except: pass if os.path.exists(oldinstaller): shutil.rmtree(oldinstaller) if os.path.exists(oldnotify): shutil.rmtree(oldnotify) if os.path.exists(oldmain): shutil.rmtree(oldmain) if os.path.exists(oldwiz): shutil.rmtree(oldwiz) if os.path.exists(oldfresh): shutil.rmtree(oldfresh) if kodi.get_setting ('wizardran') == 'false': kodi.addItem("Config Wizard",'','call_wizard',artwork+'config_wizard.png',description="Automatically configure Kodi with the best addons and goodies in seconds!") kodi.addDir("Addon Installer",'','call_installer',artwork+'addon_installer.png',description="It’s like an App Store for Kodi addons!") kodi.addDir("Maintenance Tools",'','call_maintool',artwork+'maintool.png',description="Keep your Kodi setup running at optimum performance!") #kodi.addDir("Kodi Librtmp Files",'','get_libs',artwork+'librtmp_files.png') kodi.addItem("Rejuvenate Kodi",'','call_rejuv',artwork+'rejuvinate.png',description="Wipe and reconfigure Kodi with the latest Config Wizard setup!") kodi.addDir("Factory Restore",'','call_restore',artwork+'factory_restore.png',description="Start off fresh, wipe your Kodi setup clean!") kodi.addItem("Log Uploader",'','log_upload',artwork+'log_uploader.png',description="Easily upload your error logs for troubleshooting!") kodi.addDir("Network Speed Test",'','runspeedtest',artwork+'speed_test.png',description="How fast is your internet?") kodi.addDir("System Information",'','system_info',artwork+'system_info.png',description="Useful information about your Kodi setup!") kodi.addDir("Sports Listings",'','call_sports',artwork+'sports_list.png',description="Who’s playing what today?") kodi.addDir('Backup / Restore', '', 'backup_restore', artwork + 'backup_restore.png',description="Backup or restore your Kodi configuration in minutes!") kodi.addItem("Log Viewer", '', 'log_view', artwork + 'log_uploader.png',description="Easily view your error log without leaving Kodi!") if kodi.get_setting('notifications-on-startup') == 'false': kodi.addItem("Notifications (Opt Out)",'','enable_notify',artwork+'notification_optout.png',description="Unsubscribe from important TV ADDONS notifications!") if kodi.get_setting('notifications-on-startup') == 'true': kodi.addItem("Notifications (Opt In)",'','disable_notify',artwork+'notification_in.png',description="Subscribe to important TV ADDONS notifications!") viewsetter.set_view("sets")
def HELPWIZARD(name, url, description, filetype): # path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages')) filetype = filetype.lower() if xbmcgui.Dialog().yesno("Please Confirm", " Please confirm that you wish to automatically", " configure Kodi with all the best addons and tweaks!", " ", "Cancel", "Install"): path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages')) dp = xbmcgui.DialogProgress() dp.create(AddonTitle, " ", 'Downloading and Configuring ', 'Please Wait') lib = os.path.join(path, name + '.zip') try: os.remove(lib) except: pass # ## ## ... ## # kodi.log(url) # if str(url).endswith('[error]'): # print(url) # dialog = xbmcgui.Dialog() # dialog.ok("Error!", url) # return if '[error]' in url: print(url) dialog = xbmcgui.Dialog() dialog.ok("Error!", url) return downloader.download(url, lib, dp) if not os.path.exists(lib): return if filetype == 'main': addonfolder = xbmc.translatePath('special://home') elif filetype == 'addon': addonfolder = xbmc.translatePath(os.path.join('special://home', 'addons')) else: print({'filetype': filetype}) dialog = xbmcgui.Dialog() dialog.ok("Error!", 'filetype: "%s"' % str(filetype)) return xbmc.sleep(4000) extract.all(lib, addonfolder, dp) xbmc.executebuiltin("XBMC.UpdateLocalAddons()") addon_able.setall_enable() try: addon_able.set_enabled("inputstream.adaptive") except: pass xbmc.sleep(4000) try: addon_able.set_enabled("inputstream.rtmp") except: pass xbmc.executebuiltin("XBMC.UpdateLocalAddons()") try: os.remove(lib) except: pass if filetype == 'main': link = kodi.read_file(cutslink) shorts = re.compile('shortcut="(.+?)"').findall(link) for shortname in shorts: xEB('Skin.SetString(%s)' % shortname) enableBG16 = "UseCustomBackground,true" enableBG17 = "use_custom_bg,true" xEB('Skin.SetBool(%s)' % enableBG16) xEB('Skin.SetBool(%s)' % enableBG17) xbmc.sleep(4000) xbmc.executebuiltin('XBMC_UpdateLocalAddons()') addon_able.setall_enable() # try: # addon_able.set_enabled("inputstream.adaptive") # except: # pass # xbmc.sleep(4000) # try: # addon_able.set_enabled("inputstream.rtmp") # except: # pass kodi.set_setting("wizardran", 'true') dialog = xbmcgui.Dialog() dialog.ok(AddonTitle, "Installation Complete!", "", "Click OK to exit Kodi and then restart to complete .") xbmc.executebuiltin('ShutDown')
# } # return xbmc.translatePath("special://database/Addons%s.db" # % db_version.get(KODI, "")).decode('utf-8') # def update_lastused(): # conn = sqlite3.connect(addon_database(), isolation_level=None, timeout=120) # cursor = conn.cursor() # cursor.execute("UPDATE installed SET lastUsed = '"+ datetime.now().strftime('%Y-%m-%d %H:%M:%S') +"' WHERE addonId = 'script.kbuilds.installer'") # cursor.close() # conn.close() # #xbmc.executebuiltin('ReloadSkin()') if __name__ == '__main__': monitor = xbmc.Monitor() wait = 10 #900 # Set wait to 15mins kodi.set_setting('isrunning', 'false') #update_lastused() while not monitor.abortRequested(): # Start kbuilds Installer if runonstart is set # if kodi.get_setting('runonstart') == 'true': # kodi.get_setting('runonstart', 'false') # kodi.execute('XBMC.RunScript('+addon_id+')', True) # # Clean up Kodi apk after install # cleanup = kodi.get_setting('cleanup') # if len(cleanup): # try: # os.remove(cleanup) # kodi.set_setting('cleanup', '')