def SHOWPROTECTEDBUILDS(name, url, description): desca = description developer = desca.split(',')[0] hidden = desca.split(',')[1] try: youtube_id = desca.split(',')[2] except: youtube_id = "null" try: link = Common.OPEN_URL(url).replace('\n', '').replace('\r', '') match = re.compile('notice="(.+?)"').findall(link) for notice in match: dialog.ok(AddonTitle, '[COLOR red][B]' + notice + '[/B][/COLOR]') except: pass vq = Common._get_keyboard(heading="Please Enter Your Password") if (not vq): return False, 0 title = vq if "http" not in hidden: AUTH = BASEURL + "community/protected/" + hidden + '.txt' else: AUTH = hidden passed = 0 link = Common.OPEN_URL(AUTH).replace('\n', '').replace('\r', '') match = re.compile('passkey="(.+?)"').findall(link) for passkey in match: if title == passkey: passed = 1 if passed == 0: dialog.ok(AddonTitle, "Sorry the password entered was not found.", '[COLOR smokewhite]Thank you for using ECHO Wizard[/COLOR]') sys.exit(0) link = Common.OPEN_URL(url).replace('\n', '').replace('\r', '') match = re.compile( 'name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)"').findall(link) for name, url, iconimage, fanart in match: description = "null" + "," + developer + "," + youtube_id name2 = name url = name2 + "," + url name = "[COLOR silver][B]" + name + "[/B][/COLOR]" bname = "- [COLOR white]Week:[/COLOR] [COLOR yellowgreen][B]" + count + "[/B][/COLOR][COLOR white] - Total:[/COLOR] [COLOR yellowgreen][B]" + total + "[/B][/COLOR]" Common.addDir(name + bname, url, 97, iconimage, fanart, description) try: f = open(COM_NOTICE, mode='r') msg = f.read() f.close() Common.TextBox( '[COLOR yellowgreen][B]ECHO Wizard Community Builds[/B][/COLOR]', "%s" % msg) except: pass
def READ_ZIP_TRAKT(url): dialog = xbmcgui.Dialog() if dialog.yesno(AddonTitle,"[COLOR smokewhite]" + url + "[/COLOR]","Do you want to restore this backup?"): _out = xbmc.translatePath(os.path.join('special://','home/tmp')) _in = url dp.create(AddonTitle,"Restoring File:",_in,'') unzip(_in, _out, dp) name = "[COLOR ghostwhite][B]RESTORE[/B][/COLOR]" link=Common.OPEN_URL('http://pastebin.com/raw/CU2PSGze') plugins=re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA,match)) ADDONSETTINGS = xbmc.translatePath(os.path.join(ADDONPATH,'settings.xml')) EXCLUDEMOVE = xbmc.translatePath(os.path.join(_out,match+'_settings.xml')) if os.path.exists(EXCLUDEMOVE): if not os.path.exists(ADDONPATH): os.makedirs(ADDONPATH) if os.path.isfile(ADDONSETTINGS): os.remove(ADDONSETTINGS) os.rename(EXCLUDEMOVE, ADDONSETTINGS) try: os.remove(EXCLUDEMOVE) except: pass dialog = xbmcgui.Dialog() dialog.ok(AddonTitle,'RD and Trakt Settings Successfully Restored','','') else: sys.exit(1)
def AUTO_READ_ZIP_TRAKT(url): dialog = xbmcgui.Dialog() _out = xbmc.translatePath(os.path.join('special://','home/tmp_trakt')) _in = url dp.create(AddonTitle,"Restoring File:",_in,'') unzip(_in, _out, dp) name = "[COLOR ghostwhite][B]RESTORE[/B][/COLOR]" link=Common.OPEN_URL('http://echocoder.com/other/rd_trakt.xml') plugins=re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: try: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA,match)) ADDONSETTINGS = xbmc.translatePath(os.path.join(ADDONPATH,'settings.xml')) EXCLUDEMOVE = xbmc.translatePath(os.path.join(_out,match+'_settings.xml')) if os.path.isfile(EXCLUDEMOVE): if not os.path.exists(ADDONPATH): os.makedirs(ADDONPATH) if os.path.isfile(ADDONSETTINGS): os.remove(ADDONSETTINGS) try: os.rename(EXCLUDEMOVE, ADDONSETTINGS) except: pass try: os.remove(EXCLUDEMOVE) except: pass except: pass try: shutil.rmtree(_out) shutil.rmdir(_out) except: pass
def BACKUP_RD_TRAKT(): if not os.path.exists(USB): os.makedirs(USB) vq = _get_keyboard(heading="Enter a name for this backup") if (not vq): return False, 0 title = urllib.quote_plus(vq) backup_zip = xbmc.translatePath( os.path.join(USB, title + 'RD_Trakt_Settings.zip')) if not os.path.exists(EXCLUDES_FOLDER): os.makedirs(EXCLUDES_FOLDER) link = Common.OPEN_URL('http://pastebin.com/raw/CU2PSGze') plugins = re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA, match)) ADDONSETTINGS = xbmc.translatePath( os.path.join(ADDONPATH, 'settings.xml')) EXCLUDEMOVE = xbmc.translatePath( os.path.join(EXCLUDES_FOLDER, match + '_settings.xml')) dialog = xbmcgui.Dialog() try: if os.path.exists(ADDONSETTINGS): copyfile(ADDONSETTINGS, EXCLUDEMOVE) except: pass exclude_dirs = [' '] exclude_files = [" "] message_header = "Creating full backup..." message_header2 = "Creating full backup..." message1 = "Archiving..." message2 = "" message3 = "" try: ARCHIVE_CB(EXCLUDES_FOLDER, backup_zip, message_header2, message1, message2, message3, exclude_dirs, exclude_files) except: pass time.sleep(1) try: shutil.rmtree(EXCLUDEMOVE) shutil.rmdir(EXCLUDEMOVE) except: pass 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() dialog.ok("[COLOR green][B]SUCCESS![/B][/COLOR]", 'The backup was completed successfully!.', "Backup Location: ", '[COLOR=yellow]' + backup_zip + '[/COLOR]')
def AUTO_BACKUP_RD_TRAKT(): TMP_TRAKT = xbmc.translatePath(os.path.join(HOME, 'tmp_trakt')) if not os.path.exists(TMP_TRAKT): os.makedirs(TMP_TRAKT) backup_zip = xbmc.translatePath( os.path.join(TMP_TRAKT, 'Restore_RD_Trakt_Settings.zip')) if not os.path.exists(EXCLUDES_FOLDER): os.makedirs(EXCLUDES_FOLDER) link = Common.OPEN_URL('http://pastebin.com/raw/CU2PSGze') plugins = re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: try: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA, match)) ADDONSETTINGS = xbmc.translatePath( os.path.join(ADDONPATH, 'settings.xml')) EXCLUDEMOVE = xbmc.translatePath( os.path.join(EXCLUDES_FOLDER, match + '_settings.xml')) if os.path.exists(ADDONSETTINGS): copyfile(ADDONSETTINGS, EXCLUDEMOVE) found = 2 except: pass if found == 2: exclude_dirs = [' '] exclude_files = [" "] message_header = "Creating full backup..." message_header2 = "Creating full backup..." message1 = "Archiving..." message2 = "" message3 = "" ARCHIVE_CB(EXCLUDES_FOLDER, backup_zip, message_header2, message1, message2, message3, exclude_dirs, exclude_files) time.sleep(1) try: shutil.rmtree(EXCLUDES_FOLDER) shutil.rmdir(EXCLUDES_FOLDER) except: pass MARKER_TRAKT = xbmc.translatePath(os.path.join(TMP_TRAKT, 'marker.xml')) open(MARKER_TRAKT, 'w')
def Check_RD_TRAKT(): if not os.path.exists(EXCLUDES_FOLDER): os.makedirs(EXCLUDES_FOLDER) link = Common.OPEN_URL(BASEURL + base64.b64decode(b'b3RoZXIvcmRfdHJha3QueG1s')) plugins = re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA, match)) ADDONSETTINGS = xbmc.translatePath( os.path.join(ADDONPATH, 'settings.xml')) EXCLUDEMOVE = xbmc.translatePath( os.path.join(EXCLUDES_FOLDER, match + '_settings.xml')) if os.path.exists(ADDONSETTINGS): os.rename(ADDONSETTINGS, EXCLUDEMOVE)
def COMMUNITY(): i = 0 dp.create( AddonTitle, "[COLOR blue]We are getting the list of developers from our server.[/COLOR]", '[COLOR yellow]Please Wait...[/COLOR]', '') dp.update(0) namelist = [] urllist = [] hiddenlist = [] useragentlist = [] countlist = [] totallist = [] deslist = [] iconlist = [] fanartlist = [] link = Common.OPEN_URL(Community_List).replace('\n', '').replace('\r', '') match = re.compile( 'name="(.+?)".+?rl="(.+?)".+?rotected="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?seragent="(.+?)".+?ontact="(.+?)"' ).findall(link) dis_links = len(match) for name, url, hidden, iconimage, fanart, useragent, contact in match: if useragent.lower() == "null": useragent == "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36" i = i + 1 dis_count = str(i) progress = 100 * int(i) / int(dis_links) dp.update( progress, "Getting details of developer " + str(dis_count) + " of " + str(dis_links), '', "[COLOR white][B]FOUND - [/B] " + name + "[/COLOR]") developer = str( name.replace('[COLOR white][B]', '').replace('[/B][/COLOR]', '').replace('[/B][/COLOR]', '').replace(' BUILDS', '')) developer = developer.upper() description = str(developer + "," + hidden + "," + contact) namelist.append(name) urllist.append(url) hiddenlist.append(hidden) useragentlist.append(useragent) countlist.append( str(Common.count(developer + "DEVEL_COUNT", TEMP_FILE))) totallist.append(str(Common.count(developer + "TOTAL_DEV", TEMP_FILE))) deslist.append(description) iconlist.append(iconimage) fanartlist.append(fanart) combinedlists = list( zip(countlist, totallist, namelist, urllist, hiddenlist, deslist, iconlist, fanartlist, useragentlist)) tup = sorted(combinedlists, key=lambda x: int(x[0]), reverse=True) dp.close() rank = 1 for count, total, name, url, hidden, description, iconimage, fanart, ua in tup: developer = str( name.replace('[COLOR white][B]', '').replace('[/B][/COLOR]', '').replace('[/B][/COLOR]', '').replace(' BUILDS', '')) countfail = count try: count2 = int(count) count3 = "{:,}".format(count2) count = str(count3) except: count = countfail if hidden != "false": url = hidden + "|SPLIT|" + url + "|SPLIT|" + ua if rank == 1: bname = "[B] | [COLOR gold] This Week:[/COLOR][COLOR gold] " + count + " - [COLOR gold]Total:[/COLOR][COLOR gold] " + total + "[/COLOR] - [COLOR red][PASSWORD PROTECTED][/COLOR][/B][/COLOR]" Common.addDir( "[B][COLOR gold]1st - " + developer + "[/B][/COLOR]" + bname, url, 93, iconimage, fanart, description) rank = rank + 1 elif rank == 2: bname = "[B] | [COLOR silver] This Week:[/COLOR][COLOR silver] " + count + " - [COLOR silver]Total:[/COLOR][COLOR silver] " + total + "[/COLOR] - [COLOR red][PASSWORD PROTECTED][/COLOR][/B][/COLOR]" Common.addDir( "[B][COLOR silver]2nd - " + developer + "[/B][/COLOR]" + bname, url, 93, iconimage, fanart, description) rank = rank + 1 elif rank == 3: bname = "[B] | [COLOR orange] This Week:[/COLOR][COLOR orange] " + count + " - [COLOR orange]Total:[/COLOR][COLOR orange] " + total + "[/COLOR] - [COLOR red][PASSWORD PROTECTED][/COLOR][/B][/COLOR]" Common.addDir( "[B][COLOR orange]3rd - " + developer + "[/B][/COLOR]" + bname, url, 93, iconimage, fanart, description) rank = rank + 1 Common.addItem( "[COLOR white]-----------------------------------------------[/COLOR]", url, 17, ICON, FANART, description) else: bname = " | [COLOR white] This Week:[/COLOR][COLOR yellowgreen][B] " + count + " - [COLOR white]Total:[/COLOR][COLOR yellowgreen][B] " + total + "[/COLOR] - [COLOR red][PASSWORD PROTECTED][/COLOR][/B][/COLOR]" Common.addDir("[COLOR white]" + developer + "[/COLOR]" + bname, url, 93, iconimage, fanart, description) else: url = url + "|SPLIT|" + ua if rank == 1: bname = "[B] | [COLOR gold] This Week:[/COLOR][COLOR gold] " + count + "[/COLOR] - [COLOR gold]Total:[/COLOR][COLOR gold] " + total + "[/B][/COLOR]" Common.addDir( "[B][COLOR gold]1st - " + developer + "[/COLOR][/B]" + bname, url, 93, iconimage, fanart, description) rank = rank + 1 elif rank == 2: bname = "[B] | [COLOR silver] This Week:[/COLOR][COLOR silver] " + count + "[/COLOR] - [COLOR silver]Total:[/COLOR][COLOR silver] " + total + "[/B][/COLOR]" Common.addDir( "[B][COLOR silver]2nd - " + developer + "[/COLOR][/B]" + bname, url, 93, iconimage, fanart, description) rank = rank + 1 elif rank == 3: bname = "[B] | [COLOR orange] This Week:[/COLOR][COLOR orange] " + count + "[/COLOR] - [COLOR orange]Total:[/COLOR][COLOR orange] " + total + "[/B][/COLOR]" Common.addDir( "[B][COLOR orange]3rd - " + developer + "[/COLOR][/B]" + bname, url, 93, iconimage, fanart, description) rank = rank + 1 Common.addItem( "[COLOR white]-----------------------------------------------[/COLOR]", url, 17, ICON, FANART, description) else: bname = " | [COLOR white] This Week:[/COLOR][COLOR yellowgreen][B] " + count + "[/B][/COLOR] - [COLOR white]Total:[/COLOR][COLOR yellowgreen][B] " + total + "[/B][/COLOR]" Common.addDir("[COLOR white]" + developer + "[/COLOR]" + bname, url, 93, iconimage, fanart, description) Common.addItem( '[B][COLOR yellowgreen]HOW TO ADD YOUR BUILDS TO THE LIST[/COLOR][/B]', BASEURL, 17, COMMUNITY_ICON, FANART, '')
def Restore_RD_TRAKT(): link = Common.OPEN_URL(BASEURL + base64.b64decode(b'b3RoZXIvcmRfdHJha3QueG1s')) plugins = re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA, match)) ADDONSETTINGS = xbmc.translatePath( os.path.join(ADDONPATH, 'settings.xml')) EXCLUDEMOVE = xbmc.translatePath( os.path.join(EXCLUDES_FOLDER, match + '_settings.xml')) if os.path.exists(EXCLUDEMOVE): if not os.path.exists(ADDONPATH): os.makedirs(ADDONPATH) if os.path.isfile(ADDONSETTINGS): os.remove(ADDONSETTINGS) os.rename(EXCLUDEMOVE, ADDONSETTINGS) try: os.remove(EXCLUDEMOVE) except: pass try: shutil.rmtree(EXCLUDEMOVE) shutil.rmdir(EXCLUDEMOVE) except: pass 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() # service_url = BASEURL + base64.b64decode(b'b3RoZXIvcmRfdHJha3QueG1s') # f = urllib2.urlopen(service_url) # data = f.read() # f.close() # # patron = "<items>(.*?)</items>" # addons = re.findall(patron,data,re.DOTALL) # # items = [] # for addon in addons: # item = {} # item["plugin"] = Common.find_single_match(addon,"<plugin>([^<]+)</plugin>") # # if item["plugin"]!="": # items.append(item) # # ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA,item["plugin"])) # ADDONSETTINGS = xbmc.translatePath(os.path.join(ADDONPATH,'settings.xml')) # EXCLUDEMOVE = xbmc.translatePath(os.path.join(EXCLUDES_FOLDER,item["plugin"]+'_settings.xml')) # if os.path.exists(EXCLUDEMOVE): # if not os.path.exists(ADDONPATH): # os.makedirs(ADDONPATH) # if os.path.isfile(ADDONSETTINGS): # os.remove(ADDONSETTINGS) # os.rename(EXCLUDEMOVE, ADDONSETTINGS) # try: # os.remove(EXCLUDEMOVE) # except: pass # # try: # shutil.rmtree(EXCLUDEMOVE) # shutil.rmdir(EXCLUDEMOVE) # except: pass
def check(): try: dp = xbmcgui.DialogProgress() dialog = xbmcgui.Dialog() AddonTitle = "[COLOR yellowgreen]ECHO[/COLOR] [COLOR white]Wizard[/COLOR]" dp.create( AddonTitle, "[COLOR yellowgreen]Running the ECHO Security check....[/COLOR]") dp.update(0) xbmc_version = xbmc.getInfoLabel("System.BuildVersion") version = float(xbmc_version[:4]) remove_from_db = 0 if version >= 17.0 and version <= 17.9: remove_from_db = 1 Enabled = 0 import sqlite3 db_check = 50 got_db = 0 while got_db == 0: DB_File = xbmc.translatePath( os.path.join('special://home/userdata/', 'Database/Addons' + str(db_check) + '.db')) if os.path.exists(DB_File): got_db = 1 else: db_check = db_check - 1 a = 0 b = 0 namelist = [] idlist = [] deslist = [] combinedlists = [] link = Common.OPEN_URL( base64.b64decode( b'aHR0cDovL2VjaG9jb2Rlci5jb20vc2VjdXJpdHkvY2hlY2sueG1s')) link = link.replace('\n', '').replace('\r', '') match = re.compile('<item>(.+?)</item>').findall(link) number = len(match) number2 = number * 2 for item in match: if b == 0: b = number a = a + 1 name = re.compile('<name>(.+?)</name>').findall(item)[0] id = re.compile('<id>(.+?)</id>').findall(item)[0] description = re.compile( '<description>(.+?)</description>').findall(item)[0] progress = 100 * a / int(number2) dp.update( progress, "", "[COLOR dodgerblue]Adding data for " + str(name) + "[/COLOR]", "[COLOR lime]" + str(b) + " entries left to scan.[/COLOR]") b = b - 1 namelist.append(name) idlist.append(id) deslist.append(description) combinedlists = list(zip(namelist, idlist, deslist)) the_list = sorted(combinedlists) i = 0 j = 0 b = 0 k = 0 addons_path = xbmc.translatePath('special://home/addons/') for get_name, get_id, get_desc in the_list: if b == 0: b = number a = a + 1 progress = 100 * a / int(number2) dp.update( progress, "", "[COLOR dodgerblue]Scanning for " + str(get_name) + "[/COLOR]", "[COLOR lime]" + str(b) + " entries left to scan.[/COLOR]") b = b - 1 for root, dirs, files in os.walk(addons_path): for d in dirs: k = k + 1 if get_id in d: i = i + 1 choice = dialog.yesno( "[COLOR red][B]FOUND: " + get_name.upper() + '[/B][/COLOR]', '[COLOR white]We have found [COLOR red][B]' + get_name.upper() + '[/B][/COLOR] on your system. This addon has been flagged because: [COLOR red][B]' + get_desc.upper() + '[/B][/COLOR][/COLOR]', '[COLOR blue][B]Would you like to remove this from your system?[/B][/COLOR]', yeslabel='[B][COLOR lime]YES[/COLOR][/B]', nolabel='[B][COLOR red]NO[/COLOR][/B]') if choice == 1: try: shutil.rmtree(os.path.join(root, d)) j = j + 1 if remove_from_db == 1: try: DB_Path = DB_File conn = sqlite3.connect(DB_Path) cursor = conn.cursor() q = """ UPDATE installed SET enabled= ? WHERE addonID = ? """ cursor.execute( q, (str(Enabled), str(get_id))) conn.commit() except: pass except: pass if remove_from_db == 1: xbmc.executebuiltin("UpdateLocalAddons") xbmc.executebuiltin("UpdateAddonRepos") dp.close() dialog.ok( AddonTitle, "[COLOR dodgerblue]We have finished scanning your system.[/COLOR]", "[COLOR white]We found [B][COLOR yellowgreen]" + str(i) + " [/B][/COLOR]threats.[/COLOR][COLOR white] We removed [COLOR yellowgreen][B]" + str(j) + "[/B][/COLOR] threats.[/COLOR]", "[COLOR white]Scanned folders [B][COLOR yellowgreen]" + str(k) + " [/B][/COLOR].[/COLOR][COLOR white] Checked for [COLOR yellowgreen][B]" + str(number) + "[/B][/COLOR] threats.[/COLOR]") except: dialog.ok( AddonTitle, "[COLOR yellowgreen]Sorry, there was an error running the security check at the moment. Please try again later.[/COLOR]" ) quit()
def INSTALL(name, url, description): urla = url desca = description notice2, description, fresh, youtube, skin_used, build_notice = desca.split( ',') name, url = urla.split(',') wipeme = 0 xxl = 0 skipskin = 0 skin_swapped = 0 skin = xbmc.getSkinDir() KODIV = float(xbmc.getInfoLabel("System.BuildVersion")[:4]) skinswapped = 0 SKIP_FAVS = 0 if "lose your favourites" in notice2.lower(): SKIP_FAVS = 1 if not "skin." in skin_used: skin_used = "NULL" if fresh == "1": wipeme = 1 else: wipeme = 0 skipskin = 1 #SWITCH THE SKIN IF THE CURRENT SKIN IS NOT CONFLUENCE if skin not in ['skin.confluence', 'skin.estuary'] and skipskin == 0: skin = 'skin.estuary' if KODIV >= 17 else 'skin.confluence' skinSwitch.swapSkins(skin) skinswapped = 1 time.sleep(2) #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']: if skin_swapped == 1: choice = xbmcgui.Dialog().yesno( AddonTitle, '[COLOR lightskyblue][B]ERROR: AUTOSWITCH WAS NOT SUCCESSFUL[/B][/COLOR]', '[COLOR lightskyblue][B]CLICK YES TO MANUALLY SWITCH TO CONFLUENCE NOW[/B][/COLOR]', '[COLOR lightskyblue][B]YOU CAN PRESS NO AND ATTEMPT THE AUTO SWITCH AGAIN IF YOU WISH[/B][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]') if choice == 1: xbmc.executebuiltin("ActivateWindow(appearancesettings)") return else: sys.exit(1) if wipeme == 1: found_trakt = 0 link = Common.OPEN_URL(BASEURL + base64.b64decode(b'b3RoZXIvcmRfdHJha3QueG1s')) plugins = re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA, match)) ADDONSETTINGS = xbmc.translatePath( os.path.join(ADDONPATH, 'settings.xml')) EXCLUDEMOVE = xbmc.translatePath( os.path.join(EXCLUDES_FOLDER, match + '_settings.xml')) if os.path.isfile(ADDONSETTINGS): found_trakt = 1 if SKIP_FAVS == 1: keep_kodi_favs = 0 keep_trakt_rd = 0 if found_trakt == 1: found_a = 0 dialog = xbmcgui.Dialog() choice = dialog.select( '[COLOR lightskyblue][B]TRAKT AND RD SETTINGS DETECTED[/B][/COLOR]', [ '[COLOR yellowgreen][B]Yes, Keep Trakt & Real Debrid Settings[/B][/COLOR]', '[COLOR lightskyblue][B]No, Remove My Settings[/B][/COLOR]' ]) if choice == 0: keep_trakt_rd = 1 found_a = 1 if choice == 1: keep_trakt_rd = 0 found_a = 1 if found_a == 0: sys.exit(1) else: found_favourites = 0 if os.path.isfile(FAVS): found_favourites = 1 keep_kodi_favs = 0 keep_trakt_rd = 0 if found_favourites == 1 and found_trakt == 1: found_c = 0 dialog = xbmcgui.Dialog() choice = dialog.select( '[COLOR lightskyblue][B]TRAKT, RD & FAVOURITES DETECTED[/B][/COLOR]', [ '[COLOR lightskyblue][B]KEEP BOTH RD, TRAKT & FAVOURITES[/B][/COLOR]', '[COLOR yellowgreen][B]Only Keep Trakt & Real Debrid Settings[/B][/COLOR]', '[COLOR yellowgreen][B]Only Keep Kodi Favourites[/B][/COLOR]', '[COLOR lightskyblue][B]Remove All Settings & Favourites[/B][/COLOR]' ]) if choice == 0: keep_trakt_rd = 1 keep_kodi_favs = 1 found_c = 1 if choice == 1: keep_trakt_rd = 1 keep_kodi_favs = 0 found_c = 1 if choice == 2: keep_trakt_rd = 0 keep_kodi_favs = 1 found_c = 1 if choice == 3: keep_trakt_rd = 0 keep_kodi_favs = 0 found_c = 1 if found_c == 0: sys.exit(1) if found_favourites == 1 and found_trakt == 0: found_b = 0 dialog = xbmcgui.Dialog() choice = dialog.select( '[COLOR lightskyblue][B]KODI FAVOURITES DETECTED[/B][/COLOR]', [ '[COLOR yellowgreen][B]Yes, Keep Favourites[/B][/COLOR]', '[COLOR lightskyblue][B]No Use The Builds Favourites[/B][/COLOR]' ]) if choice == 0: found_b = 1 keep_kodi_favs = 1 if choice == 1: found_b = 1 keep_kodi_favs = 0 if found_b == 0: sys.exit(1) if found_favourites == 0 and found_trakt == 1: found_a = 0 dialog = xbmcgui.Dialog() choice = dialog.select( '[COLOR lightskyblue][B]TRAKT AND RD SETTINGS DETECTED[/B][/COLOR]', [ '[COLOR yellowgreen][B]Yes, Keep Trakt & Real Debrid Settings[/B][/COLOR]', '[COLOR lightskyblue][B]No, Remove My Settings[/B][/COLOR]' ]) if choice == 0: keep_trakt_rd = 1 found_a = 1 if choice == 1: keep_trakt_rd = 0 found_a = 1 if found_a == 0: sys.exit(1) if keep_trakt_rd == 1: backuprestore.AUTO_BACKUP_RD_TRAKT() wipe.WIPERESTORE(keep_kodi_favs) 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, "Please wait while we get everything ready to", "download the " + buildname + " build.", "[B]Build: [/B]" + buildname) buildname = "build" lib = os.path.join(path, buildname + '.zip') try: os.remove(lib) except: pass if description.lower() != "null": hash = "null" while hash.lower() != description.lower(): dialog = xbmcgui.Dialog() downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join( 'special://', 'home')) dp.update(0, "", "Checking Zip File Integrity", "Please Wait..") hash = hashlib.md5(open(lib, 'rb').read()).hexdigest() if hash.lower() != description.lower(): choice = xbmcgui.Dialog().yesno( AddonTitle, 'Error: Unfortunatly the ZIP file hash does not match.', 'The file has therefore been flagged as corrupt.', 'Would you like to download the file again?', nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]', yeslabel='[B][COLOR yellowgreen]YES[/COLOR][/B]') if choice == 0: try: os.remove(lib) except: pass sys.exit(1) else: try: os.remove(lib) except: pass else: dialog = xbmcgui.Dialog() downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join('special://', 'home')) dp.update(0, "Extracting Zip Please Wait", " ", " ") unzip(lib, addonfolder, dp) try: os.remove(lib) except: pass send_to_count = name + "|SPLIT|ECHO" add_download = Common.add_one(send_to_count) 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 MARKER_TRAKT = xbmc.translatePath(os.path.join(TMP_TRAKT, 'marker.xml')) if os.path.isfile(MARKER_TRAKT): backup_zip = xbmc.translatePath( os.path.join(TMP_TRAKT, 'Restore_RD_Trakt_Settings.zip')) backuprestore.AUTO_READ_ZIP_TRAKT(backup_zip) _out = xbmc.translatePath(os.path.join('special://', 'home/tmp_trakt')) try: os.remove(MARKER_TRAKT) shutil.rmtree(_out) shutil.rmdir(_out) except: pass skin_swapped = 0 skin = xbmc.getSkinDir() if "skin." in skin_used: #SWITCH THE SKIN IF THE CURRENT SKIN IS NOT CONFLUENCE if skin not in [skin_used]: skin_swapped = 1 xbmc.executebuiltin("UpdateAddonRepos") xbmc.executebuiltin("UpdateLocalAddons") xbmc.executebuiltin("RefreshRSS") skin = skin_used if KODIV >= 17 else skin_used skinSwitch.swapSkins(skin) 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 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 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. while xbmc.getCondVisibility("Window.isVisible(yesnodialog)"): xbmc.executebuiltin("Action(Left)") xbmc.executebuiltin("Action(Select)") time.sleep(1) skin = xbmc.getSkinDir() if skin != skin_used: if skin_swapped == 1: choice = xbmcgui.Dialog().yesno( AddonTitle, '[COLOR lightskyblue][B]ERROR: AUTOSWITCH WAS NOT SUCCESSFUL[/B][/COLOR]', '[COLOR lightskyblue][B]CLICK YES TO MANUALLY SWITCH NOW[/B][/COLOR]', '', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]') if choice == 1: xbmc.executebuiltin("ActivateWindow(appearancesettings)") return else: sys.exit(1) if skin_swapped == 1: dialog.ok( AddonTitle, '[B][COLOR smokewhite]Your build has been installed.[/COLOR][/B]', '[B][COLOR orangered]YOU DO NOT NEED TO CLOSE KODI[/COLOR][/B].', '[COLOR white]Please press OK to enjoy your build![/COLOR]') xbmc.executebuiltin("ActivateWindow(Home)") sys.exit(1) else: dialog.ok( AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi" ) Common.killxbmc()
def INSTALL_COMMUNITY(name, url, description): urla = url name, url, skin_used, developer = urla.split(',') skin = xbmc.getSkinDir() KODIV = float(xbmc.getInfoLabel("System.BuildVersion")[:4]) skinswapped = 0 raw_name = name.split('-')[0] if not "skin." in skin_used: skin_used = "NULL" #SWITCH THE SKIN IF THE CURRENT SKIN IS NOT CONFLUENCE if skin not in ['skin.confluence', 'skin.estuary']: choice = xbmcgui.Dialog().yesno( AddonTitle, '[COLOR lightskyblue][B]We can see that you are not using the default confluence skin.[/B][/COLOR]', '[COLOR lightskyblue][B]CLICK YES TO ATTEMPT TO AUTO SWITCH TO CONFLUENCE[/B][/COLOR]', '[COLOR lightskyblue][B]PLEASE DO NOT DO PRESS ANY BUTTONS OR MOVE THE MOUSE WHILE THIS PROCESS IS TAKING PLACE, IT IS AUTOMATIC[/B][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR lightskyblue]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']: if skinswapped == 1: choice = xbmcgui.Dialog().yesno( AddonTitle, '[COLOR lightskyblue][B]ERROR: AUTOSWITCH WAS NOT SUCCESFULL[/B][/COLOR]', '[COLOR lightskyblue][B]CLICK YES TO MANUALLY SWITCH TO CONFLUENCE NOW[/B][/COLOR]', '[COLOR lightskyblue][B]YOU CAN PRESS NO AND ATTEMPT THE AUTO SWITCH AGAIN IF YOU WISH[/B][/COLOR]', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]') if choice == 1: xbmc.executebuiltin("ActivateWindow(appearancesettings)") return else: sys.exit(1) found_trakt = 0 link = Common.OPEN_URL(BASEURL + base64.b64decode(b'b3RoZXIvcmRfdHJha3QueG1s')) plugins = re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA, match)) ADDONSETTINGS = xbmc.translatePath( os.path.join(ADDONPATH, 'settings.xml')) EXCLUDEMOVE = xbmc.translatePath( os.path.join(EXCLUDES_FOLDER, match + '_settings.xml')) if os.path.isfile(ADDONSETTINGS): found_trakt = 1 found_favourites = 0 if os.path.isfile(FAVS): found_favourites = 1 keep_kodi_favs = 0 keep_trakt_rd = 0 if found_favourites == 1 and found_trakt == 1: found_c = 0 dialog = xbmcgui.Dialog() choice = dialog.select( '[COLOR lightskyblue][B]TRAKT, RD & FAVOURITES DETECTED[/B][/COLOR]', [ '[COLOR lightskyblue][B]KEEP BOTH RD, TRAKT & FAVOURITES[/B][/COLOR]', '[COLOR yellowgreen][B]Only Keep Trakt & Real Debrid Settings[/B][/COLOR]', '[COLOR yellowgreen][B]Only Keep Kodi Favourites[/B][/COLOR]', '[COLOR lightskyblue][B]Remove All Settings & Favourites[/B][/COLOR]' ]) if choice == 0: keep_trakt_rd = 1 keep_kodi_favs = 1 found_c = 1 if choice == 1: keep_trakt_rd = 1 keep_kodi_favs = 0 found_c = 1 if choice == 2: keep_trakt_rd = 0 keep_kodi_favs = 1 found_c = 1 if choice == 3: keep_trakt_rd = 0 keep_kodi_favs = 0 found_c = 1 if found_c == 0: sys.exit(1) if found_favourites == 1 and found_trakt == 0: found_b = 0 dialog = xbmcgui.Dialog() choice = dialog.select( '[COLOR lightskyblue][B]KODI FAVOURITES DETECTED[/B][/COLOR]', [ '[COLOR yellowgreen][B]Yes, Keep Favourites[/B][/COLOR]', '[COLOR lightskyblue][B]No Use The Builds Favourites[/B][/COLOR]' ]) if choice == 0: found_b = 1 keep_kodi_favs = 1 if choice == 1: found_b = 1 keep_kodi_favs = 0 if found_b == 0: sys.exit(1) if found_favourites == 0 and found_trakt == 1: found_a = 0 dialog = xbmcgui.Dialog() choice = dialog.select( '[COLOR lightskyblue][B]TRAKT AND RD SETTINGS DETECTED[/B][/COLOR]', [ '[COLOR yellowgreen][B]Yes, Keep Trakt & Real Debrid Settings[/B][/COLOR]', '[COLOR lightskyblue][B]No, Remove My Settings[/B][/COLOR]' ]) if choice == 0: keep_trakt_rd = 1 found_a = 1 if choice == 1: keep_trakt_rd = 0 found_a = 1 if found_a == 0: sys.exit(1) if keep_trakt_rd == 1: backuprestore.AUTO_BACKUP_RD_TRAKT() wipe.WIPERESTORE(keep_kodi_favs) path = xbmc.translatePath(os.path.join('special://home/addons', 'packages')) if not os.path.exists(path): os.makedirs(path) buildname = name raw_name_string = str(raw_name) raw_name = raw_name_string.replace('[B]', '').replace('[/B]', '') dp = xbmcgui.DialogProgress() dp.create(AddonTitle, "Please wait while we get everything ready to", "download the " + raw_name + " build.", " ") buildname = "build" lib = os.path.join(path, buildname + '.zip') try: os.remove(lib) except: pass dialog = xbmcgui.Dialog() dp.update(0, "", "", "[B]Build: [/B]" + raw_name) downloader.download(url, lib, dp) addonfolder = xbmc.translatePath(os.path.join('special://', 'home')) dp.update(0, "", "Extracting Zip File", "") unzip(lib, addonfolder, dp) time.sleep(1) send_to_count = name + "|SPLIT|" + developer add_download = Common.add_one(send_to_count) 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 MARKER_TRAKT = xbmc.translatePath(os.path.join(TMP_TRAKT, 'marker.xml')) if os.path.isfile(MARKER_TRAKT): backup_zip = xbmc.translatePath( os.path.join(TMP_TRAKT, 'Restore_RD_Trakt_Settings.zip')) backuprestore.AUTO_READ_ZIP_TRAKT(backup_zip) _out = xbmc.translatePath(os.path.join('special://', 'home/tmp_trakt')) try: os.remove(MARKER_TRAKT) shutil.rmtree(_out) shutil.rmdir(_out) except: pass skin_swapped = 0 skin = xbmc.getSkinDir() if "skin." in skin_used: #SWITCH THE SKIN IF THE CURRENT SKIN IS NOT CONFLUENCE if skin not in [skin_used]: skin_swapped = 1 xbmc.executebuiltin("UpdateAddonRepos") xbmc.executebuiltin("UpdateLocalAddons") xbmc.executebuiltin("RefreshRSS") skin = skin_used if KODIV >= 17 else skin_used skinSwitch.swapSkins(skin) 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 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 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. while xbmc.getCondVisibility("Window.isVisible(yesnodialog)"): xbmc.executebuiltin("Action(Left)") xbmc.executebuiltin("Action(Select)") time.sleep(1) skin = xbmc.getSkinDir() if skin != skin_used: if skin_swapped == 1: choice = xbmcgui.Dialog().yesno( AddonTitle, '[COLOR lightskyblue][B]ERROR: AUTOSWITCH WAS NOT SUCCESFULL[/B][/COLOR]', '[COLOR lightskyblue][B]CLICK YES TO MANUALLY SWITCH NOW[/B][/COLOR]', '', yeslabel='[B][COLOR green]YES[/COLOR][/B]', nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]') if choice == 1: xbmc.executebuiltin("ActivateWindow(appearancesettings)") return else: sys.exit(1) if skin_swapped == 1: open(COMMUNITY_BUILD, 'w') dialog.ok( AddonTitle, '[B][COLOR smokewhite]Your build has been installed.[/COLOR][/B]', '[B][COLOR orangered]YOU DO NOT NEED TO CLOSE KODI[/COLOR][/B].', '[COLOR white]Please press OK to enjoy your build![/COLOR]') xbmc.executebuiltin("ActivateWindow(Home)") sys.exit(1) else: open(COMMUNITY_BUILD, 'w') dialog.ok( AddonTitle, "To save changes you now need to force close Kodi, Press OK to force close Kodi" ) Common.killxbmc()