def rtmp_lib(): liblist = "http://indigo.tvaddons.co/librtmp/rtmplist.txt" try: link = OPEN_URL(liblist).replace('\n', '').replace('\r', '') except: kodi.addItem('[COLOR gold][B]This service is currently unavailable.[/COLOR][/B]', '', 100, '', '', '') return match = re.compile('name="(.+?)".+?rl="(.+?)".+?ersion="(.+?)"').findall(link) kodi.addItem('[COLOR gold][B]Files Will Be Donwloaded to the Kodi Home directory, You Will Need To Manually Install From There.[/COLOR][/B]', '', 100, '', '', '') # kodi.addItem('[COLOR gold]---------------------------------------------------------[/COLOR]', '', 100, '',' ', '') for name, url, description in match: kodi.addDir(name, url, "lib_installer", artwork + 'icon.png') viewsetter.set_view("sets")
def what_sports(): link = OPEN_URL('http://www.wheresthematch.com/tv/home.asp').replace('\r', '').replace('\n', '').replace('\t', '') match = re.compile('href="http://www.wheresthematch.com/fixtures/(.+?).asp.+?class="">(.+?)</em> <em class="">v</em> <em class="">(.+?)</em>.+?time-channel ">(.+?)</span>').findall(link) for game, name1, name2, gametime in match: kodi.addItem('[COLOR gold][B]' + game + ' ' + '[/COLOR][/B]- [COLOR white]' + name1 + ' vs ' + name2 + ' - ' + gametime + ' [/COLOR]', '', '', artwork + 'icon.png', description='[COLOR gold][B]'+game+' '+'[/COLOR][/B]- [COLOR white]'+name1+' vs '+name2+' - '+gametime+' [/COLOR]') xbmc.executebuiltin("Container.SetViewMode(55)") # #######AMERICAN############### link = OPEN_URL('http://www.tvguide.com/sports/live-today/').replace('\r', '').replace('\n', '').replace('\t', '') sections = dom_parser.parse_dom(link, 'div', {'class': "listings-program-content"}) listings = dom_parser.parse_dom(sections, 'span', {'class': "listings-program-link"}) for stuff in sections: match = re.compile('class="listings-program-link">(.+?)</span></h3>.+?class="listings-program-link">.+?listings-program-airing-info">(.+?)</p><p.+?description">(.+?)</p>').findall(stuff) for name, time, description in match: kodi.addItem('[COLOR gold][B]' + name_cleaner(name) + ' ' + '[/COLOR][/B]- [COLOR white]' + ' - ' + time + ' [/COLOR]','', '', artwork + 'icon.png',description='[COLOR gold][B]' + name_cleaner(name) + ' ' + '[/COLOR][/B]- [COLOR white]' + ' - ' + time + ' [/COLOR]') viewsetter.set_view("files")
def MAININDEX(): kodi.addItem("Git Browser", '', 'github_main', artwork + 'github_browser.png', description="Search for repositories hosted on GitHub.") kodi.addDir('Search by: Addon/Author', '', 'searchaddon', artwork + 'search.png', description="Search for addons by Name or Author") if settings.getSetting('featured') == 'true': kodi.addDir('Featured Addons', 'featured', 'addonlist', artwork + 'featured.png', description="The most popular Kodi addons!") # if settings.getSetting('livetv') == 'true': # kodi.addDir('Live TV Addons', 'live', 'addonlist', artwork + 'livetv.png', # description="The most popular live TV addons!") # if settings.getSetting('sports') == 'true': # kodi.addDir('Sports Addons', 'sports', 'addonlist', artwork + 'sports.png', # description="The most popular sports addons!") if settings.getSetting('video') == 'true': kodi.addDir('Video Addons', 'video', 'addonlist', artwork + 'video.png', description="Every video addon in existence!") if settings.getSetting('audio') == 'true': kodi.addDir('Audio Addons', 'audio', 'addonlist', artwork + 'audio.png', description="Find addons to listen to music!") if settings.getSetting('program') == 'true': kodi.addDir('Program Addons', 'executable', 'addonlist', artwork + 'program.png', description="Every program addon you can imagine!") # if settings.getSetting('playlist') == 'true': # kodi.addDir('Playlist Addons', 'playlists', 'addonlist', artwork + 'playlists.png', # description="The most popular playlist addons!") if settings.getSetting('services') == 'true': kodi.addDir('Service Addons', 'service', 'addonlist', artwork + 'service.png') if settings.getSetting('skincat') == 'true': kodi.addDir('Kodi Skins', 'skins', 'addonlist', artwork + 'kodi_skins.png', description="Change up your look!") if settings.getSetting('world') == 'true': kodi.addDir('International Addons', 'international', 'interlist', artwork + 'world.png', description="Foreign language addons and repos from across the globe!") if settings.getSetting('adult') == 'true': kodi.addDir('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.addDir('Repositories','repositories', 'addonlist', artwork + 'repositories.png', # description="Browse addons by repository!") # kodi.addItem('Enable Live Streaming', 'None', 'EnableRTMP', artwork + 'enablertmp.png', # description="Enable RTMP InputStream and InputStream Adaptive modules for Live Streaming.") kodi.addItem('Official OpenSubtitles Addon', openSub, 'addopensub', artwork + 'opensubicon.png', description="Install Official OpenSubtitles Addon!") kodi.addDir('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 fullspeedtest(): # speed_test = base64.b64decode("aHR0cDovL2luZGlnby50dmFkZG9ucy5hZy9zcGVlZHRlc3Qvc3BlZWR0ZXN0ZmlsZS50eHQ=") speed_test = 'http://www.engineerhammad.com/2015/04/Download-Test-Files.html' try: link = OPEN_URL(speed_test) match = re.findall('href="([^"]*)".+src="([^"]*)".+\n.+?(\d+\s[^b]*b)', link) for url, iconimage, name in reversed(match): iconimage = artwork + str(name).replace(' ', '').lower() + '.png' if 'mb'in iconimage and not os.path.isfile(iconimage): iconimage = iconimage.replace('mb', '') kodi.addItem('[COLOR ghostwhite]' + name + '[/COLOR]', url, "runtest", iconimage, description='Test with a ' + name + ' file') # link = OPEN_URL(speed_test).replace('\n', '').replace('\r', '') # match = re.compile('name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?ersion="(.+?)"').findall(link) # for name, url, iconimage, fanart, description in match: # kodi.addItem('[COLOR ghostwhite]' + name + " | " + description + '[/COLOR]', url, "runtest", artwork + 'speed_test.png', description=description) except: kodi.addItem('[COLOR ghostwhite]Speed Test is unavailable[/COLOR]', '', "", artwork + 'speed_test.png', description='') viewsetter.set_view("sets")
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="([^"]*)".+\n.+?(\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', '') kodi.addItem('[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.addItem('[COLOR ghostwhite]Speed Test is unavailable[/COLOR]', '', "", artwork + 'speed_test.png', description='') viewsetter.set_view("sets")
def backup_menu(): kodi.addItem('[COLOR white]Select Backup Location[/COLOR]', 'url', 'display_backup_settings', '', description="Choose the location to which you wish to store your backups!") kodi.addItem('[COLOR white]Full Backup (All Files and Folders Included)[/COLOR]', 'url', 'full_backup', '', description="Backup everything possible!") kodi.addItem('[COLOR white]Backup No Database (No Database Files Included)[/COLOR]', 'url', 'small_backup', '', description="Backup your Kodi configuration without unnecessary database files!") kodi.addDir('[COLOR white]Restore Backup[/COLOR]', '', 'do_backup_restore', '', description="Restore your Kodi configuration from a backup!") kodi.addDir('[COLOR white]Delete Backup[/COLOR]', '', 'del_backup', '', description="Erase any backups you have saved!") viewsetter.set_view("sets")
def what_sports(): # ####### AMERICAN ############### kodi.addItem('[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/') pattern = '(?s)program-link">([^<]*)<.+?info">([^\|]*)\| ([^<]*)<.+?description">([^<]*)' for m_name, m_time, m_channel, m_description in re.findall(pattern, link): kodi.addItem('[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.addItem('[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/').replace('\r', '').replace('\n', '').replace('\t', '') pattern = '(?s)fixture-details">(.+?)t-details">(.+?)-name">(.+?)l-details">(.+?).png' 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).strip('0').replace(' ', '') if g_time else '' league = re.search('<span>([^<]*)', m_league) g_league = ' - ' + league.group(1) if league else '' g_name = '' for team1, team2 in re.findall('(?s).asp">[^>]*>([^<]+)<.+?asp.+?">([^<]*)', m_game): g_name = '- %s vs %s' % (team1, team2) if m_game else '' if '<strong class=' in m_game: game = re.search('<strong class="">([^<]*)', m_game) g_name = ' - ' + game.group(1) if game and league != game.group(1) else '' channels = '' for channel in re.findall('-name">([^<]*)', m_channels): channels += ' ' + channel if not channels else ', ' + channel kodi.addItem('[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_time, g_name, g_league, channels)) viewsetter.set_view("tvshows")
def restore(): for zip_file in os.listdir(zip_path): if zip_file.endswith(".zip"): url = xbmc.translatePath(os.path.join(zip_path, zip_file)) kodi.addItem(zip_file, url, 'read_zip', '', '', '')
def MAININDEX(): kodi.addDir('Search by: Addon/Author', '', 'searchaddon', artwork + 'search.png', description="Search for addons by Name or Author") if settings.getSetting('featured') == 'true': kodi.addDir('Featured Addons', 'featured', 'addonlist', artwork + 'featured.png', description="The most popular Kodi addons!") # if settings.getSetting('livetv') == 'true': # kodi.addDir('Live TV Addons', 'live', 'addonlist', artwork + 'livetv.png', # description="The most popular live TV addons!") # if settings.getSetting('sports') == 'true': # kodi.addDir('Sports Addons', 'sports', 'addonlist', artwork + 'sports.png', # description="The most popular sports addons!") if settings.getSetting('video') == 'true': kodi.addDir('Video Addons', 'video', 'addonlist', artwork + 'video.png', description="Every video addon in existence!") if settings.getSetting('audio') == 'true': kodi.addDir('Audio Addons', 'audio', 'addonlist', artwork + 'audio.png', description="Find addons to listen to music!") if settings.getSetting('program') == 'true': kodi.addDir('Program Addons', 'executable', 'addonlist', artwork + 'program.png', description="Every program addon you can imagine!") # if settings.getSetting('playlist') == 'true': # kodi.addDir('Playlist Addons', 'playlists', 'addonlist', artwork + 'playlists.png', # description="The most popular playlist addons!") if settings.getSetting('services') == 'true': kodi.addDir('Service Addons', 'service', 'addonlist', artwork + 'service.png') if settings.getSetting('skincat') == 'true': kodi.addDir('Kodi Skins', 'skins', 'addonlist', artwork + 'kodi_skins.png', description="Change up your look!") if settings.getSetting('world') == 'true': kodi.addDir('International Addons', 'international', 'interlist', artwork + 'world.png', description= "Foreign language addons and repos from across the globe!") if settings.getSetting('adult') == 'true': kodi.addDir( '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.addDir('Repositories','repositories', 'addonlist', artwork + 'repositories.png', # description="Browse addons by repository!") # kodi.addItem('Enable Live Streaming', 'None', 'EnableRTMP', artwork + 'enablertmp.png', # description="Enable RTMP InputStream and InputStream Adaptive modules for Live Streaming.") kodi.addItem('Official OpenSubtitles Addon', openSub, 'addopensub', artwork + 'opensubicon.png', description="Install Official OpenSubtitles Addon!") kodi.addDir( '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 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: 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.addItem("Clear Cache " + str(paths[menu_cache_path]), '', 'clear_cache', artwork + 'currentcache.png', description="Clear your device cache!") kodi.addItem("Delete Thumbnails " + str(paths[thumbnail_path]), '', 'clear_thumbs', artwork + 'currentthumbs.png', description="Delete your Thumbnail cache!") kodi.addItem("Delete Packages " + str(paths[packages_path]), '', 'purge_packages', artwork + 'currentpackages.png', description="Delete your addon installation files!") kodi.addItem("Delete Crash Logs", '', 'crashlogs', artwork + 'clearcrash.png', description="Clear all crash logs from your device!") kodi.addItem("Delete Textures13.db", '', 'deletetextures', artwork + 'currentthumbs.png', description="This will delete the Textures13 database") kodi.addDir("Wipe Addons", '', 'wipe_addons', artwork + 'wipe_addons.png', description="Erase all your Kodi addons in one shot!") kodi.addItem("Run Auto Maintenance", '', 'autoclean', artwork + 'run_am.png', description="Clear your cache, thumbnails and delete addon packages in one click!") kodi.addItem(startup_onoff + ' Auto Maintenance on Startup', '', 'autocleanstartup', artwork + su_art, description=su_desc) kodi.addItem(weekly_onoff + ' Weekly Auto Maintenance', '', 'autocleanweekly', artwork + acw_art, description=acw_desc) kodi.addItem(debug_onoff + " Debugging Mode", '', 'debug_onoff', artwork + debug_art, description=debug_desc) kodi.addItem(scb_onoff + " Malicious Scripts Blocker", '', 'toggleblocker', artwork + scb_art, description=scb_desc) kodi.addItem("Force Update Addons", '', 'updateaddons', artwork + 'forceupdateaddons.png', description="Force a reload of all Kodi addons and repositories!") kodi.addDir("Install Custom Keymaps", '', 'customkeys', artwork + 'custom_keymaps.png', description="Get the best experience out of your device-specific remote control!") kodi.addItem("Reload Current Skin", '', 'reloadskin', artwork + 'reloadskin.png', description="Reload the skin!") viewsetter.set_view("sets")
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) 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.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 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 = xbmc.getInfoLabel('System.FreeSpace') screenres = xbmc.getInfoLabel('system.screenresolution') totalspace = xbmc.getInfoLabel('System.TotalSpace') freemem = xbmc.getInfoLabel('System.FreeMemory') ####################################################################### # FIND WHAT VERSION OF KODI IS RUNNING ####################################################################### xbmc_version = xbmc.getInfoLabel("System.BuildVersion") versioni = xbmc_version[:4] # if version >= 11.0 and version <= 11.9: # codename = 'Eden' # if version >= 12.0 and version <= 12.9: # codename = 'Frodo' # if version >= 13.0 and version <= 13.9: # codename = 'Gotham' # if version >= 14.0 and version <= 14.9: # codename = 'Helix' # if version >= 15.0 and version <= 15.9: # codename = 'Isengard' # if version >= 16.0 and version <= 16.9: # codename = 'Jarvis' # if version >= 17.0 and version <= 17.9: # codename = 'Krypton' VERSIONS = { 10: 'Dharma', 11: 'Eden', 12: 'Frodo', 13: 'Gotham', 14: 'Helix', 15: 'Isengard', 16: 'Jarvis', 17: 'Krypton' } v_str = versioni version = int(float(v_str.strip())) unknown = chr(version + 58) + '**' codename = VERSIONS.get(version, unknown) f = urllib.urlopen("http://www.canyouseeme.org/") html_doc = f.read() f.close() m = re.search( '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)', html_doc) check_folders = plugintools.get_setting("maint_check_folders") HOME = xbmc.translatePath('special://home/') PACKAGES = xbmc.translatePath( os.path.join('special://home/addons', 'packages')) THUMBS = xbmc.translatePath( os.path.join('special://home/userdata', 'Thumbnails')) CACHE_FOLDER = xbmc.translatePath(os.path.join('special://home', 'cache')) TEMP_FOLDER = xbmc.translatePath(os.path.join('special://', 'temp')) CACHE = "NULL" if check_folders == "true": if os.path.exists(CACHE_FOLDER): CACHE = CACHE_FOLDER if os.path.exists(TEMP_FOLDER): CACHE = TEMP_FOLDER if not os.path.exists(PACKAGES): os.makedirs(PACKAGES) if CACHE == "NULL": try: PACKAGES_SIZE_BYTE = maintool.get_size(PACKAGES) THUMB_SIZE_BYTE = maintool.get_size(THUMBS) except: pass else: try: CACHE_SIZE_BYTE = maintool.get_size(CACHE) PACKAGES_SIZE_BYTE = maintool.get_size(PACKAGES) THUMB_SIZE_BYTE = maintool.get_size(THUMBS) except: pass if CACHE == "NULL": try: PACKAGES_SIZE = maintool.convertSize(PACKAGES_SIZE_BYTE) THUMB_SIZE = maintool.convertSize(THUMB_SIZE_BYTE) except: pass else: try: CACHE_SIZE = maintool.convertSize(CACHE_SIZE_BYTE) PACKAGES_SIZE = maintool.convertSize(PACKAGES_SIZE_BYTE) THUMB_SIZE = maintool.convertSize(THUMB_SIZE_BYTE) except: pass if CACHE == "NULL": CACHE_SIZE = "Error reading cache" PV = sys.version_info kodi.addItem( '[COLOR ghostwhite]Version: [/COLOR][COLOR lime]%s' % codename + " " + str(versioni) + "[/COLOR]", '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]System Time: [/COLOR][COLOR lime]' + systime + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Gateway: [/COLOR][COLOR blue]' + gateway + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Local IP: [/COLOR][COLOR blue]' + ipaddy + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]External IP: [/COLOR][COLOR blue]' + m.group(0) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]DNS 1: [/COLOR][COLOR blue]' + dns1 + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Network: [/COLOR][COLOR gold]' + linkstate + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Disc Space: [/COLOR][COLOR gold]' + str(totalspace) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Disc Space: [/COLOR][COLOR gold]' + str(freespace) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Free Memory: [/COLOR][COLOR gold]' + str(freemem) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Resolution: [/COLOR][COLOR gold]' + str(screenres) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem( '[COLOR ghostwhite]Python Version: [/COLOR][COLOR lime]%d.%d.%d' % (PV[0], PV[1], PV[2]) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") if check_folders == "true": try: kodi.addItem("Cache Size: [COLOR blue]" + str(CACHE_SIZE) + '[/COLOR]', '', 'null', artwork + 'currentcache.png', description="Clear your device cache!") kodi.addItem("Packages Size: [COLOR blue]" + str(PACKAGES_SIZE) + '[/COLOR]', 'null', '', artwork + 'currentpackages.png', description="Clear your device cache!") kodi.addItem("Thumbnail Size: [COLOR blue]" + str(THUMB_SIZE) + '[/COLOR]', 'null', '', artwork + 'currentthumbs.png', description="Clear your device cache!") except: pass viewsetter.set_view("files")
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 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 = xbmc.getInfoLabel('System.FreeSpace') screenres = xbmc.getInfoLabel('system.screenresolution') totalspace = xbmc.getInfoLabel('System.TotalSpace') freemem = xbmc.getInfoLabel('System.FreeMemory') ####################################################################### # FIND WHAT VERSION OF KODI IS RUNNING ####################################################################### xbmc_version = xbmc.getInfoLabel("System.BuildVersion") versioni = xbmc_version[:4] # if version >= 11.0 and version <= 11.9: # codename = 'Eden' # if version >= 12.0 and version <= 12.9: # codename = 'Frodo' # if version >= 13.0 and version <= 13.9: # codename = 'Gotham' # if version >= 14.0 and version <= 14.9: # codename = 'Helix' # if version >= 15.0 and version <= 15.9: # codename = 'Isengard' # if version >= 16.0 and version <= 16.9: # codename = 'Jarvis' # if version >= 17.0 and version <= 17.9: # codename = 'Krypton' VERSIONS = { 10: 'Dharma', 11: 'Eden', 12: 'Frodo', 13: 'Gotham', 14: 'Helix', 15: 'Isengard', 16: 'Jarvis', 17: 'Krypton' } v_str = versioni version = int(float(v_str.strip())) unknown = chr(version + 58) + '**' codename = VERSIONS.get(version, unknown) f = urllib.urlopen("http://www.canyouseeme.org/") html_doc = f.read() f.close() m = re.search( '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)', html_doc) kodi.addItem( '[COLOR ghostwhite]Version: [/COLOR][COLOR lime]%s' % codename + " " + str(versioni) + "[/COLOR]", '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]System Time: [/COLOR][COLOR lime]' + systime + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Gateway: [/COLOR][COLOR blue]' + gateway + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Local IP: [/COLOR][COLOR blue]' + ipaddy + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]External IP: [/COLOR][COLOR blue]' + m.group(0) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]DNS 1: [/COLOR][COLOR blue]' + dns1 + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Network: [/COLOR][COLOR gold]' + linkstate + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Disc Space: [/COLOR][COLOR gold]' + str(totalspace) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Disc Space: [/COLOR][COLOR gold]' + str(freespace) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Free Memory: [/COLOR][COLOR gold]' + str(freemem) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Resolution: [/COLOR][COLOR gold]' + str(screenres) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") viewsetter.set_view("files")
def restore(): for zip_file in os.listdir(zip_path): if zip_file.endswith(".zip"): url = xbmc.translatePath(os.path.join(zip_path, zip_file)) kodi.addItem(zip_file, url, 'read_zip', '', '', '')
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(xbmc.translatePath('special://home'))) freespace = maintool.convert_size(freespace) + ' Free' totalspace = maintool.convert_size(totalspace) + ' Total' screenres = xbmc.getInfoLabel('system.screenresolution') freemem = xbmc.getInfoLabel('System.FreeMemory') # FIND WHAT VERSION OF KODI IS RUNNING xbmc_version = xbmc.getInfoLabel("System.BuildVersion") versioni = xbmc_version[:4] VERSIONS = { 10: 'Dharma', 11: 'Eden', 12: 'Frodo', 13: 'Gotham', 14: 'Helix', 15: 'Isengard', 16: 'Jarvis', 17: 'Krypton' } codename = VERSIONS.get(int(xbmc_version[:2])) try: f = urllib.urlopen("http://www.canyouseeme.org/") html_doc = f.read() f.close() m = '[COLOR blue]%s[/COLOR]' % re.search('IP"\svalue="([^"]*)', html_doc).group(1) except: m = '[COLOR red]%s[/COLOR]' % 'IP Check Not Available' # Get Python Version pv = sys.version_info # System Information Menu kodi.addItem( '[COLOR ghostwhite]Version: [/COLOR][COLOR lime]%s' % codename + " " + str(versioni) + "[/COLOR]", '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]System Time: [/COLOR][COLOR lime]' + systime + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Gateway: [/COLOR][COLOR blue]' + gateway + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Local IP: [/COLOR][COLOR blue]' + ipaddy + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]External IP: [/COLOR]' + m, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]DNS 1: [/COLOR][COLOR blue]' + dns1 + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Network: [/COLOR][COLOR gold]' + linkstate + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Disc Space: [/COLOR][COLOR gold]' + str(totalspace) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Disc Space: [/COLOR][COLOR gold]' + str(freespace) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Free Memory: [/COLOR][COLOR gold]' + str(freemem) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Resolution: [/COLOR][COLOR gold]' + str(screenres) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem( '[COLOR ghostwhite]Python Version: [/COLOR][COLOR lime]%d.%d.%d' % (pv[0], pv[1], pv[2]) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") viewsetter.set_view("files")
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") if kodi.get_setting('hasran') == 'false': kodi.set_setting('hasran', 'false') try: if not os.path.exists(hubpath): installer.HUBINSTALL( 'repository.cyberxnuke', 'https://github.com/CYBERxNUKE/xbmc-addon/raw/master/repository.cyberxnuke/repository.cyberxnuke-1.2.zip', '', 'addon', 'none') xbmc.executebuiltin("XBMC.UpdateLocalAddons()") addon_able.set_enabled("repository.cyberxnuke") except: pass try: if not os.path.exists(uploaderpath): installer.HUBINSTALL( 'TVADDONS.AG.LogUploader', 'https://offshoregit.com/xbmchub/xbmc-hub-repo/raw/master/script.tvaddons.debug.log/script.tvaddons.debug.log-1.0.7.zip', '', 'addon', 'none') 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) #kodi.addItem("Config Wizard",'','call_wizard',artwork+'config_wizard.png',description="Automatically configure Kodi with the best addons and goodies in seconds!") kodi.addItem( "Update", '', 'call_wizard1', artwork + 'config_wizard.png', description="Automatically configure Kodi with the new updates!") #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( "Refresh Kodi", '', 'call_rejuv', artwork + 'rejuvinate.png', description= "Wipe and reconfigure Kodi with the latest Computertechs Installer 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 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(xbmc.translatePath('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] versions = {10: 'Dharma', 11: 'Eden', 12: 'Frodo', 13: 'Gotham', 14: 'Helix', 15: 'Isengard', 16: 'Jarvis', 17: 'Krypton', 18: 'Leia'} codename = versions.get(int(xbmc_version[:2])) # Get External IP Address try: ext_ip = ("blue", OPEN_URL('https://api.ipify.org')) except Exception as e: kodi.log(str(e)) try: link = OPEN_URL('http://whatismyip.network/') ext_ip = ("blue", re.search('>My IP Address[^=]*[^>]*>([^<]*)', link).group(1)) except: ext_ip = ("red", "IP Check Not Available") # Get Python Version pv = sys.version_info # System Information Menu kodi.addItem('[COLOR ghostwhite]Version: [/COLOR][COLOR lime] %s %s[/COLOR]' % (codename, versioni), '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]System Time: [/COLOR][COLOR lime] %s[/COLOR]' % systime, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Gateway: [/COLOR][COLOR blue] %s[/COLOR]' % gateway, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Local IP: [/COLOR][COLOR blue] %s[/COLOR]' % ipaddy, '', 100, artwork+'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]External IP: [/COLOR][COLOR %s] %s[/COLOR]' % ext_ip, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]DNS 1: [/COLOR][COLOR blue] %s[/COLOR]' % dns1, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Network: [/COLOR][COLOR gold] %s[/COLOR]' % linkstate, '', 100, artwork + 'icon.png', "", description=" ") if str(totalspace) != '0 B': kodi.addItem('[COLOR ghostwhite]Total Disc Space: [/COLOR][COLOR gold] %s[/COLOR]' % totalspace, '', 100, artwork + 'icon.png', "", description=" ") if str(freespace) != '0 B': kodi.addItem('[COLOR ghostwhite]Free Disc Space: [/COLOR][COLOR gold] %s[/COLOR]' % freespace, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Free Memory: [/COLOR][COLOR gold] %s[/COLOR]' % freemem, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Resolution: [/COLOR][COLOR gold] %s[/COLOR]' % screenres, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[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: 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.addItem("Clear Cache " + str(paths[menu_cache_path]), '', 'clear_cache', artwork + 'currentcache.png', description="Clear your device cache!") kodi.addItem("Delete Thumbnails " + str(paths[thumbnail_path]), '', 'clear_thumbs', artwork + 'currentthumbs.png', description="Delete your Thumbnail cache!") kodi.addItem("Delete Packages " + str(paths[packages_path]), '', 'purge_packages', artwork + 'currentpackages.png', description="Delete your addon installation files!") kodi.addItem("Delete Crash Logs", '', 'crashlogs', artwork + 'clearcrash.png', description="Clear all crash logs from your device!") kodi.addItem("Delete Textures13.db", '', 'deletetextures', artwork + 'currentthumbs.png', description="This will delete the Textures13 database") kodi.addDir("Wipe Addons", '', 'wipe_addons', artwork + 'wipe_addons.png', description="Erase all your Kodi addons in one shot!") kodi.addItem( "Run Auto Maintenance", '', 'autoclean', artwork + 'run_am.png', description= "Clear your cache, thumbnails and delete addon packages in one click!") kodi.addItem(startup_onoff + ' Auto Maintenance on Startup', '', 'autocleanstartup', artwork + su_art, description=su_desc) kodi.addItem(weekly_onoff + ' Weekly Auto Maintenance', '', 'autocleanweekly', artwork + acw_art, description=acw_desc) kodi.addItem(debug_onoff + " Debugging Mode", '', 'debug_onoff', artwork + debug_art, description=debug_desc) kodi.addItem(scb_onoff + " Malicious Scripts Blocker", '', 'toggleblocker', artwork + scb_art, description=scb_desc) kodi.addItem( "Force Update Addons", '', 'updateaddons', artwork + 'forceupdateaddons.png', description="Force a reload of all Kodi addons and repositories!") kodi.addDir( "Install Custom Keymaps", '', 'customkeys', artwork + 'custom_keymaps.png', description= "Get the best experience out of your device-specific remote control!") kodi.addItem("Reload Current Skin", '', 'reloadskin', artwork + 'reloadskin.png', description="Reload the skin!") 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(xbmc.translatePath('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: ext_ip = ("red", "IP Check Not Available") # Get Python Version pv = sys.version_info # System Information Menu # kodi.addItem('[COLOR ghostwhite]Version: [/COLOR][COLOR lime] %s %s[/COLOR]' % (codename, versioni), # '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[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.addItem('[COLOR ghostwhite]System Time: [/COLOR][COLOR lime] %s[/COLOR]' % systime, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Gateway: [/COLOR][COLOR blue] %s[/COLOR]' % gateway, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Local IP: [/COLOR][COLOR blue] %s[/COLOR]' % ipaddy, '', 100, artwork+'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]External IP: [/COLOR][COLOR %s] %s[/COLOR]' % ext_ip, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]DNS 1: [/COLOR][COLOR blue] %s[/COLOR]' % dns1, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Network: [/COLOR][COLOR gold] %s[/COLOR]' % linkstate, '', 100, artwork + 'icon.png', "", description=" ") if str(totalspace) != '0 B': kodi.addItem('[COLOR ghostwhite]Total Disc Space: [/COLOR][COLOR gold] %s[/COLOR]' % totalspace, '', 100, artwork + 'icon.png', "", description=" ") if str(freespace) != '0 B': kodi.addItem('[COLOR ghostwhite]Free Disc Space: [/COLOR][COLOR gold] %s[/COLOR]' % freespace, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Free Memory: [/COLOR][COLOR gold] %s[/COLOR]' % freemem, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Resolution: [/COLOR][COLOR gold] %s[/COLOR]' % screenres, '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[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 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( 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 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(xbmc.translatePath('special://home'))) freespace = maintool.convert_size(freespace) + ' Free' totalspace = maintool.convert_size(totalspace) + ' Total' screenres = xbmc.getInfoLabel('system.screenresolution') freemem = xbmc.getInfoLabel('System.FreeMemory') # FIND WHAT VERSION OF KODI IS RUNNING xbmc_version = xbmc.getInfoLabel("System.BuildVersion") versioni = xbmc_version[:4] VERSIONS = {10: 'Dharma', 11: 'Eden', 12: 'Frodo', 13: 'Gotham', 14: 'Helix', 15: 'Isengard', 16: 'Jarvis', 17: 'Krypton'} codename = VERSIONS.get(int(xbmc_version[:2])) f = urllib.urlopen("http://www.canyouseeme.org/") html_doc = f.read() f.close() m = re.search('IP"\svalue="([^"]*)', html_doc) # Get Python Version pv = sys.version_info # System Information Menu kodi.addItem('[COLOR ghostwhite]Version: [/COLOR][COLOR lime]%s' % codename + " " + str(versioni) + "[/COLOR]", '', 100, artwork+'icon.png',"", description=" ") kodi.addItem('[COLOR ghostwhite]System Time: [/COLOR][COLOR lime]' + systime + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Gateway: [/COLOR][COLOR blue]' + gateway + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Local IP: [/COLOR][COLOR blue]' + ipaddy + '[/COLOR]', '', 100, artwork+'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]External IP: [/COLOR][COLOR blue]' + m.group(1) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]DNS 1: [/COLOR][COLOR blue]' + dns1 + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Network: [/COLOR][COLOR gold]'+linkstate + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Disc Space: [/COLOR][COLOR gold]'+str(totalspace) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Disc Space: [/COLOR][COLOR gold]'+str(freespace) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Free Memory: [/COLOR][COLOR gold]'+str(freemem) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Resolution: [/COLOR][COLOR gold]' + str(screenres) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") kodi.addItem('[COLOR ghostwhite]Python Version: [/COLOR][COLOR lime]%d.%d.%d' % (pv[0], pv[1], pv[2]) + '[/COLOR]', '', 100, artwork + 'icon.png', "", description=" ") viewsetter.set_view("files")
def Restore(): # (os.listdir(USB)) for file in os.listdir(USB): if file.endswith(".zip"): url = xbmc.translatePath(os.path.join(USB, file)) kodi.addItem(file, url, 'read_zip', '', '', '')
def MAININDEX(): kodi.addDir('Search by: Addon/Author', base_url + 'search/?keyword=', 'searchaddon', artwork + 'search.png', description="Search for addons by Name or Author") if settings.getSetting('featured') == 'true': kodi.addDir('Featured Addons', base_url + 'category/featured/', 'addonlist', artwork + 'featured.png', description="The most popular Kodi addons!") if settings.getSetting('livetv') == 'true': kodi.addDir('Live TV Addons', base_url + 'category/livetv/', 'addonlist', artwork + 'livetv.png', description="The most popular live TV addons!") if settings.getSetting('sports') == 'true': kodi.addDir('Sports Addons', base_url + 'category/sports/', 'addonlist', artwork + 'sports.png', description="The most popular sports addons!") if settings.getSetting('video') == 'true': kodi.addDir('Video Addons', base_url + 'category/video/', 'addonlist', artwork + 'video.png', description="Every video addon in existence!") if settings.getSetting('audio') == 'true': kodi.addDir('Audio Addons', base_url + 'category/audio/', 'addonlist', artwork + 'audio.png', description="Find addons to listen to music!") if settings.getSetting('program') == 'true': kodi.addDir('Program Addons', base_url + 'category/programs/', 'addonlist', artwork + 'program.png', description="Every program addon you can imagine!") if settings.getSetting('playlist') == 'true': kodi.addDir('Playlist Addons', base_url + 'category/playlists/', 'addonlist', artwork + 'playlists.png', description="The most popular playlist addons!") # if settings.getSetting('services')=='true': # kodi.addDir('Service Addons',base_url+'category/services/','addonlist',artwork+'service.png') if settings.getSetting('skincat') == 'true': kodi.addDir('Kodi Skins', base_url + 'category/skins/', 'addonlist', artwork + 'kodi_skins.png', description="Change up your look!") if settings.getSetting('world') == 'true': kodi.addDir('International Addons', base_url + 'category/international/', 'interlist', artwork + 'world.png', description= "Foreign language addons and repos from across the globe!") if settings.getSetting('adult') == 'true': kodi.addDir( 'Adult Addons', indigo_url + 'xxx.php', '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.addDir('Repositories', base_url + 'category/repositories/', 'addonlist', artwork + 'repositories.png', description="Browse addons by repository!") kodi.addItem('Official OpenSubtitles Addon', openSub, 'addopensub', artwork + 'opensubicon.png', description="Install Official OpenSubtitles Addon!") viewsetter.set_view("sets")