当前位置: 首页>>代码示例>>Python>>正文


Python OSMC_Backups.osmc_backup方法代码示例

本文整理汇总了Python中OSMC_Backups.osmc_backup方法的典型用法代码示例。如果您正苦于以下问题:Python OSMC_Backups.osmc_backup方法的具体用法?Python OSMC_Backups.osmc_backup怎么用?Python OSMC_Backups.osmc_backup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OSMC_Backups的用法示例。


在下文中一共展示了OSMC_Backups.osmc_backup方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: settings_command

# 需要导入模块: import OSMC_Backups [as 别名]
# 或者: from OSMC_Backups import osmc_backup [as 别名]
	def settings_command(self, action):

		if action == 'update':

			self.call_child_script('update_manual')

			return 'Called child action - update_manual'

		if action == 'backup':

			self.update_settings()

			bckp = OSMC_Backups.osmc_backup(self.s, self.progress_bar)

			bckp.start_backup()

		elif action == 'install':

			# check, _ = self.check_for_legit_updates()

			# if check == 'bail':

			# 	return  'Update not legit, bail'

			# if not self.EXTERNAL_UPDATE_REQUIRED:

			# 	__addon__.setSetting('install_now_visible', 'false')

			# 	self.call_child_script('commit')

			# 	return 'Called child action - commit'

			# else:

			ans = DIALOG.yesno(lang(32072), lang(32075), lang(32076))

			if ans:

				__addon__.setSetting('install_now_visible', 'false')
				
				exit_osmc_settings_addon()
				xbmc.sleep(1000)

				subprocess.Popen(['sudo', 'systemctl', 'start', 'manual-update'])	

				return "Calling external update"
开发者ID:eldridgemartinez,项目名称:osmc,代码行数:48,代码来源:update_service.py

示例2: settings_command_backup

# 需要导入模块: import OSMC_Backups [as 别名]
# 或者: from OSMC_Backups import osmc_backup [as 别名]
	def settings_command_backup(self):
		''' User called to initiate a backup '''

		self.update_settings()

		bckp = OSMC_Backups.osmc_backup(self.s, self.progress_bar)

		try:

			bckp.start_backup()

		except Exception as e:
		
			log('Backup Error Type and Args: %s : %s \n\n %s' % (type(e).__name__, e.args, traceback.format_exc()))

			ok = DIALOG.ok(lang(32096), lang(32097))

		return 'Called BACKUP script complete'
开发者ID:Bahrnegus,项目名称:osmc,代码行数:20,代码来源:update_service.py

示例3: update_now

# 需要导入模块: import OSMC_Backups [as 别名]
# 或者: from OSMC_Backups import osmc_backup [as 别名]
	def update_now(self):
		''' Calls for an update check via the external script. This method checks if media is playing or whether the system has 
			been idle for two minutes before allowing the update. If an update is requested, but media is playing or the system
			isnt idle, then the update request is put into a loop, with the daemon checking periodically to see if the situation 
			has changed. '''

		# do not do anything while there is something in the holding pattern
		if self.function_holding_pattern: return

		# check whether the install is an alpha version
		if self.check_for_unsupported_version() == 'alpha': return

		check, _ = self.check_update_conditions()

		if check:


			if self.s['backup_on_update']:

				# run backup

				self.update_settings()

				bckp = OSMC_Backups.osmc_backup(self.s, self.progress_bar, self.parent_queue)

				try:

					bckp.start_backup()

				except Exception as e:
				
					log('Backup Error Type and Args: %s : %s \n\n %s' % (type(e).__name__, e.args, traceback.format_exc()))

			else:

				# run the update

				self.call_child_script('update')
		
		else:

			self.function_holding_pattern = self.holding_pattern_update
开发者ID:DBMandrake,项目名称:osmc,代码行数:44,代码来源:update_service.py

示例4: settings_command_restore

# 需要导入模块: import OSMC_Backups [as 别名]
# 或者: from OSMC_Backups import osmc_backup [as 别名]
	def settings_command_restore(self):		
		''' User called to inititate a restore '''	

		self.update_settings()

		bckp = OSMC_Backups.osmc_backup(self.s, self.progress_bar)

		try:

			bckp.start_restore()

			restart_required = bckp.restoring_guisettings

			if bckp.success != 'Full':

				ok = DIALOG.ok('Restore','Some items failed to restore.','See log for details.')

				for x in bckp.success:

					if x.endswith('userdata/guisettings.xml'):

						restart_required = False

			if restart_required:

				user_input_restart_now = DIALOG.yesno(lang(32110), lang(32098), lang(32099), yeslabel=lang(32100), nolabel=lang(32101))

				if user_input_restart_now:

					subprocess.Popen(['sudo', 'systemctl', 'restart', 'mediacenter'])

		except Exception as e:
		
			log('Backup Error Type and Args: %s : %s \n\n %s' % (type(e).__name__, e.args, traceback.format_exc()))

			ok = DIALOG.ok(lang(32096), lang(32097))

		return 'Called RESTORE script complete'
开发者ID:Bahrnegus,项目名称:osmc,代码行数:40,代码来源:update_service.py

示例5: settings_command

# 需要导入模块: import OSMC_Backups [as 别名]
# 或者: from OSMC_Backups import osmc_backup [as 别名]
	def settings_command(self, action):

		if action == 'update':

			self.call_child_script('update_manual')

			return 'Called child action - update_manual'

		if action == 'backup':

			self.update_settings()

			bckp = OSMC_Backups.osmc_backup(self.s, self.progress_bar)

			try:

				bckp.start_backup()

			except Exception as e:
			
				log('Backup Error Type and Args: %s : %s \n\n %s' % (type(e).__name__, e.args, traceback.format_exc()))

				ok = DIALOG.ok(lang(32096), lang(32097))

			return 'Called BACKUP script complete'

		if action == 'restore':

			self.update_settings()

			bckp = OSMC_Backups.osmc_backup(self.s, self.progress_bar)

			try:

				bckp.start_restore()

				restart_required = bckp.restoring_guisettings

				if bckp.success != 'Full':

					ok = DIALOG.ok('Restore','Some items failed to restore.','See log for details.')

					for x in bckp.success:

						if x.endswith('userdata/guisettings.xml'):

							restart_required = False

				if restart_required:

					user_input_restart_now = DIALOG.yesno(lang(32110), lang(32098), lang(32099), yeslabel=lang(32100), nolabel=lang(32101))

					if user_input_restart_now:

						subprocess.Popen(['sudo', 'systemctl', 'restart', 'mediacenter'])

			except Exception as e:
			
				log('Backup Error Type and Args: %s : %s \n\n %s' % (type(e).__name__, e.args, traceback.format_exc()))

				ok = DIALOG.ok(lang(32096), lang(32097))

			return 'Called RESTORE script complete'


		elif action == 'install':

			# check, _ = self.check_for_legit_updates()

			# if check == 'bail':

			# 	return  'Update not legit, bail'

			# if not self.EXTERNAL_UPDATE_REQUIRED:

			# 	__addon__.setSetting('install_now_visible', 'false')

			# 	self.call_child_script('commit')

			# 	return 'Called child action - commit'

			# else:

			# warn the user if there is a major Kodi update that will be installed
			# bail if they decide not to proceed
			if self.UPDATE_WARNING:
				confirm = self.display_update_warning()
				if not confirm: return

			ans = DIALOG.yesno(lang(32072), lang(32075), lang(32076))

			if ans:

				__addon__.setSetting('install_now_visible', 'false')
				
				exit_osmc_settings_addon()
				xbmc.sleep(1000)

				subprocess.Popen(['sudo', 'systemctl', 'start', 'manual-update'])	

#.........这里部分代码省略.........
开发者ID:rferolino,项目名称:osmc,代码行数:103,代码来源:update_service.py

示例6: settings_command

# 需要导入模块: import OSMC_Backups [as 别名]
# 或者: from OSMC_Backups import osmc_backup [as 别名]
	def settings_command(self, action):

		if action == 'update':

			self.call_child_script('update_manual')

			return 'Called child action - update_manual'

		if action == 'backup':

			self.update_settings()

			bckp = OSMC_Backups.osmc_backup(self.s, self.progress_bar)

			try:

				bckp.start_backup()

			except Exception as e:
			
				log('Backup Error Type and Args: %s : %s \n\n %s' % (type(e).__name__, e.args, traceback.format_exc()))

				ok = DIALOG.ok(lang(32096), lang(32097))

			return 'Called BACKUP script complete'

		if action == 'restore':

			self.update_settings()

			bckp = OSMC_Backups.osmc_backup(self.s, self.progress_bar)

			try:

				bckp.start_restore()

			except Exception as e:
			
				log('Backup Error Type and Args: %s : %s \n\n %s' % (type(e).__name__, e.args, traceback.format_exc()))

				ok = DIALOG.ok(lang(32096), lang(32097))

			return 'Called RESTORE script complete'


		elif action == 'install':

			# check, _ = self.check_for_legit_updates()

			# if check == 'bail':

			# 	return  'Update not legit, bail'

			# if not self.EXTERNAL_UPDATE_REQUIRED:

			# 	__addon__.setSetting('install_now_visible', 'false')

			# 	self.call_child_script('commit')

			# 	return 'Called child action - commit'

			# else:

			ans = DIALOG.yesno(lang(32072), lang(32075), lang(32076))

			if ans:

				__addon__.setSetting('install_now_visible', 'false')
				
				exit_osmc_settings_addon()
				xbmc.sleep(1000)

				subprocess.Popen(['sudo', 'systemctl', 'start', 'manual-update'])	

				return "Calling external update"
开发者ID:mellebeek,项目名称:osmc,代码行数:77,代码来源:update_service.py


注:本文中的OSMC_Backups.osmc_backup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。