def READ_ZIP(url): if dialog.yesno(AddonTitle,"[COLOR yellow]" + url + "[/COLOR]","Do you want to restore this backup?"): wipe.WIPERESTORE() zin = zipfile.ZipFile(url, 'r') nFiles = float(len(zin.infolist())) count = 0 try: for item in zin.infolist(): dp.create(AddonTitle,"Extracting Backup","[COLOR yellow]" + url + "[/COLOR]","Please Wait...") count += 1 update = count / nFiles * 100 dp.update(int(update)) try: zin.extract(item, HOME) except Exception, e: print str(e) except Exception, e: print str(e) return False dialog.ok(AddonTitle,'Restore Successful, please restart XBMC/Kodi for changes to take effect.','','') Common.killxbmc() return True
def WIZARD(name, url, description): if not os.path.exists(temas): os.makedirs(temas) skindefault.SetDefaultSkin() if os.path.exists(limpei): shutil.rmtree(limpei) KODIVERSION = float(xbmc.getInfoLabel("System.BuildVersion")[:4]) dialog = xbmcgui.Dialog() if KODIVERSION < 16.0: dialog.ok( "[COLOR=red][B]Atencao !!! [/COLOR][/B]", "Seu dispositivo possui uma versao antiga do Kodi que deve ser atualizada." ) return else: dp = xbmcgui.DialogProgress() dp.create(AddonTitle, "Carregando a ultima compilacao... ", '', 'Por favor aguarde...') path = xbmc.translatePath( os.path.join('special://home/addons', 'temas')) lib = os.path.join(path, name + '.zip') ## try: ## os.remove(lib) ##except: ## pass ##downloader.download(url, lib, dp) time.sleep(2) addonfolder = xbmc.translatePath(os.path.join('special://', 'home')) dp.update(0, "", "Extraindo arquivos do ZIP...") extract.all(lib, addonfolder, dp) common.killxbmc()
def READ_ZIP(url): if not "_addon_data" in url: if not "tv_guide" in url: if dialog.yesno(AddonTitle,"[COLOR yellow]" + url + "[/COLOR]","Do you want to restore this backup?"): skinswap() wipe.WIPE_BACKUPRESTORE() _out = xbmc.translatePath(os.path.join('special://','home')) else: sys.exit(1) else: if dialog.yesno(AddonTitle,"[COLOR yellow]" + url + "[/COLOR]","Do you want to restore this backup?"): _out = GUIDE else: sys.exit(1) else: if dialog.yesno(AddonTitle,"[COLOR yellow]" + url + "[/COLOR]","Do you want to restore this backup?"): _out = ADDON_DATA else: sys.exit(1) _in = url dp.create(AddonTitle,"Restoring File:",_in,'Please Wait...') unzip(_in, _out, dp) name = "[COLOR ghostwhite][B]RESTORE[/B][/COLOR]" #add_download = Common.add_one_backups(name) if not "addon_data" in url: if not "tv_guide" in url: dialog.ok(AddonTitle,'Restore Successful, please restart XBMC/Kodi for changes to take effect.','','') Common.killxbmc() else: dialog.ok(AddonTitle,'Your TDB TV Guide settings have been restored.','','') else: dialog.ok(AddonTitle,'Your Addon Data settings have been restored.','','')
def READ_ZIP(url): if dialog.yesno(AddonTitle, "[COLOR yellow]" + url + "[/COLOR]", "Do you want to restore this backup?"): wipe.WIPERESTORE() zin = zipfile.ZipFile(url, 'r') nFiles = float(len(zin.infolist())) count = 0 try: for item in zin.infolist(): dp.create(AddonTitle, "Extracting Backup", "[COLOR yellow]" + url + "[/COLOR]", "Please Wait...") count += 1 update = count / nFiles * 100 dp.update(int(update)) try: zin.extract(item, HOME) except Exception, e: print str(e) except Exception, e: print str(e) return False dialog.ok( AddonTitle, 'Restore Successful, please restart XBMC/Kodi for changes to take effect.', '', '') Common.killxbmc() return True
def INSTALLCOM(name,url,description): wipe.WIPERESTORE() #Check is the packages folder exists, if not create it. path = xbmc.translatePath(os.path.join('special://home/addons','packages')) if not os.path.exists(path): os.makedirs(path) buildname = "[COLOR orangered]" + name + "[/COLOR]" dp = xbmcgui.DialogProgress() dp.create(AddonTitle,"","","build: " + buildname) name = "build" lib=os.path.join(path, name+'.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join('special://','home')) time.sleep(2) dp.update(0,"","Extracting build...","") unzip(lib,addonfolder,dp) dialog = xbmcgui.Dialog() time.sleep(1) try: os.remove(lib) except: pass dialog.ok(AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi") time.sleep(2) Common.killxbmc()
def FRESHSTART(): if FRESH == 1: dialog.ok(AddonTitle, 'Please switch to the default Confluence skin', 'before performing a wipe.', '') xbmc.executebuiltin("ActivateWindow(appearancesettings)") return else: choice2 = xbmcgui.Dialog().yesno( "[COLOR=red]ABSOLUTELY CERTAIN?!!![/COLOR]", 'Are you absolutely certain you want to wipe this install?', '', 'Everything EXCLUDING THIS WIZARD & YOUR BACKUPS will be completely wiped!', yeslabel='[COLOR=green]Yes[/COLOR]', nolabel='[COLOR=red]No[/COLOR]') if choice2 == 0: return elif choice2 == 1: dp.create(AddonTitle, "Wiping Install", 'Wiping Now.............', 'Please Wait') try: for root, dirs, files in os.walk(HOME, topdown=True): dirs[:] = [d for d in dirs if d not in EXCLUDES] for name in files: try: os.remove(os.path.join(root, name)) os.rmdir(os.path.join(root, name)) except: pass for name in dirs: try: os.rmdir(os.path.join(root, name)) os.rmdir(root) except: pass except: pass dp.create(AddonTitle, "Wiping Install", 'Removing empty folders.', 'Please Wait') Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() open(WIPE, "a") dialog.ok( AddonTitle, 'Wipe Successful, please restart XBMC/Kodi for changes to take effect.', '', '') Common.killxbmc()
def WIZARD(name, url, description): AddonTitle = "[COLOR aqua]Vikings Kodi Wizard[/COLOR]" KODIVERSION = float(xbmc.getInfoLabel("System.BuildVersion")[:4]) dialog = xbmcgui.Dialog() if KODIVERSION < 16.0: dialog.ok( "[COLOR=red][B]Atencao !!! [/COLOR][/B]", "Seu dispositivo possui uma versao antiga do Kodi que deve ser atualizada." ) return else: skindefault.SetDefaultSkin() dp = xbmcgui.DialogProgress() ## Fresh Start dp.create(AddonTitle, "Restaurando Kodi.", 'Em progresso.............', 'Por favor aguarde...') common.FRESHSTARTBUILD() time.sleep(2) ## Download dp.create(AddonTitle, "Carregando a ultima compilacao... ", '', 'Por favor aguarde...') path = xbmc.translatePath( os.path.join('special://home/addons', 'packages')) lib = os.path.join(path, name + '.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) time.sleep(2) ## Extract from Zip File addonfolder = xbmc.translatePath(os.path.join('special://', 'home')) dp.update(0, "", "Extraindo arquivos do ZIP...") extract.all(lib, addonfolder, dp) ## Cleanup Kodi common.CLEANUP(url) time.sleep(2) ## Force Quit Kodi common.TIMER( 15, "[COLOR aqua][B]O DOWNLOAD esta completo[/B][/COLOR]", "O Kodi desligara automaticamente em: ", "Para dispositivo Android/Amazon: [COLOR yellow][B]Remova o cabo de energia[/B][/COLOR] do seu dispositivo [COLOR red][B]APOS[/B][/COLOR] a contagem regressiva." ) common.killxbmc()
def FRESHSTART(): if FRESH == 1: dialog.ok(AddonTitle,'Please switch to the default Confluence skin','before performing a wipe.','') xbmc.executebuiltin("ActivateWindow(appearancesettings)") return else: choice2 = xbmcgui.Dialog().yesno("[COLOR=red]ABSOLUTELY CERTAIN?!!![/COLOR]", 'Are you absolutely certain you want to wipe this install?', '', 'Everything EXCLUDING THIS WIZARD & YOUR BACKUPS will be completely wiped!', yeslabel='[COLOR=green]Yes[/COLOR]',nolabel='[COLOR=red]No[/COLOR]') if choice2 == 0: return elif choice2 == 1: dp.create(AddonTitle,"Wiping Install",'Wiping Now.............', 'Please Wait') try: for root, dirs, files in os.walk(HOME,topdown=True): dirs[:] = [d for d in dirs if d not in EXCLUDES] for name in files: try: os.remove(os.path.join(root,name)) os.rmdir(os.path.join(root,name)) except: pass for name in dirs: try: os.rmdir(os.path.join(root,name)); os.rmdir(root) except: pass except: pass dp.create(AddonTitle,"Wiping Install",'Removing empty folders.', 'Please Wait') Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() open(WIPE, "a") dialog.ok(AddonTitle,'Wipe Successful, please restart XBMC/Kodi for changes to take effect.','','') Common.killxbmc()
def INSTALLCOM(name, url, description): wipe.WIPERESTORE() #Check is the packages folder exists, if not create it. path = xbmc.translatePath(os.path.join('special://home/addons', 'packages')) if not os.path.exists(path): os.makedirs(path) buildname = "[COLOR orangered]" + name + "[/COLOR]" dp = xbmcgui.DialogProgress() dp.create(AddonTitle, "", "", "build: " + buildname) name = "build" lib = os.path.join(path, name + '.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join('special://', 'home')) time.sleep(2) dp.update(0, "", "Extracting build...", "") unzip(lib, addonfolder, dp) dialog = xbmcgui.Dialog() time.sleep(1) try: os.remove(lib) except: pass dialog.ok( AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi" ) time.sleep(2) Common.killxbmc()
def FRESHSTART(): choice = xbmcgui.Dialog().yesno(AddonTitle, '[COLOR red][B]ARE YOU SURE YOU WANT TO RESTORE THE SYSTEM?[/B][/COLOR]',' ' ,'[COLOR orange]Everything EXCEPT this WIZARD will be REMOVED.[/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) skin = xbmc.getSkinDir() KODIV = float(xbmc.getInfoLabel("System.BuildVersion")[:4]) skinswapped = 0 #SWITCH THE SKIN IF THE CURRENT SKIN IS NOT CONFLUENCE if skin not in ['skin.confluence','skin.estuary']: choice = xbmcgui.Dialog().yesno(AddonTitle, '[COLOR red][B]YOU ARE NOT USING THE DEFAULT SKIN.[/B][/COLOR]','[COLOR orange]Click YES to attempt to AUTO SWITCH the skin[/COLOR]','[COLOR red]Please DO NOT PRESS ANY BUTTONS or MOVE THE MOUSE while the process is taking place, it is AUTOMATIC[/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) skin = 'skin.estuary' if KODIV >= 17 else 'skin.confluence' skinSwitch.swapSkins(skin) skinswapped = 1 time.sleep(1) #IF A SKIN SWAP HAS HAPPENED CHECK IF AN OK DIALOG (CONFLUENCE INFO SCREEN) IS PRESENT, PRESS OK IF IT IS PRESENT if skinswapped == 1: if not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"): xbmc.executebuiltin( "Action(Select)" ) #IF THERE IS NOT A YES NO DIALOG (THE SCREEN ASKING YOU TO SWITCH TO CONFLUENCE) THEN SLEEP UNTIL IT APPEARS if skinswapped == 1: while not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"): time.sleep(1) #WHILE THE YES NO DIALOG IS PRESENT PRESS LEFT AND THEN SELECT TO CONFIRM THE SWITCH TO CONFLUENCE. if skinswapped == 1: while xbmc.getCondVisibility("Window.isVisible(yesnodialog)"): xbmc.executebuiltin( "Action(Left)" ) xbmc.executebuiltin( "Action(Select)" ) time.sleep(1) skin = xbmc.getSkinDir() #CHECK IF THE SKIN IS NOT CONFLUENCE if skin not in ['skin.confluence','skin.estuary']: choice = xbmcgui.Dialog().yesno(AddonTitle, '[COLOR red][B]ERROR: AUTOSWITCH WAS NOT SUCCESFULL[/B][/COLOR]','[COLOR red]Click YES to MANUALLY SWITCH the skin now[/COLOR]','[COLOR red]You can press NO and attempt the AUTO SWITCH again if you wish[/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 1: xbmc.executebuiltin("ActivateWindow(appearancesettings)") return else: sys.exit(1) dp.create(AddonTitle,"Restoring Kodi.",'In Progress...', 'Please Wait') try: for root, dirs, files in os.walk(HOME,topdown=True): dirs[:] = [d for d in dirs if d not in EXCLUDES] for name in files: try: os.remove(os.path.join(root,name)) os.rmdir(os.path.join(root,name)) except: pass for name in dirs: try: os.rmdir(os.path.join(root,name)); os.rmdir(root) except: pass except: pass dp.create(AddonTitle,"Wiping Install",'Removing empty folders.', 'Please Wait') Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() if os.path.exists(NAVI): try: shutil.rmtree(NAVI) except: pass if os.path.exists(DATABASE): try: for root, dirs, files in os.walk(DATABASE,topdown=True): dirs[:] = [d for d in dirs] for name in files: try: os.remove(os.path.join(root,name)) os.rmdir(os.path.join(root,name)) except: pass for name in dirs: try: os.rmdir(os.path.join(root,name)); os.rmdir(root) except: pass except: pass if os.path.exists(ADDON_DATA): try: for root, dirs, files in os.walk(ADDON_DATA,topdown=True): dirs[:] = [d for d in dirs] for name in files: try: os.remove(os.path.join(root,name)) os.rmdir(os.path.join(root,name)) except: pass for name in dirs: try: os.rmdir(os.path.join(root,name)); os.rmdir(root) except: pass except: pass Common.killxbmc()
def check(): xbmc.executebuiltin( "ActivateWindow(busydialog)" ) pleasecheck = 0 SSUpdate = 0 dialog = xbmcgui.Dialog() try: response = urlopen(SSTwo) except: SSUpdate = 1 dialog.ok(AddonTitle,'Sorry we are unable to check for [B]SSTV[/B] updates!','The update host appears to be down.','') xbmc.executebuiltin( "Dialog.Close(busydialog)" ) ####################################################################### # Check for Build Updates ####################################################################### if SSUpdate == 0 and os.path.isfile(CHECKVERSION): dialog = xbmcgui.Dialog() checkurl = SSTwo vers = open(CHECKVERSION, "r") regex = re.compile(r'<build>(.+?)</build><version>(.+?)</version>') for line in vers: if SSUpdate == 0: currversion = regex.findall(line) for build,vernumber in currversion: if vernumber > 0: req = urllib2.Request(checkurl) req.add_header('User-Agent','TheWizardIsHere') try: response = urllib2.urlopen(req) except: dialog.ok(AddonTitle,'Sorry we are unable to check for [B]SSTV[/B] updates!','The update host appears to be down.','Please check for updates later via the wizard.') sys.exit(1) xbmc.executebuiltin( "Dialog.Close(busydialog)" ) link=response.read() response.close() match = re.compile('<build>'+build+'</build><version>(.+?)</version><fresh>(.+?)</fresh>').findall(link) for newversion,fresh in match: if newversion > vernumber: choice = xbmcgui.Dialog().yesno("NEW UPDATE AVAILABLE", 'Found a new update for the Build', build + " ver: "+newversion, 'Do you want to install it now?', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 1: if fresh =='false': # TRUE updateurl = SSOne req = urllib2.Request(updateurl) req.add_header('User-Agent','TheWizardIsHere') try: response = urllib2.urlopen(req) except: dialog.ok(AddonTitle,'Sorry we were unable to download the update!','The update host appears to be down.','Please check for updates later via the wizard.') sys.exit(1) xbmc.executebuiltin( "Dialog.Close(busydialog)" ) link=response.read() response.close() match = re.compile('<build>'+build+'</build><url>(.+?)</url>').findall(link) for url in match: path = xbmc.translatePath(os.path.join('special://home/addons','packages')) name = "build" dp = xbmcgui.DialogProgress() dp.create(AddonTitle,"Downloading ",'', 'Please Wait') lib=os.path.join(path, name+'.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join('special://','home')) time.sleep(2) dp.update(0,"", "Extracting Zip Please Wait") print '=======================================' print addonfolder print '=======================================' extract.all(lib,addonfolder,dp) xbmc.executebuiltin( "Dialog.Close(busydialog)" ) dialog.ok(AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi") Common.killxbmc() sys.exit(1) else: dialog.ok(AddonTitle,'[COLOR red]A WIPE (FACTORY RESET)[/COLOR] is required for the update... [COLOR red]WOULD YOU LIKE TO WIPE THE SYSTEM NOW?[/COLOR]','','') xbmc.executebuiltin( "Dialog.Close(busydialog)" ) wipe.FRESHSTART() sys.exit(1) else: xbmc.executebuiltin( "Dialog.Close(busydialog)" ) sys.exit(1) else: xbmc.executebuiltin( "Dialog.Close(busydialog)" ) dialog.ok(AddonTitle,'[COLOR ghostwhite]Your build is up to date.[/COLOR]', "[COLOR ghostwhite]Current Build: [/COLOR][COLOR yellow]" + build + "[/COLOR]", "[COLOR ghostwhite]Current Version: [/COLOR][COLOR yellow]" + newversion + "[/COLOR]") sys.exit(1) xbmc.executebuiltin( "Dialog.Close(busydialog)" ) dialog.ok(AddonTitle,'[COLOR ghostwhite]An unknown error occurred.[/COLOR]', "[COLOR yellow]Please try again later.[/COLOR]", "")
def update(): JarvisUpdate = 0 KryptonUpdate = 0 BetaUpdate = 0 dialog = xbmcgui.Dialog() try: response = urllib2.urlopen(JarvisTwo) except: JarvisUpdate = 1 dialog.ok(AddonTitle,'Sorry we are unable to check for [B]JARVIS[/B] updates!','The Jarvis update host appears to be down.','') try: response = urllib2.urlopen(KryptonTwo) except: KryptonUpdate = 1 dialog.ok(AddonTitle,'Sorry we are unable to check for [B]KRYPTON[/B] updates!','The update host appears to be down.','Please check for updates later via the wizard.') try: response = urllib2.urlopen(BetaTwo) except: BetaUpdate = 1 dialog.ok(AddonTitle,'Sorry we are unable to check for [B]BETA[/B] updates!','The update host appears to be down.','Please check for updates later via the wizard.') ####################################################################### # Check for Jarvis Updates ####################################################################### if JarvisUpdate == 0: dialog = xbmcgui.Dialog() checkurl = JarvisTwo vers = open(CHECKVERSION, "r") regex = re.compile(r'<build>(.+?)</build><version>(.+?)</version>') for line in vers: if JarvisUpdate == 0: currversion = regex.findall(line) for build,vernumber in currversion: if vernumber > 0: req = urllib2.Request(checkurl) req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') try: response = urllib2.urlopen(req) except: dialog.ok(AddonTitle,'Sorry we are unable to check for [B]JARVIS[/B] updates!','The update host appears to be down.','Please check for updates later via the wizard.') sys.exit(1) link=response.read() response.close() match = re.compile('<build>'+build+'</build><version>(.+?)</version><fresh>(.+?)</fresh>').findall(link) for newversion,fresh in match: if newversion > vernumber: choice = xbmcgui.Dialog().yesno("NEW UPDATE AVAILABLE", 'Found a new update for the Build', build + " ver: "+newversion, 'Do you want to install it now?', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 1: if fresh =='false': # TRUE updateurl = JarvisOne req = urllib2.Request(updateurl) req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') try: response = urllib2.urlopen(req) except: dialog.ok(AddonTitle,'Sorry we were unable to download the update!','The update host appears to be down.','Please check for updates later via the wizard.') sys.exit(1) link=response.read() response.close() match = re.compile('<build>'+build+'</build><url>(.+?)</url>').findall(link) for url in match: path = xbmc.translatePath(os.path.join('special://home/addons','packages')) name = "build" dp = xbmcgui.DialogProgress() dp.create(AddonTitle,"Downloading ",'', 'Please Wait') lib=os.path.join(path, name+'.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join('special://','home')) time.sleep(2) dp.update(0,"", "Extracting Zip Please Wait") print '=======================================' print addonfolder print '=======================================' extract.all(lib,addonfolder,dp) dialog.ok(AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi") Common.killxbmc() else: dialog.ok(AddonTitle,'[COLOR red]A WIPE (FACTORY RESET)[/COLOR] is required for the update... [COLOR red]WOULD YOU LIKE TO WIPE THE SYSTEM NOW?[/COLOR]','','') wipe.FRESHSTART() else: dialog.ok(AddonTitle,'[COLOR ghostwhite]Your build is up to date.[/COLOR]', "[COLOR ghostwhite]Current Build: [/COLOR][COLOR yellow]" + build + "[/COLOR]", "[COLOR ghostwhite]Current Version: [/COLOR][COLOR yellow]" + newversion + "[/COLOR]") ####################################################################### # Check for Krypton Updates ####################################################################### if KryptonUpdate == 0: dialog = xbmcgui.Dialog() checkurl = KryptonTwo vers = open(CHECKVERSION, "r") regex = re.compile(r'<build>(.+?)</build><version>(.+?)</version>') for line in vers: if KryptonUpdate == 0: currversion = regex.findall(line) for build,vernumber in currversion: if vernumber > 0: req = urllib2.Request(checkurl) req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') try: response = urllib2.urlopen(req) except: dialog.ok(AddonTitle,'Sorry we are unable to check for [B]KRYPTON[/B] updates!','The update host appears to be down.','Please check for updates later via the wizard.') sys.exit(1) link=response.read() response.close() match = re.compile('<build>'+build+'</build><version>(.+?)</version><fresh>(.+?)</fresh>').findall(link) for newversion,fresh in match: if newversion > vernumber: choice = xbmcgui.Dialog().yesno("NEW UPDATE AVAILABLE", 'Found a new update for the Build', build + " ver: "+newversion, 'Do you want to install it now?', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 1: if fresh =='false': # TRUE updateurl = KryptonOne req = urllib2.Request(updateurl) req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') try: response = urllib2.urlopen(req) except: dialog.ok(AddonTitle,'Sorry we were unable to download the update!','The update host appears to be down.','Please check for updates later via the wizard.') sys.exit(1) link=response.read() response.close() match = re.compile('<build>'+build+'</build><url>(.+?)</url>').findall(link) for url in match: path = xbmc.translatePath(os.path.join('special://home/addons','packages')) name = "build" dp = xbmcgui.DialogProgress() dp.create(AddonTitle,"Downloading ",'', 'Please Wait') lib=os.path.join(path, name+'.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join('special://','home')) time.sleep(2) dp.update(0,"", "Extracting Zip Please Wait") print '=======================================' print addonfolder print '=======================================' extract.all(lib,addonfolder,dp) dialog.ok(AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi") common.killxbmc()() else: dialog.ok('[COLOR red]A WIPE is required for the update[/COLOR]','Select the [COLOR green]YES[/COLOR] option in the NEXT WINDOW to wipe now.','Select the [COLOR red]NO[/COLOR] option in the NEXT WINDOW to update later.','[I][COLOR powderblue]If you wish to update later you can do so in [/COLOR][COLOR ghostwhite]Project X[/COLOR] [COLOR lightsteelblue]Wizard[/COLOR][/I]') wipe.FRESHSTART() else: dialog.ok(AddonTitle,'[COLOR ghostwhite]Your build is up to date.[/COLOR]', "[COLOR ghostwhite]Current Build: [/COLOR][COLOR yellow]" + build + "[/COLOR]", "[COLOR ghostwhite]Current Version: [/COLOR][COLOR yellow]" + newversion + "[/COLOR]") ####################################################################### # Check for Beta Updates ####################################################################### if BetaUpdate == 0: dialog = xbmcgui.Dialog() checkurl = BetaTwo vers = open(CHECKVERSION, "r") regex = re.compile(r'<build>(.+?)</build><version>(.+?)</version>') for line in vers: if KryptonUpdate == 0: currversion = regex.findall(line) for build,vernumber in currversion: if vernumber > 0: req = urllib2.Request(checkurl) req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') try: response = urllib2.urlopen(req) except: dialog.ok(AddonTitle,'Sorry we are unable to check for [B]KRYPTON[/B] updates!','The update host appears to be down.','Please check for updates later via the wizard.') sys.exit(1) link=response.read() response.close() match = re.compile('<build>'+build+'</build><version>(.+?)</version><fresh>(.+?)</fresh>').findall(link) for newversion,fresh in match: if newversion > vernumber: choice = xbmcgui.Dialog().yesno("NEW UPDATE AVAILABLE", 'Found a new update for the Build', build + " ver: "+newversion, 'Do you want to install it now?', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 1: if fresh =='false': # TRUE updateurl = BetaOne req = urllib2.Request(updateurl) req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') try: response = urllib2.urlopen(req) except: dialog.ok(AddonTitle,'Sorry we were unable to download the update!','The update host appears to be down.','Please check for updates later via the wizard.') sys.exit(1) link=response.read() response.close() match = re.compile('<build>'+build+'</build><url>(.+?)</url>').findall(link) for url in match: path = xbmc.translatePath(os.path.join('special://home/addons','packages')) name = "build" dp = xbmcgui.DialogProgress() dp.create(AddonTitle,"Downloading ",'', 'Please Wait') lib=os.path.join(path, name+'.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join('special://','home')) time.sleep(2) dp.update(0,"", "Extracting Zip Please Wait") print '=======================================' print addonfolder print '=======================================' extract.all(lib,addonfolder,dp) dialog.ok(AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi") common.killxbmc()() else: dialog.ok('[COLOR red]A WIPE is required for the update[/COLOR]','Select the [COLOR green]YES[/COLOR] option in the NEXT WINDOW to wipe now.','Select the [COLOR red]NO[/COLOR] option in the NEXT WINDOW to update later.','[I][COLOR powderblue]If you wish to update later you can do so in [/COLOR][COLOR ghostwhite]Project X[/COLOR] [COLOR lightsteelblue]Wizard[/COLOR][/I]') wipe.FRESHSTART() else: dialog.ok(AddonTitle,'[COLOR ghostwhite]Your build is up to date.[/COLOR]', "[COLOR ghostwhite]Current Build: [/COLOR][COLOR yellow]" + build + "[/COLOR]", "[COLOR ghostwhite]Current Version: [/COLOR][COLOR yellow]" + newversion + "[/COLOR]")
def update(): JarvisUpdate = 0 KryptonUpdate = 0 BetaUpdate = 0 dialog = xbmcgui.Dialog() try: response = urllib2.urlopen(JarvisTwo) except: JarvisUpdate = 1 dialog.ok(AddonTitle, 'Sorry we are unable to check for [B]JARVIS[/B] updates!', 'The Jarvis update host appears to be down.', '') try: response = urllib2.urlopen(KryptonTwo) except: KryptonUpdate = 1 dialog.ok(AddonTitle, 'Sorry we are unable to check for [B]KRYPTON[/B] updates!', 'The update host appears to be down.', 'Please check for updates later via the wizard.') try: response = urllib2.urlopen(BetaTwo) except: BetaUpdate = 1 dialog.ok(AddonTitle, 'Sorry we are unable to check for [B]BETA[/B] updates!', 'The update host appears to be down.', 'Please check for updates later via the wizard.') ####################################################################### # Check for Jarvis Updates ####################################################################### if JarvisUpdate == 0: dialog = xbmcgui.Dialog() checkurl = JarvisTwo vers = open(CHECKVERSION, "r") regex = re.compile(r'<build>(.+?)</build><version>(.+?)</version>') for line in vers: if JarvisUpdate == 0: currversion = regex.findall(line) for build, vernumber in currversion: if vernumber > 0: req = urllib2.Request(checkurl) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) try: response = urllib2.urlopen(req) except: dialog.ok( AddonTitle, 'Sorry we are unable to check for [B]JARVIS[/B] updates!', 'The update host appears to be down.', 'Please check for updates later via the wizard.' ) sys.exit(1) link = response.read() response.close() match = re.compile( '<build>' + build + '</build><version>(.+?)</version><fresh>(.+?)</fresh>' ).findall(link) for newversion, fresh in match: if newversion > vernumber: choice = xbmcgui.Dialog().yesno( "NEW UPDATE AVAILABLE", 'Found a new update for the Build', build + " ver: " + newversion, 'Do you want to install it now?', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 1: if fresh == 'false': # TRUE updateurl = JarvisOne req = urllib2.Request(updateurl) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) try: response = urllib2.urlopen(req) except: dialog.ok( AddonTitle, 'Sorry we were unable to download the update!', 'The update host appears to be down.', 'Please check for updates later via the wizard.' ) sys.exit(1) link = response.read() response.close() match = re.compile( '<build>' + build + '</build><url>(.+?)</url>' ).findall(link) for url in match: path = xbmc.translatePath( os.path.join( 'special://home/addons', 'packages')) name = "build" dp = xbmcgui.DialogProgress() dp.create(AddonTitle, "Downloading ", '', 'Please Wait') lib = os.path.join( path, name + '.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath( os.path.join( 'special://', 'home')) time.sleep(2) dp.update( 0, "", "Extracting Zip Please Wait") print '=======================================' print addonfolder print '=======================================' extract.all(lib, addonfolder, dp) dialog.ok( AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi" ) Common.killxbmc() else: dialog.ok( AddonTitle, '[COLOR red]A WIPE (FACTORY RESET)[/COLOR] is required for the update... [COLOR red]WOULD YOU LIKE TO WIPE THE SYSTEM NOW?[/COLOR]', '', '') wipe.FRESHSTART() else: dialog.ok( AddonTitle, '[COLOR ghostwhite]Your build is up to date.[/COLOR]', "[COLOR ghostwhite]Current Build: [/COLOR][COLOR yellow]" + build + "[/COLOR]", "[COLOR ghostwhite]Current Version: [/COLOR][COLOR yellow]" + newversion + "[/COLOR]") ####################################################################### # Check for Krypton Updates ####################################################################### if KryptonUpdate == 0: dialog = xbmcgui.Dialog() checkurl = KryptonTwo vers = open(CHECKVERSION, "r") regex = re.compile(r'<build>(.+?)</build><version>(.+?)</version>') for line in vers: if KryptonUpdate == 0: currversion = regex.findall(line) for build, vernumber in currversion: if vernumber > 0: req = urllib2.Request(checkurl) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) try: response = urllib2.urlopen(req) except: dialog.ok( AddonTitle, 'Sorry we are unable to check for [B]KRYPTON[/B] updates!', 'The update host appears to be down.', 'Please check for updates later via the wizard.' ) sys.exit(1) link = response.read() response.close() match = re.compile( '<build>' + build + '</build><version>(.+?)</version><fresh>(.+?)</fresh>' ).findall(link) for newversion, fresh in match: if newversion > vernumber: choice = xbmcgui.Dialog().yesno( "NEW UPDATE AVAILABLE", 'Found a new update for the Build', build + " ver: " + newversion, 'Do you want to install it now?', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 1: if fresh == 'false': # TRUE updateurl = KryptonOne req = urllib2.Request(updateurl) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) try: response = urllib2.urlopen(req) except: dialog.ok( AddonTitle, 'Sorry we were unable to download the update!', 'The update host appears to be down.', 'Please check for updates later via the wizard.' ) sys.exit(1) link = response.read() response.close() match = re.compile( '<build>' + build + '</build><url>(.+?)</url>' ).findall(link) for url in match: path = xbmc.translatePath( os.path.join( 'special://home/addons', 'packages')) name = "build" dp = xbmcgui.DialogProgress() dp.create(AddonTitle, "Downloading ", '', 'Please Wait') lib = os.path.join( path, name + '.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath( os.path.join( 'special://', 'home')) time.sleep(2) dp.update( 0, "", "Extracting Zip Please Wait") print '=======================================' print addonfolder print '=======================================' extract.all(lib, addonfolder, dp) dialog.ok( AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi" ) common.killxbmc()() else: dialog.ok( '[COLOR red]A WIPE is required for the update[/COLOR]', 'Select the [COLOR green]YES[/COLOR] option in the NEXT WINDOW to wipe now.', 'Select the [COLOR red]NO[/COLOR] option in the NEXT WINDOW to update later.', '[I][COLOR powderblue]If you wish to update later you can do so in [/COLOR][COLOR ghostwhite]Project X[/COLOR] [COLOR lightsteelblue]Wizard[/COLOR][/I]' ) wipe.FRESHSTART() else: dialog.ok( AddonTitle, '[COLOR ghostwhite]Your build is up to date.[/COLOR]', "[COLOR ghostwhite]Current Build: [/COLOR][COLOR yellow]" + build + "[/COLOR]", "[COLOR ghostwhite]Current Version: [/COLOR][COLOR yellow]" + newversion + "[/COLOR]") ####################################################################### # Check for Beta Updates ####################################################################### if BetaUpdate == 0: dialog = xbmcgui.Dialog() checkurl = BetaTwo vers = open(CHECKVERSION, "r") regex = re.compile(r'<build>(.+?)</build><version>(.+?)</version>') for line in vers: if KryptonUpdate == 0: currversion = regex.findall(line) for build, vernumber in currversion: if vernumber > 0: req = urllib2.Request(checkurl) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) try: response = urllib2.urlopen(req) except: dialog.ok( AddonTitle, 'Sorry we are unable to check for [B]KRYPTON[/B] updates!', 'The update host appears to be down.', 'Please check for updates later via the wizard.' ) sys.exit(1) link = response.read() response.close() match = re.compile( '<build>' + build + '</build><version>(.+?)</version><fresh>(.+?)</fresh>' ).findall(link) for newversion, fresh in match: if newversion > vernumber: choice = xbmcgui.Dialog().yesno( "NEW UPDATE AVAILABLE", 'Found a new update for the Build', build + " ver: " + newversion, 'Do you want to install it now?', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 1: if fresh == 'false': # TRUE updateurl = BetaOne req = urllib2.Request(updateurl) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) try: response = urllib2.urlopen(req) except: dialog.ok( AddonTitle, 'Sorry we were unable to download the update!', 'The update host appears to be down.', 'Please check for updates later via the wizard.' ) sys.exit(1) link = response.read() response.close() match = re.compile( '<build>' + build + '</build><url>(.+?)</url>' ).findall(link) for url in match: path = xbmc.translatePath( os.path.join( 'special://home/addons', 'packages')) name = "build" dp = xbmcgui.DialogProgress() dp.create(AddonTitle, "Downloading ", '', 'Please Wait') lib = os.path.join( path, name + '.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath( os.path.join( 'special://', 'home')) time.sleep(2) dp.update( 0, "", "Extracting Zip Please Wait") print '=======================================' print addonfolder print '=======================================' extract.all(lib, addonfolder, dp) dialog.ok( AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi" ) common.killxbmc()() else: dialog.ok( '[COLOR red]A WIPE is required for the update[/COLOR]', 'Select the [COLOR green]YES[/COLOR] option in the NEXT WINDOW to wipe now.', 'Select the [COLOR red]NO[/COLOR] option in the NEXT WINDOW to update later.', '[I][COLOR powderblue]If you wish to update later you can do so in [/COLOR][COLOR ghostwhite]Project X[/COLOR] [COLOR lightsteelblue]Wizard[/COLOR][/I]' ) wipe.FRESHSTART() else: dialog.ok( AddonTitle, '[COLOR ghostwhite]Your build is up to date.[/COLOR]', "[COLOR ghostwhite]Current Build: [/COLOR][COLOR yellow]" + build + "[/COLOR]", "[COLOR ghostwhite]Current Version: [/COLOR][COLOR yellow]" + newversion + "[/COLOR]")
def INSTALL(name, url, description): #Check is the packages folder exists, if not create it. path = xbmc.translatePath(os.path.join('special://home/addons', 'packages')) if not os.path.exists(path): os.makedirs(path) wipeme = 0 if name == "SKYLEX": wipeme = 1 choice = xbmcgui.Dialog().yesno( AddonTitle, 'SKYLEX was designed for low end machines like Firesticks.', 'Recomended: Single Core CPU | 1GB RAM or more', '[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "TUGAPOWER": wipeme = 1 choice = xbmcgui.Dialog().yesno( AddonTitle, 'TUGAPOWER was designed for high end machines like Firesticks Amazon Fire TV & Nvidia Shield.', 'Recomended: Single Core CPU | 1GB RAM or more', '[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "300": wipeme = 1 name = "300" choice = xbmcgui.Dialog().yesno( AddonTitle, '300 was designed for mid-level machines like MX8 & T8.', 'Recomended: Single Core CPU | 1GB RAM or more', '[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "FUTURAMA": wipeme = 1 choice = xbmcgui.Dialog().yesno( AddonTitle, 'FUTURAMA was designed for mid-level machines like MX8 & T8.', 'Recomended: Single Core CPU | 1GB RAM or more', '[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "EURO 2016": wipeme = 1 choice = xbmcgui.Dialog().yesno( AddonTitle, 'EURO 2016 was designed for mid-level machines like MX8 & T8.', 'Recomended: Single Core CPU | 1GB RAM or more', '[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "SONAR": wipeme = 1 choice = xbmcgui.Dialog().yesno( AddonTitle, 'Sonaer is a BETA build that needs testing.', 'Recomended: Dual Core CPU | 2GB RAM or more', '[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "XXX ADDON EXPANSION PACK": if not os.path.exists(CHECKVERSION): dialog = xbmcgui.Dialog() dialog.ok( AddonTitle, 'Sorry, you are not using a Project X Build.', 'This pack is only available for Project X Build users.') sys.exit(1) if name == "EMBER": wipeme = 1 choice = xbmcgui.Dialog().yesno( AddonTitle, 'Ember is a BETA build that needs testing.', 'Recomended: Dual Core CPU | 2GB RAM or more', '[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "EMBER FOR FIRESTICKS": wipeme = 1 choice = xbmcgui.Dialog().yesno( AddonTitle, 'Ember is a BETA build that needs testing.', 'Recomended: Amazon Fire Stick', '[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if wipeme == 1: wipe.WIPERESTORE() path = xbmc.translatePath(os.path.join('special://home/addons', 'packages')) if not os.path.exists(path): os.makedirs(path) buildname = name dp = xbmcgui.DialogProgress() dp.create(AddonTitle, "", "", "build: " + buildname) name = "build" lib = os.path.join(path, name + '.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join('special://', 'home')) time.sleep(2) dp.update(0, "", "Extracting Zip Please Wait", "") unzip(lib, addonfolder, dp) dialog = xbmcgui.Dialog() time.sleep(1) try: os.remove(lib) except: pass dialog.ok( AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi" ) time.sleep(2) Common.killxbmc()
def INSTALL(name,url,description): #Check is the packages folder exists, if not create it. path = xbmc.translatePath(os.path.join('special://home/addons','packages')) if not os.path.exists(path): os.makedirs(path) wipeme = 0 if name == "ImperioTuga SLIM": wipeme = 1 choice = xbmcgui.Dialog().yesno(AddonTitle, 'Imperiotuga was designed for low end machines like Firesticks.','Recomended: Single Core CPU | 1GB RAM or more','[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "ImperioTuga": wipeme = 1 choice = xbmcgui.Dialog().yesno(AddonTitle, 'ImperioTugaSLIM was designed for high end machines like the Amazon Fire TV & Nvidia Shield.','Recomended: Quad Core CPU | 4GB RAM or more','[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "ImperioTuga ESPANHA #BREVEMENTE#": wipeme = 1 choice = xbmcgui.Dialog().yesno(AddonTitle, 'ImperioTuga ESPANHA #BREVEMENTE# was designed for mid-level machines like MX8 & T8.','Recomended: Dual Core CPU | 2GB RAM or more','[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "ImperioTuga ITALIA #BREVEMENTE#": wipeme = 1 choice = xbmcgui.Dialog().yesno(AddonTitle, 'ImperioTuga ITALIA #BREVEMENTE# was designed for mid-level machines like MX8 & T8.','Recomended: Dual Core CPU | 2GB RAM or more','[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if wipeme == 1: wipe.WIPERESTORE() path = xbmc.translatePath(os.path.join('special://home/addons','packages')) if not os.path.exists(path): os.makedirs(path) buildname = name dp = xbmcgui.DialogProgress() dp.create(AddonTitle,"","","Build: " + buildname) name = "build" lib=os.path.join(path, name+'.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join('special://','home')) time.sleep(2) dp.update(0,"","Extracting Zip Please Wait","") unzip(lib,addonfolder,dp) dialog = xbmcgui.Dialog() time.sleep(1) try: os.remove(lib) except: pass dialog.ok(AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi") time.sleep(2) Common.killxbmc()
elif mode==70: backuprestore.Backup() elif mode==71: backuprestore.Restore() elif mode==72: backuprestore.ListBackDel() elif mode==73: backuprestore.DeleteAllBackups() elif mode==85: print "############ ATTEMPT TO KILL XBMC/KODI #################" Common.killxbmc() elif mode==87: community.COMMUNITY() elif mode==88: BUILDMENU() elif mode==90: installer.INSTALL(name,url,description) elif mode==92: ServerStatus.Check() elif mode==93: community.SHOWCOMMUNITYBUILDS(url)
def INSTALL(name,url,description): #Check is the packages folder exists, if not create it. path = xbmc.translatePath(os.path.join('special://home/addons','packages')) if not os.path.exists(path): os.makedirs(path) wipeme = 0 if name == "SKYLEX": wipeme = 1 choice = xbmcgui.Dialog().yesno(AddonTitle, 'SKYLEX was designed for low end machines like Firesticks.','Recomended: Single Core CPU | 1GB RAM or more','[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "TUGAPOWER": wipeme = 1 choice = xbmcgui.Dialog().yesno(AddonTitle, 'TUGAPOWER was designed for high end machines like Firesticks Amazon Fire TV & Nvidia Shield.','Recomended: Single Core CPU | 1GB RAM or more','[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "300": wipeme = 1 name = "300" choice = xbmcgui.Dialog().yesno(AddonTitle, '300 was designed for mid-level machines like MX8 & T8.','Recomended: Single Core CPU | 1GB RAM or more','[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "FUTURAMA": wipeme = 1 choice = xbmcgui.Dialog().yesno(AddonTitle, 'FUTURAMA was designed for mid-level machines like MX8 & T8.','Recomended: Single Core CPU | 1GB RAM or more','[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "EURO 2016": wipeme = 1 choice = xbmcgui.Dialog().yesno(AddonTitle, 'EURO 2016 was designed for mid-level machines like MX8 & T8.','Recomended: Single Core CPU | 1GB RAM or more','[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "SONAR": wipeme = 1 choice = xbmcgui.Dialog().yesno(AddonTitle, 'Sonaer is a BETA build that needs testing.','Recomended: Dual Core CPU | 2GB RAM or more','[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "XXX ADDON EXPANSION PACK": if not os.path.exists(CHECKVERSION): dialog = xbmcgui.Dialog() dialog.ok(AddonTitle,'Sorry, you are not using a Project X Build.','This pack is only available for Project X Build users.') sys.exit(1) if name == "EMBER": wipeme = 1 choice = xbmcgui.Dialog().yesno(AddonTitle, 'Ember is a BETA build that needs testing.','Recomended: Dual Core CPU | 2GB RAM or more','[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if name == "EMBER FOR FIRESTICKS": wipeme = 1 choice = xbmcgui.Dialog().yesno(AddonTitle, 'Ember is a BETA build that needs testing.','Recomended: Amazon Fire Stick','[I][COLOR lightsteelblue]Would you like to download this build now?[/I][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) if wipeme == 1: wipe.WIPERESTORE() path = xbmc.translatePath(os.path.join('special://home/addons','packages')) if not os.path.exists(path): os.makedirs(path) buildname = name dp = xbmcgui.DialogProgress() dp.create(AddonTitle,"","","build: " + buildname) name = "build" lib=os.path.join(path, name+'.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join('special://','home')) time.sleep(2) dp.update(0,"","Extracting Zip Please Wait","") unzip(lib,addonfolder,dp) dialog = xbmcgui.Dialog() time.sleep(1) try: os.remove(lib) except: pass dialog.ok(AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi") time.sleep(2) Common.killxbmc()
def INSTALL(name, url, description): #Check is the packages folder exists, if not create it. path = xbmc.translatePath(os.path.join('special://home/addons', 'packages')) if not os.path.exists(path): os.makedirs(path) wipeme = 1 skipskin = 0 skin = xbmc.getSkinDir() KODIV = float(xbmc.getInfoLabel("System.BuildVersion")[:4]) skinswapped = 0 #SWITCH THE SKIN IF THE CURRENT SKIN IS NOT CONFLUENCE if skin not in ['skin.confluence', 'skin.estuary'] and skipskin == 0: choice = xbmcgui.Dialog().yesno( AddonTitle, '[COLOR red][B]YOU ARE NOT USING THE DEFAULT SKIN.[/B][/COLOR]', '[COLOR orange]Click YES to attempt to AUTO SWITCH the skin[/COLOR]', '[COLOR red]Please DO NOT PRESS ANY BUTTONS or MOVE THE MOUSE while the process is taking place, it is AUTOMATIC[/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) skin = 'skin.estuary' if KODIV >= 17 else 'skin.confluence' skinSwitch.swapSkins(skin) skinswapped = 1 time.sleep(1) #IF A SKIN SWAP HAS HAPPENED CHECK IF AN OK DIALOG (CONFLUENCE INFO SCREEN) IS PRESENT, PRESS OK IF IT IS PRESENT if skinswapped == 1: if not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"): xbmc.executebuiltin("Action(Select)") #IF THERE IS NOT A YES NO DIALOG (THE SCREEN ASKING YOU TO SWITCH TO CONFLUENCE) THEN SLEEP UNTIL IT APPEARS if skinswapped == 1: while not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"): time.sleep(1) #WHILE THE YES NO DIALOG IS PRESENT PRESS LEFT AND THEN SELECT TO CONFIRM THE SWITCH TO CONFLUENCE. if skinswapped == 1: while xbmc.getCondVisibility("Window.isVisible(yesnodialog)"): xbmc.executebuiltin("Action(Left)") xbmc.executebuiltin("Action(Select)") time.sleep(1) skin = xbmc.getSkinDir() #CHECK IF THE SKIN IS NOT CONFLUENCE if skin not in ['skin.confluence', 'skin.estuary'] and skipskin == 0: choice = xbmcgui.Dialog().yesno( AddonTitle, '[COLOR red][B]ERROR: AUTOSWITCH WAS NOT SUCCESFULL[/B][/COLOR]', '[COLOR red]Click YES to MANUALLY SWITCH the skin now[/COLOR]', '[COLOR red]You can press NO and attempt the AUTO SWITCH again if you wish[/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 1: xbmc.executebuiltin("ActivateWindow(appearancesettings)") return else: sys.exit(1) if wipeme == 1: wipe.WIPERESTORE() path = xbmc.translatePath(os.path.join('special://home/addons', 'packages')) if not os.path.exists(path): os.makedirs(path) buildname = name dp = xbmcgui.DialogProgress() dp.create(AddonTitle, "", "", "Build: " + buildname) name = "build" lib = os.path.join(path, name + '.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join('special://', 'home')) time.sleep(2) dp.update(0, "", "Extracting Zip Please Wait", "") unzip(lib, addonfolder, dp) dialog = xbmcgui.Dialog() time.sleep(1) try: os.remove(lib) except: pass if os.path.isfile(FAVS_NEW): if os.path.isfile(FAVS): try: os.remove(FAVS) os.rename(FAVS_NEW, FAVS) except: pass else: try: os.rename(FAVS_NEW, FAVS) except: pass dialog.ok( AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi" ) Common.killxbmc()
def INSTALL(name,url,description): #Check is the packages folder exists, if not create it. path = xbmc.translatePath(os.path.join('special://home/addons','packages')) if not os.path.exists(path): os.makedirs(path) wipeme = 1 skipskin = 0 skin = xbmc.getSkinDir() KODIV = float(xbmc.getInfoLabel("System.BuildVersion")[:4]) skinswapped = 0 #SWITCH THE SKIN IF THE CURRENT SKIN IS NOT CONFLUENCE if skin not in ['skin.confluence','skin.estuary'] and skipskin == 0: choice = xbmcgui.Dialog().yesno(AddonTitle, '[COLOR red][B]YOU ARE NOT USING THE DEFAULT SKIN.[/B][/COLOR]','[COLOR orange]Click YES to attempt to AUTO SWITCH the skin[/COLOR]','[COLOR red]Please DO NOT PRESS ANY BUTTONS or MOVE THE MOUSE while the process is taking place, it is AUTOMATIC[/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 0: sys.exit(1) skin = 'skin.estuary' if KODIV >= 17 else 'skin.confluence' skinSwitch.swapSkins(skin) skinswapped = 1 time.sleep(1) #IF A SKIN SWAP HAS HAPPENED CHECK IF AN OK DIALOG (CONFLUENCE INFO SCREEN) IS PRESENT, PRESS OK IF IT IS PRESENT if skinswapped == 1: if not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"): xbmc.executebuiltin( "Action(Select)" ) #IF THERE IS NOT A YES NO DIALOG (THE SCREEN ASKING YOU TO SWITCH TO CONFLUENCE) THEN SLEEP UNTIL IT APPEARS if skinswapped == 1: while not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"): time.sleep(1) #WHILE THE YES NO DIALOG IS PRESENT PRESS LEFT AND THEN SELECT TO CONFIRM THE SWITCH TO CONFLUENCE. if skinswapped == 1: while xbmc.getCondVisibility("Window.isVisible(yesnodialog)"): xbmc.executebuiltin( "Action(Left)" ) xbmc.executebuiltin( "Action(Select)" ) time.sleep(1) skin = xbmc.getSkinDir() #CHECK IF THE SKIN IS NOT CONFLUENCE if skin not in ['skin.confluence','skin.estuary'] and skipskin == 0: choice = xbmcgui.Dialog().yesno(AddonTitle, '[COLOR red][B]ERROR: AUTOSWITCH WAS NOT SUCCESFULL[/B][/COLOR]','[COLOR red]Click YES to MANUALLY SWITCH the skin now[/COLOR]','[COLOR red]You can press NO and attempt the AUTO SWITCH again if you wish[/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]',nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 1: xbmc.executebuiltin("ActivateWindow(appearancesettings)") return else: sys.exit(1) if wipeme == 1: wipe.WIPERESTORE() path = xbmc.translatePath(os.path.join('special://home/addons','packages')) if not os.path.exists(path): os.makedirs(path) buildname = name dp = xbmcgui.DialogProgress() dp.create(AddonTitle,"","","Build: " + buildname) name = "build" lib=os.path.join(path, name+'.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join('special://','home')) time.sleep(2) dp.update(0,"","Extracting Zip Please Wait","") unzip(lib,addonfolder,dp) dialog = xbmcgui.Dialog() time.sleep(1) try: os.remove(lib) except: pass if os.path.isfile(FAVS_NEW): if os.path.isfile(FAVS): try: os.remove(FAVS) os.rename(FAVS_NEW, FAVS) except: pass else: try: os.rename(FAVS_NEW, FAVS) except: pass dialog.ok(AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi") Common.killxbmc()
downloader.download(url, lib, dp) addonfolder = xbmc.translatePath( os.path.join( 'special://home', 'userdata')) time.sleep(2) dp.update( 0, "", "Extracting Zip Please Wait") unzipprogress(lib, addonfolder, dp) dialog = xbmcgui.Dialog() dialog.ok( AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi" ) Common.killxbmc() else: dialog.ok( '[COLOR red]A WIPE is required for the update[/COLOR]', 'Select the [COLOR green]YES[/COLOR] option in the NEXT WINDOW to wipe now.', 'Select the [COLOR red]NO[/COLOR] option in the NEXT WINDOW to update later.', '[I][COLOR snow]If you wish to update later you can do so in [/COLOR][COLOR blue]Project X[/COLOR] [COLOR lime]Wizard[/COLOR][/I]' ) wipe.FRESHSTART() if nointernet == 0 and KryptonUpdate == 0: if check == 'true': if os.path.exists(CHECKVERSION): checkurl = KryptonTwo vers = open(CHECKVERSION, "r")
def check(): xbmc.executebuiltin("ActivateWindow(busydialog)") pleasecheck = 0 SSUpdate = 0 dialog = xbmcgui.Dialog() try: response = urlopen(SSTwo) except: SSUpdate = 1 dialog.ok(AddonTitle, 'Sorry we are unable to check for [B]SSTV[/B] updates!', 'The update host appears to be down.', '') xbmc.executebuiltin("Dialog.Close(busydialog)") ####################################################################### # Check for Build Updates ####################################################################### if SSUpdate == 0 and os.path.isfile(CHECKVERSION): dialog = xbmcgui.Dialog() checkurl = SSTwo vers = open(CHECKVERSION, "r") regex = re.compile(r'<build>(.+?)</build><version>(.+?)</version>') for line in vers: if SSUpdate == 0: currversion = regex.findall(line) for build, vernumber in currversion: if vernumber > 0: req = urllib2.Request(checkurl) req.add_header('User-Agent', 'TheWizardIsHere') try: response = urllib2.urlopen(req) except: dialog.ok( AddonTitle, 'Sorry we are unable to check for [B]SSTV[/B] updates!', 'The update host appears to be down.', 'Please check for updates later via the wizard.' ) sys.exit(1) xbmc.executebuiltin("Dialog.Close(busydialog)") link = response.read() response.close() match = re.compile( '<build>' + build + '</build><version>(.+?)</version><fresh>(.+?)</fresh>' ).findall(link) for newversion, fresh in match: if newversion > vernumber: choice = xbmcgui.Dialog().yesno( "NEW UPDATE AVAILABLE", 'Found a new update for the Build', build + " ver: " + newversion, 'Do you want to install it now?', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 1: if fresh == 'false': # TRUE updateurl = SSOne req = urllib2.Request(updateurl) req.add_header('User-Agent', 'TheWizardIsHere') try: response = urllib2.urlopen(req) except: dialog.ok( AddonTitle, 'Sorry we were unable to download the update!', 'The update host appears to be down.', 'Please check for updates later via the wizard.' ) sys.exit(1) xbmc.executebuiltin( "Dialog.Close(busydialog)") link = response.read() response.close() match = re.compile( '<build>' + build + '</build><url>(.+?)</url>' ).findall(link) for url in match: path = xbmc.translatePath( os.path.join( 'special://home/addons', 'packages')) name = "build" dp = xbmcgui.DialogProgress() dp.create(AddonTitle, "Downloading ", '', 'Please Wait') lib = os.path.join( path, name + '.zip') try: os.remove(lib) except: pass downloader.download(url, lib, dp) addonfolder = xbmc.translatePath( os.path.join( 'special://', 'home')) time.sleep(2) dp.update( 0, "", "Extracting Zip Please Wait") print '=======================================' print addonfolder print '=======================================' extract.all(lib, addonfolder, dp) xbmc.executebuiltin( "Dialog.Close(busydialog)") dialog.ok( AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi" ) Common.killxbmc() sys.exit(1) else: dialog.ok( AddonTitle, '[COLOR red]A WIPE (FACTORY RESET)[/COLOR] is required for the update... [COLOR red]WOULD YOU LIKE TO WIPE THE SYSTEM NOW?[/COLOR]', '', '') xbmc.executebuiltin( "Dialog.Close(busydialog)") wipe.FRESHSTART() sys.exit(1) else: xbmc.executebuiltin( "Dialog.Close(busydialog)") sys.exit(1) else: xbmc.executebuiltin("Dialog.Close(busydialog)") dialog.ok( AddonTitle, '[COLOR ghostwhite]Your build is up to date.[/COLOR]', "[COLOR ghostwhite]Current Build: [/COLOR][COLOR yellow]" + build + "[/COLOR]", "[COLOR ghostwhite]Current Version: [/COLOR][COLOR yellow]" + newversion + "[/COLOR]") sys.exit(1) xbmc.executebuiltin("Dialog.Close(busydialog)") dialog.ok(AddonTitle, '[COLOR ghostwhite]An unknown error occurred.[/COLOR]', "[COLOR yellow]Please try again later.[/COLOR]", "")