Exemplo n.º 1
0
	def clean_user_config(self):
		''' Comment out problematic lines in the users config.txt '''

		patterns = [

			r".*=.*\[remove\].*", 
			r".*=remove",
		]

		config = parser.read_config_file(self.location)

		new_config = parser.clean_config(config, patterns)

		# write the new lines to the temporary config file
		parser.write_config_file('/var/tmp/config.txt', new_config)

		# copy over the temp config.txt to /boot/ as superuser
		subprocess.call(["sudo", "mv",  '/var/tmp/config.txt', self.config_location])
Exemplo n.º 2
0
    def clean_user_config(self):
        ''' Comment out problematic lines in the users config.txt '''

        patterns = [
            r".*=.*\[remove\].*",
            r".*=remove",
        ]

        config = parser.read_config_file(self.config_location)

        new_config = parser.clean_config(config, patterns)

        # write the new lines to the temporary config file
        parser.write_config_file('/var/tmp/config.txt', new_config)

        # copy over the temp config.txt to /boot/ as superuser
        subprocess.call(
            ["sudo", "mv", '/var/tmp/config.txt', self.config_location])
Exemplo n.º 3
0
    def run(self):
        '''
			The method determines what happens when the item is clicked in the settings GUI.
			Usually this would be __addon__.OpenSettings(), but it could be any other script.
			This allows the creation of action buttons in the GUI, as well as allowing developers to script and skin their 
			own user interfaces.
		'''

        # read the config.txt file everytime the settings are opened. This is unavoidable because it is possible for
        # the user to have made manual changes to the config.txt while OSG is active.
        config = parser.read_config_file(self.config_location)

        extracted_settings = parser.config_to_kodi(parser.MASTER_SETTINGS,
                                                   config)

        # load the settings into kodi
        log('Settings extracted from the config.txt')
        for k, v in extracted_settings.iteritems():

            log("%s : %s" % (k, v))
            self.me.setSetting(k, str(v))

        # open the settings GUI and let the user monkey about with the controls
        self.me.openSettings()

        # retrieve the new settings from kodi
        new_settings = self.settings_retriever_xml()

        log('New settings applied to the config.txt')
        for k, v in new_settings.iteritems():
            log("%s : %s" % (k, v))

        # read the config into a list of lines again
        config = parser.read_config_file(self.config_location)

        # construct the new set of config lines using the protocols and the new settings
        new_settings = parser.kodi_to_config(parser.MASTER_SETTINGS, config,
                                             new_settings)

        # write the new lines to the temporary config file
        parser.write_config_file('/var/tmp/config.txt', new_settings)

        # copy over the temp config.txt to /boot/ as superuser
        subprocess.call(
            ["sudo", "mv", '/var/tmp/config.txt', self.config_location])

        ok = DIALOG.notification(lang(32095), lang(32096))
Exemplo n.º 4
0
	def run(self):

		'''
			The method determines what happens when the item is clicked in the settings GUI.
			Usually this would be __addon__.OpenSettings(), but it could be any other script.
			This allows the creation of action buttons in the GUI, as well as allowing developers to script and skin their 
			own user interfaces.
		'''

		# read the config.txt file everytime the settings are opened. This is unavoidable because it is possible for
		# the user to have made manual changes to the config.txt while OSG is active.
		config = parser.read_config_file(self.config_location)

		extracted_settings = parser.config_to_kodi(parser.MASTER_SETTINGS, config)

		# load the settings into kodi
		log('Settings extracted from the config.txt')
		for k, v in extracted_settings.iteritems():

			log("%s : %s" % (k, v))
			self.me.setSetting(k, str(v))

		# open the settings GUI and let the user monkey about with the controls
		self.me.openSettings()

		# retrieve the new settings from kodi 
		new_settings = self.settings_retriever_xml()

		log('New settings applied to the config.txt')
		for k, v in new_settings.iteritems():
			log("%s : %s" % (k, v))

		# read the config into a list of lines again
		config = parser.read_config_file(self.config_location)

		# construct the new set of config lines using the protocols and the new settings
		new_settings = parser.kodi_to_config(parser.MASTER_SETTINGS, config, new_settings)

		# write the new lines to the temporary config file
		parser.write_config_file('/var/tmp/config.txt', new_settings)

		# copy over the temp config.txt to /boot/ as superuser
		subprocess.call(["sudo", "mv",  '/var/tmp/config.txt', self.config_location])

		ok = DIALOG.notification(lang(32095), lang(32096))