當前位置: 首頁>>代碼示例>>Python>>正文


Python OSMC_Backups類代碼示例

本文整理匯總了Python中OSMC_Backups的典型用法代碼示例。如果您正苦於以下問題:Python OSMC_Backups類的具體用法?Python OSMC_Backups怎麽用?Python OSMC_Backups使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了OSMC_Backups類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: settings_command

	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,代碼行數:46,代碼來源:update_service.py

示例2: settings_command_backup

	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,代碼行數:18,代碼來源:update_service.py

示例3: update_now

	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,代碼行數:42,代碼來源:update_service.py

示例4: settings_command_restore

	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,代碼行數:38,代碼來源:update_service.py

示例5: settings_command

	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,代碼行數:101,代碼來源:update_service.py

示例6: settings_command

	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,代碼行數:75,代碼來源:update_service.py


注:本文中的OSMC_Backups類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。