예제 #1
0
def startup_freshstart():
    yes_pressed = kodi.yesnoDialog(AddonTitle,
                                   "Please confirm that you wish to factory restore your configuration.",
                                   "                This will result in the loss of all your current data!")
    if yes_pressed:
        addonPath = xbmc.translatePath(os.path.join('special://home'))
        enableBG16 = "UseCustomBackground,false"
        enableBG17 = "use_custom_bg,false"
        xEB('Skin.SetBool(%s)' % enableBG16)
        xEB('Skin.SetBool(%s)' % enableBG17)
        try:
            winString = xbmc.translatePath(os.path.join('special://xbmc/')).split('\\')[-2]
            winString = winString.split('_')
            winString = winString[0] + '_' + winString[-1]
            kodi.log(winString)
            winPath = addonPath.replace('\Roaming\Kodi', '\Local\Packages\%s\LocalCache\Roaming\Kodi') % winString
            if winPath: addonPath = winPath
        except:
            pass
        #  Directories and sub directories not to remove but to sort through
        dir_exclude = ('addons', 'packages', 'userdata', 'Database')
        #  Directories and sub directories Directories to ignore and leave intact
        sub_dir_exclude = ('metadata.album.universal', 'metadata.artists.universal',
                           'service.xbmc.versioncheck', 'metadata.common.musicbrainz.org',
                           'metadata.common.imdb.com')
        keep_indigo = kodi.yesnoDialog(AddonTitle,
                                       "Do you wish to keep Computertechs Installer installed for convenience after the factory restore?",
                                       " ")
        if keep_indigo:
            sub_dir_exclude = sub_dir_exclude + ('plugin.video.nukewizard',)
        # Files to ignore and not to be removed
        file_exclude = ('Addons26.db', 'kodi.log', 'Textures13.db', 'commoncache.db, Addons27.db')
        try:
            for (root, dirs, files) in os.walk(addonPath, topdown=True):
                dirs[:] = [dir for dir in dirs if dir not in sub_dir_exclude]
                files[:] = [file for file in files if file not in file_exclude]
                for folder in dirs:
                    try:
                        if folder not in dir_exclude: shutil.rmtree(os.path.join(root, folder))
                    except:
                        pass
                for file_name in files:
                    try:
                        os.remove(os.path.join(root, file_name))
                    except:
                        pass
            kodi.message(AddonTitle, "Done! , You are now back to a fresh Kodi configuration!",
                         "Click OK to exit Kodi and then restart to complete .")
            xbmc.executebuiltin('ShutDown')
        except Exception as e:
            kodi.log("Freshstart User files partially removed - " + str(e))
            kodi.message(AddonTitle, 'Done! , Freshstart User files partially removed',
                         'Please check the log')
예제 #2
0
def startup_freshstart():
    if kodi.yesnoDialog("Please confirm that you wish to factory restore your configuration.",
                        "                This will result in the loss of all your current data!",
                        ' ', AddonTitle, nolabel='No', yeslabel='Yes'):
        home_path = xbmc.translatePath(os.path.join('special://home'))
        enableBG16 = "UseCustomBackground,false"
        enableBG17 = "use_custom_bg,false"
        xEB('Skin.SetBool(%s)' % enableBG16)
        xEB('Skin.SetBool(%s)' % enableBG17)
        try:
            win_string = xbmc.translatePath(os.path.join('special://xbmc/')).split('\\')[-2]
            win_string = win_string.split('_')
            win_string = win_string[0] + '_' + win_string[-1]
            kodi.log(win_string)
            win_path = home_path.replace('\Roaming\Kodi', '\Local\Packages\%s\LocalCache\Roaming\Kodi' % win_string)
            if win_path:
                home_path = win_path
        except:
            pass
        #  Directories and sub directories not to remove but to sort through
        dir_exclude = ('addons', 'packages', 'userdata', 'Database')
        #  Directories and sub directories Directories to ignore and leave intact
        sub_dir_exclude = ['metadata.album.universal', 'metadata.artists.universal', 'service.xbmc.versioncheck',
                           'metadata.common.musicbrainz.org', 'metadata.common.imdb.com']
        if kodi.yesnoDialog(AddonTitle, "Do you wish to keep %s installed for convenience after the factory restore?"
                            % AddonTitle, '', nolabel='No', yeslabel='Yes'):
            sub_dir_exclude.extend([AddonID])
        # Files to ignore and not to be removed
        file_exclude = ('kodi.log')  # , 'Textures13.db', 'commoncache.db', 'Addons26.db', 'Addons27.db')
        # db_vers = max(re.findall('Addons\d+.db', str(os.listdir(xbmc.translatePath('special://database')))))
        # file_exclude += db_vers
        try:
            for (root, dirs, files) in os.walk(home_path, topdown=True):
                dirs[:] = [dir for dir in dirs if dir not in sub_dir_exclude]
                files[:] = [file for file in files if file not in file_exclude]
                for folder in dirs:
                    try:
                        if folder not in dir_exclude:
                            shutil.rmtree(os.path.join(root, folder))
                    except:
                        pass
                for file_name in files:
                    try:
                        os.remove(os.path.join(root, file_name))
                    except:
                        pass
            kodi.message(AddonTitle, "Done! , You are now back to a fresh Kodi configuration!",
                         "Click OK to exit Kodi and then restart to complete .")
            xbmc.executebuiltin('ShutDown')
        except Exception as e:
            kodi.log("Freshstart User files partially removed - " + str(e))
            kodi.message(AddonTitle, 'Done! , Freshstart User files partially removed',
                         'Please check the log')
예제 #3
0
def startup_rejuv():
	yes_pressed=kodi.yesnoDialog(AddonTitle,"Please confirm that you wish you wipe clean your current configuration and reconfigure Kodi with the latest Computertechs Installer update!","                This will result in the loss of all your current data!")
	if yes_pressed:
		addonPath=xbmcaddon.Addon(id=AddonID).getAddonInfo('path')
		addonPath=xbmc.translatePath(addonPath)
		xbmcPath=os.path.join(addonPath,"..","..")
		xbmcPath=os.path.abspath(xbmcPath);
		#  Directories and sub directories not to remove but to sort through
		dir_exclude = ('addons', 'packages', 'userdata', 'Database')
		#  Directories and sub directories Directories to ignore and leave intact
		sub_dir_exclude = ('metadata.album.universal', 'metadata.artists.universal',
						 'service.xbmc.versioncheck','metadata.common.musicbrainz.org',
						 'metadata.common.imdb.com', 'plugin.video.nukewizard')
		#  Files to ignore and not to be removed
		file_exclude = ('Addons26.db', 'kodi.log', 'Textures13.db, Addons27.db')
		try:
			for (root, dirs, files) in os.walk(xbmcPath, topdown=True):
				dirs[:] = [dir for dir in dirs if dir not in sub_dir_exclude]
				files[:] = [file for file in files if file not in file_exclude]
				for folder in dirs:
					if folder not in dir_exclude: shutil.rmtree(os.path.join(root, folder))
				for file_name in files: os.remove(os.path.join(root, file_name))
		except Exception as e:
			kodi.log("Rejuv.startup_rejuv User files partially removed - " + str(e))

		rejuv_run.JUVWIZARD()
예제 #4
0
def startup_rejuv():
    yes_pressed = kodi.yesnoDialog(AddonTitle, "Please confirm that you wish you wipe clean your current configuration"
                                               "and reconfigure Kodi with the latest Config Wizard update!",
                                   "                This will result in the loss of all your current data!")
    if yes_pressed:
        addonPath = AddonID.getAddonInfo('path')
        addonPath = xbmc.translatePath(addonPath)
        xbmcPath = os.path.join(addonPath, "..", "..")
        xbmcPath = os.path.abspath(xbmcPath)
        # Directories and sub directories not to remove but to sort through
        dir_exclude = ('addons', 'packages', 'userdata', 'Database')
        #  Directories and sub directories Directories to ignore and leave intact
        sub_dir_exclude = ['metadata.album.universal', 'metadata.artists.universal', 'service.xbmc.versioncheck',
                           'metadata.common.musicbrainz.org', 'metadata.common.imdb.com', AddonID]
        #  Files to ignore and not to be removed
        file_exclude = ('Addons26.db', 'kodi.log', 'Textures13.db, Addons27.db')
        try:
            for (root, dirs, files) in os.walk(xbmcPath, topdown=True):
                dirs[:] = [dir for dir in dirs if dir not in sub_dir_exclude]
                files[:] = [file for file in files if file not in file_exclude]
                for folder in dirs:
                    if folder not in dir_exclude:
                        shutil.rmtree(os.path.join(root, folder))
                for file_name in files:
                    os.remove(os.path.join(root, file_name))
        except Exception as e:
            kodi.log("Rejuv.startup_rejuv User files partially removed - " + str(e))

        rejuv_run.JUVWIZARD()
예제 #5
0
def startup_rejuv():
    if kodi.yesnoDialog(
            "Please confirm that you wish you wipe clean your current configuration"
            "and reconfigure Kodi with the latest Config Wizard update!",
            "        This will result in the loss of all your current data!",
            '', AddonTitle):
        addonPath = kodi.addon.getAddonInfo('path')
        addonPath = xbmc.translatePath(addonPath)
        xbmcPath = os.path.join(addonPath, "..", "..")
        xbmcPath = os.path.abspath(xbmcPath)
        # Directories and sub directories not to remove but to sort through
        dir_exclude = ('addons', 'packages', 'userdata', 'Database', 'temp')
        #  Directories and sub directories Directories to ignore and leave intact
        sub_dir_exclude = [
            'metadata.album.universal', 'metadata.artists.universal',
            'service.xbmc.versioncheck', 'metadata.common.musicbrainz.org',
            'metadata.common.imdb.com', AddonID
        ]
        # if kodi.yesnoDialog(AddonTitle, "Do you wish to keep %s installed for convenience after the factory restore?"
        #                     % AddonTitle, '', nolabel='No', yeslabel='Yes'):
        #     sub_dir_exclude.extend([AddonID])
        #  Files to ignore and not to be removed
        file_exclude = ('kodi.log'
                        )  # , 'Textures13.db','Addons26.db',  'Addons27.db')
        db_vers = max(
            re.findall(
                'Addons\d+.db',
                str(os.listdir(xbmc.translatePath('special://database')))))
        file_exclude += db_vers
        try:
            for (root, dirs, files) in os.walk(xbmcPath, topdown=True):
                dirs[:] = [dir for dir in dirs if dir not in sub_dir_exclude]
                files[:] = [file for file in files if file not in file_exclude]
                for folder in dirs:
                    if folder not in dir_exclude:
                        try:
                            shutil.rmtree(os.path.join(root, folder))
                        except:
                            pass
                for file_name in files:
                    try:
                        os.remove(os.path.join(root, file_name))
                    except:
                        pass
        except Exception as e:
            kodi.log("Rejuv.startup_rejuv User files partially removed - " +
                     str(e))

        rejuv_run.JUVWIZARD()
예제 #6
0
def startup_rejuv():
    if kodi.yesnoDialog("Please confirm that you wish you wipe clean your current configuration"
                        "and reconfigure Kodi with the latest Config Wizard update!",
                        "        This will result in the loss of all your current data!", '',AddonTitle):
        addonPath = kodi.addon.getAddonInfo('path')
        addonPath = xbmc.translatePath(addonPath)
        xbmcPath = os.path.join(addonPath, "..", "..")
        xbmcPath = os.path.abspath(xbmcPath)
        # Directories and sub directories not to remove but to sort through
        dir_exclude = ('addons', 'packages', 'userdata', 'Database', 'temp')
        #  Directories and sub directories Directories to ignore and leave intact
        sub_dir_exclude = ['metadata.album.universal', 'metadata.artists.universal', 'service.xbmc.versioncheck',
                           'metadata.common.musicbrainz.org', 'metadata.common.imdb.com', AddonID]
        # if kodi.yesnoDialog(AddonTitle, "Do you wish to keep %s installed for convenience after the factory restore?"
        #                     % AddonTitle, '', nolabel='No', yeslabel='Yes'):
        #     sub_dir_exclude.extend([AddonID])
        #  Files to ignore and not to be removed
        file_exclude = ('kodi.log')  # , 'Textures13.db','Addons26.db',  'Addons27.db')
        db_vers = max(re.findall('Addons\d+.db', str(os.listdir(xbmc.translatePath('special://database')))))
        file_exclude += db_vers
        try:
            for (root, dirs, files) in os.walk(xbmcPath, topdown=True):
                dirs[:] = [dir for dir in dirs if dir not in sub_dir_exclude]
                files[:] = [file for file in files if file not in file_exclude]
                for folder in dirs:
                    if folder not in dir_exclude:
                        try:
                            shutil.rmtree(os.path.join(root, folder))
                        except:
                            pass
                for file_name in files:
                    try:
                        os.remove(os.path.join(root, file_name))
                    except:
                        pass
        except Exception as e:
            kodi.log("Rejuv.startup_rejuv User files partially removed - " + str(e))

        rejuv_run.JUVWIZARD()