def fullspeedtest(): # speed_test = base64.b64decode("aHR0cDovL2luZGlnby50dmFkZG9ucy5hZy9zcGVlZHRlc3Qvc3BlZWR0ZXN0ZmlsZS50eHQ=") speed_test = 'http://www.engineerhammad.com/2015/04/Download-Test-Files.html' try: # link = OPEN_URL(speed_test) link = kodi.read_file(speed_test) match = re.findall('href="([^"]*)".+src="([^"]*)"[^\d]*(\d+\s[^b]*b)', link) for m_url, m_iconimage, m_name in reversed(match): m_iconimage = artwork + str(m_name).replace(' ', '').lower() + '.png' if 'mb' in m_iconimage and not os.path.isfile(m_iconimage): m_iconimage = m_iconimage.replace('mb', '') if m_name not in '10 Gb': kodi.add_item('[COLOR ghostwhite]' + m_name + '[/COLOR]', m_url, "runtest", m_iconimage, description='Test with a ' + m_name + ' file') except Exception as e: kodi.log(str(e)) import traceback traceback.print_exc(file=sys.stdout) kodi.add_item('[COLOR ghostwhite]Speed Test is unavailable[/COLOR]', '', "", artwork + 'speed_test.png', description='') viewsetter.set_view("sets")
def what_sports(): # ####### AMERICAN ############### kodi.add_item('[COLOR blue][B]US Sports[/COLOR][/B]', '', '', artwork + 'icon.png', description='[COLOR gold]Sports from around the US[/COLOR]') link = kodi.read_file('https://www.tvguide.com/sports/live-today/') match1 = re.search('(?s)"button-picker-divider"(.+?</html>)', link) if match1: pattern = '(?s)title="([^"]*)".+?-link.+?item">([^<]*)<.+?item">([^<]*)<.+?font-base">([^<]*)<' for m_name, m_time, m_channel, m_description in re.findall( pattern, match1.group(1)): kodi.add_item( '[COLOR white][B]%s[/COLOR][/B] - [COLOR gold]%s[/COLOR][COLOR white][B] | %s[/COLOR][/B]' % (m_time.lower(), name_cleaner(m_name), m_channel), '', '', artwork + 'icon.png', description= '[COLOR gold][B]%s - %s[/COLOR][/B][COLOR white] - %s | %s[/COLOR]' % (m_description, name_cleaner(m_name), m_time.lower(), m_channel)) # ####### UK ############### kodi.add_item('[COLOR blue][B]UK Sports[/COLOR][/B]', '', '', artwork + 'icon.png', description='[COLOR gold]Sports from around the UK[/COLOR]') link = kodi.read_file('http://www.wheresthematch.com/') pattern = '(?s)fixture-details">(.+?)t-details">(.+?)-name">(.+?)l-details">(.+?)</td>' for m_game, m_time, m_league, m_channels in re.findall(pattern, link): g_time = re.search('<strong>([^<]*)<', m_time) g_time = g_time.group(1).replace('00:', '12:').strip('0').replace( ' ', '') if g_time else '' g_league = re.search('<span>([^<]*)<', m_league) g_league = g_league.group(1).rstrip() if g_league else '' g_name = '' for team1, team2 in re.findall( '(?s).asp">[^>]*>([^<]+)<.+?asp.+?">([^<]*)', m_game): g_name = '%s vs %s' % (team1.strip(), team2.strip()) if m_game else '' channels = '' for channel in re.findall('title=".+?on ([^"]*)"', m_channels): for chan in ('&', 'tv app', 'sky'): channel = channel.replace( 'on ', '') if chan.lower() not in channel.lower() else '' channels += '' + channel if not channels else ', ' + channel if channel else '' kodi.add_item( '[COLOR white][B]%s[/COLOR][/B] - [COLOR gold]%s - %s[/COLOR][COLOR white][B] | %s[/COLOR][/B]' % (g_time, g_league, g_name, channels), '', '', artwork + 'icon.png', description= '[COLOR gold][B]%s - %s[/COLOR][/B] - [COLOR white]%s | %s[/COLOR]' % (g_name, g_league, g_time, channels)) viewsetter.set_view("tvshows")
def rtmp_lib(): liblist = "http://indigo.tvaddons.co/librtmp/rtmplist.txt" try: # link = OPEN_URL(liblist).replace('\n', '').replace('\r', '') link = kodi.read_file(liblist).replace('\n', '').replace('\r', '') except Exception as e: kodi.log(str(e)) kodi.add_item('[COLOR gold][B]This service is currently unavailable.[/COLOR][/B]', '', 100, '', '', '') return match = re.compile('name="(.+?)".+?rl="(.+?)".+?ersion="(.+?)"').findall(link) kodi.add_item('[COLOR gold][B]Files Will Be Donwloaded to the Kodi Home directory,' 'You Will Need To Manually Install From There.[/COLOR][/B]', '', 100, '', '', '') # kodi.add_item('[COLOR gold]--------------------------------------------------------[/COLOR]', '', 100, '',' ', '') for m_name, m_url, m_description in match: kodi.add_dir(m_name, m_url, "lib_installer", artwork + 'icon.png') viewsetter.set_view("sets")
def backup_menu(): kodi.add_item( '[COLOR white]Select Backup Location[/COLOR]', 'url', 'display_backup_settings', '', description= "Choose the location to which you wish to store your backups!") kodi.add_item( '[COLOR white]Full Backup (All Files and Folders Included)[/COLOR]', 'url', 'full_backup', '', description="Backup everything possible!") kodi.add_item( '[COLOR white]Backup No Database (No Database Files Included)[/COLOR]', 'url', 'small_backup', '', description= "Backup your Kodi configuration without unnecessary database files!") kodi.add_dir('[COLOR white]Restore Backup[/COLOR]', '', 'do_backup_restore', '', description="Restore your Kodi configuration from a backup!") kodi.add_dir('[COLOR white]Delete Backup[/COLOR]', '', 'del_backup', '', description="Erase any backups you have saved!") viewsetter.set_view("sets")
def main_index(): xbmc.executebuiltin("UpdateAddonRepos") kodi.add_item("Git Browser", '', 'github_main', artwork + 'github_browser.png', description="Search for repositories hosted on GitHub.") try: if len(str(api.get_all_addons())) < 20: raise ValueError('API is less than 20') kodi.add_dir('Search by: Addon/Author', '', 'searchaddon', artwork + 'search.png', description="Search for addons by Name or Author") if settings.getSetting('featured') == 'true': kodi.add_dir('Featured Addons', 'featured', 'addonlist', artwork + 'featured.png', description="The most popular Kodi addons!") # if settings.getSetting('livetv') == 'true': # kodi.add_dir('Live TV Addons', 'live', 'addonlist', artwork + 'livetv.png', # description="The most popular live TV addons!") # if settings.getSetting('sports') == 'true': # kodi.add_dir('Sports Addons', 'sports', 'addonlist', artwork + 'sports.png', # description="The most popular sports addons!") if settings.getSetting('video') == 'true': kodi.add_dir('Video Addons', 'video', 'addonlist', artwork + 'video.png', description="Every video addon in existence!") if settings.getSetting('audio') == 'true': kodi.add_dir('Audio Addons', 'audio', 'addonlist', artwork + 'audio.png', description="Find addons to listen to music!") if settings.getSetting('program') == 'true': kodi.add_dir('Program Addons', 'executable', 'addonlist', artwork + 'program.png', description="Every program addon you can imagine!") # if settings.getSetting('playlist') == 'true': # kodi.add_dir('Playlist Addons', 'playlists', 'addonlist', artwork + 'playlists.png', # description="The most popular playlist addons!") if settings.getSetting('services') == 'true': kodi.add_dir('Service Addons', 'service', 'addonlist', artwork + 'service.png') if settings.getSetting('skincat') == 'true': kodi.add_dir('Kodi Skins', 'skins', 'addonlist', artwork + 'kodi_skins.png', description="Change up your look!") if settings.getSetting('world') == 'true': kodi.add_dir('International Addons', 'international', 'interlist', artwork + 'world.png', description="Foreign language addons and repos from across the globe!") if settings.getSetting('adult') == 'true': kodi.add_dir('Adult Addons', 'xxx', 'adultlist', artwork + 'adult.png', description="Must be 18 years or older! This menu can be disabled from within Add-on Settings.") # if settings.getSetting('repositories') == 'true': # kodi.add_dir('Repositories','repositories', 'addonlist', artwork + 'repositories.png', # description="Browse addons by repository!") except Exception as e: kodi.log(str(e)) traceback.print_exc(file=sys.stdout) kodi.add_item("Addon Listing Is Temporarily Unavailable", '', '', artwork1 + 'addon_installer.png', description="The Addon Listing Is Temporarily Unavailable") # kodi.add_item('Enable Live Streaming', 'None', 'EnableRTMP', artwork + 'enablertmp.png', # description="Enable RTMP InputStream and InputStream Adaptive modules for Live Streaming.") kodi.add_item('Official OpenSubtitles Addon', openSub, 'addopensub', artwork + 'opensubicon.png', description="Install Official OpenSubtitles Addon!") kodi.add_dir('Install ZIP from Online Link', '', 'urlzip', artwork + 'onlinesource.png', description='Manually download and install addons or repositories from the web.') viewsetter.set_view("sets")
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......\nDownloading ' + 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) dp.update(0, 'Getting %s Ready........' % AddonTitle, 'Extracting %s Icons......' % AddonTitle) extract.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 + '/addon.xml', '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.hub_install('repository.xbmchub', 'http://github.com/tvaddonsco/tva-release-repo/raw/master/' 'repository.xbmchub/') # xbmc.executebuiltin("XBMC.InstallAddon(%s)" % 'repository.xbmchub') addon_able.set_enabled("repository.xbmchub") except Exception as e: kodi.log(str(e)) traceback.print_exc(file=sys.stdout) raise # Check for Log Uploader and install it try: if not os.path.exists(uploaderpath): installer.hub_install('script.tvaddons.debug.log', 'http://github.com/tvaddonsco/tva-release-repo/raw/' 'master/script.tvaddons.debug.log/') addon_able.set_enabled('script.tvaddons.debug.log') except Exception as e: kodi.log(str(e)) raise # 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.add_item("Config Wizard", '', 'call_wizard', artwork+'config_wizard.png', description="Automatically configure Kodi with the best addons and goodies in seconds!") kodi.add_dir("Addon Installer", '', 'call_installer', artwork + 'addon_installer.png', description="It’s like an App Store for Kodi addons!") kodi.add_dir("Maintenance Tools", '', 'call_maintool', artwork + 'maintool.png', description="Keep your Kodi setup running at optimum performance!") # kodi.add_dir("Kodi Librtmp Files", '', 'get_libs', artwork +'librtmp_files.png') kodi.add_item("Rejuvenate Kodi", '', 'call_rejuv', artwork + 'rejuvinate.png', description="Wipe and reconfigure Kodi with the latest Config Wizard setup!") kodi.add_dir("Factory Restore", '', 'call_restore', artwork + 'factory_restore.png', description="Start off fresh, wipe your Kodi setup clean!") if os.path.exists(uploaderpath): kodi.add_item("Log Uploader", '', 'log_upload', artwork + 'log_uploader.png', description="Easily upload your error logs for troubleshooting!") kodi.add_dir("Network Speed Test", '', 'runspeedtest', artwork + 'speed_test.png', description="How fast is your internet?") kodi.add_dir("System Information", '', 'system_info', artwork + 'system_info.png', description="Useful information about your Kodi setup!") kodi.add_dir("Sports Listings", '', 'call_sports', artwork + 'sports_list.png', description="Who’s playing what today?") kodi.add_dir('Backup / Restore', '', 'backup_restore', artwork + 'backup_restore.png', description="Backup or restore your Kodi configuration in minutes!") kodi.add_item("Log Viewer", '', 'log_view', artwork + 'log_viewer.png', description="Easily view your error log without leaving Kodi!") kodi.add_item("No-Coin Scan", '', 'nocoin', artwork + 'no_coin.png', description="Scan your Kodi directory for coin mining.") kodi.add_item("Notifications " + note_status, '', 'toggle_notify', artwork + note_art, description="%s to important TV ADDONS notifications on startup!" % note_description) kodi.add_item("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 system_info(): systime = xbmc.getInfoLabel('System.Time ') dns1 = xbmc.getInfoLabel('Network.DNS1Address') gateway = xbmc.getInfoLabel('Network.GatewayAddress') ipaddy = xbmc.getInfoLabel('Network.IPAddress') linkstate = xbmc.getInfoLabel('Network.LinkState').replace("Link:", "") freespace, totalspace = maintool.get_free_space_mb(os.path.join(kodi.translate_path('special://home'))) freespace = maintool.convert_size(freespace) totalspace = maintool.convert_size(totalspace) screenres = xbmc.getInfoLabel('system.screenresolution') freemem = maintool.convert_size(maintool.revert_size(xbmc.getInfoLabel('System.FreeMemory'))) # FIND WHAT VERSION OF KODI IS RUNNING # xbmc_version = xbmc.getInfoLabel("System.BuildVersion") # versioni = xbmc_version[:4] # codename = kodi.get_codename() # Get External IP Address try: # ext_ip = ("blue", OPEN_URL('https://api.ipify.org')) ext_ip = ("blue", kodi.read_file('https://api.ipify.org')) except Exception as e: kodi.log(str(e)) try: # link = OPEN_URL('http://whatismyip.network/') link = kodi.read_file('http://whatismyip.network/') ext_ip = ("blue", re.search('>My IP Address[^=]*[^>]*>([^<]*)', link).group(1)) except TypeError: ext_ip = ("red", "IP Check Not Available") # Get Python Version pv = sys.version_info # System Information Menu # kodi.add_item('[COLOR ghostwhite]Version: [/COLOR][COLOR lime] %s %s[/COLOR]' % (codename, versioni), # '', 100, artwork + 'icon.png', "", description=" ") kodi.add_item('[COLOR ghostwhite]Version: [/COLOR][COLOR lime] %s %s[/COLOR]' % (kodi.get_codename(), xbmc.getInfoLabel("System.BuildVersion").split('Git')[0]), '', 100, artwork + 'icon.png', "", description=" ") kodi.add_item('[COLOR ghostwhite]System Time: [/COLOR][COLOR lime] %s[/COLOR]' % systime, '', 100, artwork + 'icon.png', "", description=" ") kodi.add_item('[COLOR ghostwhite]Gateway: [/COLOR][COLOR blue] %s[/COLOR]' % gateway, '', 100, artwork + 'icon.png', "", description=" ") kodi.add_item('[COLOR ghostwhite]Local IP: [/COLOR][COLOR blue] %s[/COLOR]' % ipaddy, '', 100, artwork+'icon.png', "", description=" ") kodi.add_item('[COLOR ghostwhite]External IP: [/COLOR][COLOR %s] %s[/COLOR]' % ext_ip, '', 100, artwork + 'icon.png', "", description=" ") kodi.add_item('[COLOR ghostwhite]DNS 1: [/COLOR][COLOR blue] %s[/COLOR]' % dns1, '', 100, artwork + 'icon.png', "", description=" ") kodi.add_item('[COLOR ghostwhite]Network: [/COLOR][COLOR gold] %s[/COLOR]' % linkstate, '', 100, artwork + 'icon.png', "", description=" ") if str(totalspace) != '0 B': kodi.add_item('[COLOR ghostwhite]Total Disc Space: [/COLOR][COLOR gold] %s[/COLOR]' % totalspace, '', 100, artwork + 'icon.png', "", description=" ") if str(freespace) != '0 B': kodi.add_item('[COLOR ghostwhite]Free Disc Space: [/COLOR][COLOR gold] %s[/COLOR]' % freespace, '', 100, artwork + 'icon.png', "", description=" ") kodi.add_item('[COLOR ghostwhite]Free Memory: [/COLOR][COLOR gold] %s[/COLOR]' % freemem, '', 100, artwork + 'icon.png', "", description=" ") kodi.add_item('[COLOR ghostwhite]Resolution: [/COLOR][COLOR gold] %s[/COLOR]' % screenres, '', 100, artwork + 'icon.png', "", description=" ") kodi.add_item('[COLOR ghostwhite]Python Version: [/COLOR][COLOR lime] %d.%d.%d[/COLOR]' % (pv[0], pv[1], pv[2]), '', 100, artwork + 'icon.png', "", description=" ") viewsetter.set_view("files")
def tool_menu(): menu_cache_path = cache_path if not os.path.exists(temp_path) and not os.path.exists(cache_path): os.makedirs(temp_path) if os.path.exists(temp_path): menu_cache_path = temp_path if not os.path.exists(packages_path): os.makedirs(packages_path) cache_size = '' thumb_size = '' packages_size = '' paths = { menu_cache_path: cache_size, thumbnail_path: thumb_size, packages_path: packages_size } if kodi.get_setting("maint_check_folders") == "true": for path in paths: try: paths[path] = ' - [COLOR blue]' + convert_size( get_size(path)) + '[/COLOR]' except Exception as e: kodi.log(str(e)) paths[path] = ' - [COLOR red]Error reading thumbnails[/COLOR]' startup_clean = kodi.get_setting("acstartup") if startup_clean == "false": startup_onoff = "Enable" su_art = 'enable_am_startup.png' else: startup_onoff = "Disable" su_art = 'disable_am_startup.png' su_desc = startup_onoff + " maintenance on Kodi launch!" weekly_clean = kodi.get_setting("clearday") if weekly_clean == "7": weekly_onoff = "Enable" acw_art = 'enable_am_week.png' acw_desc = "Set your device to perform maintenance on a given day each week!" else: weekly_onoff = "Disable" acw_art = 'disable_am_week.png' acw_desc = weekly_onoff + " weekly maintenance on Kodi launch!" if kodi.get_setting('scriptblock') == 'false': scb_onoff = 'Enable' # scb_mode = 'toggleblocker' scb_art = 'enable_MSB.png' else: scb_onoff = 'Disable' # scb_mode = 'toggleblocker' scb_art = 'enable_MSB.png' scb_desc = scb_onoff + " protection against malicious scripts!" if not _is_debugging(): debug_onoff = 'Enable' debug_art = 'enabledebug.png' else: debug_onoff = 'Disable' debug_art = 'disabledebug.png' debug_desc = debug_onoff + " Debugging!" # Maintenance Tool Menu kodi.add_item("Clear Cache " + str(paths[menu_cache_path]), '', 'clear_cache', artwork + 'currentcache.png', description="Clear your device cache!") kodi.add_item("Delete Thumbnails " + str(paths[thumbnail_path]), '', 'clear_thumbs', artwork + 'currentthumbs.png', description="Delete your Thumbnail cache!") kodi.add_item("Delete Packages " + str(paths[packages_path]), '', 'purge_packages', artwork + 'currentpackages.png', description="Delete your addon installation files!") kodi.add_item("Delete Crash Logs", '', 'crashlogs', artwork + 'clearcrash.png', description="Clear all crash logs from your device!") kodi.add_item("Delete Textures13.db", '', 'deletetextures', artwork + 'currentthumbs.png', description="This will delete the Textures13 database") kodi.add_dir("Wipe Addons", '', 'wipe_addons', artwork + 'wipe_addons.png', description="Erase all your Kodi addons in one shot!") kodi.add_item( "Run Auto Maintenance", '', 'autoclean', artwork + 'run_am.png', description= "Clear your cache, thumbnails and delete addon packages in one click!") kodi.add_item(startup_onoff + ' Auto Maintenance on Startup', '', 'autocleanstartup', artwork + su_art, description=su_desc) kodi.add_item(weekly_onoff + ' Weekly Auto Maintenance', '', 'autocleanweekly', artwork + acw_art, description=acw_desc) kodi.add_item(debug_onoff + " Debugging Mode", '', 'debug_onoff', artwork + debug_art, description=debug_desc) kodi.add_item(scb_onoff + " Malicious Scripts Blocker", '', 'toggleblocker', artwork + scb_art, description=scb_desc) kodi.add_item( "Force Update Addons", '', 'updateaddons', artwork + 'forceupdateaddons.png', description="Force a reload of all Kodi addons and repositories!") kodi.add_dir( "Install Custom Keymaps", '', 'customkeys', artwork + 'custom_keymaps.png', description= "Get the best experience out of your device-specific remote control!") kodi.add_item("Reload Current Skin", '', 'reloadskin', artwork + 'reloadskin.png', description="Reload the skin!") viewsetter.set_view("sets")
def restore(): if zip_path != 'Click Here': for zip_file in os.listdir(zip_path): if zip_file.endswith(".zip"): url = xbmc.translatePath(os.path.join(zip_path, zip_file)) kodi.add_item(zip_file, url, 'read_zip', '', '', '')