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


Python Schedule.start方法代碼示例

本文整理匯總了Python中schedule.Schedule.start方法的典型用法代碼示例。如果您正苦於以下問題:Python Schedule.start方法的具體用法?Python Schedule.start怎麽用?Python Schedule.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在schedule.Schedule的用法示例。


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

示例1: Manager

# 需要導入模塊: from schedule import Schedule [as 別名]
# 或者: from schedule.Schedule import start [as 別名]
class Manager(Object, threading.Thread):
	# INIT -------------------------------------------------------------
	def __init__(self):
		threading.Thread.__init__(self)
		Object.__init__(self)
		
		# OBJECTS
		self.scheduler = Schedule() # The schedule object
		self.series = [] # List of series
	
	# LOAD -------------------------------------------------------------
	# Loads schedule from a file (schedule_settings.py).
	def load(self):
		# Add blocks
		for block in schedule_settings.BLOCKS:
			# Calculate the day
			start_day = str(getDate(block[1].split()[0]))
			end_day = str(getDate(block[2].split()[0]))
			
			self.scheduler.add(start_day + " " + block[1].split()[1], end_day + " " + block[2].split()[1], "%j %H:%M", block[0])
		
		# Start the scheduler (if it isn't already)
		if not self.scheduler.running:
			self.scheduler.start()
	
	# NEXT -------------------------------------------------------------
	# Picks the next show (will still obey schedule times, even if
	# something is skipped)
	def next(self):
		pass
		
	# BACK -------------------------------------------------------------
	# Picks the previous show played.
	def back(self):
		pass
		
	# THREADING --------------------------------------------------------
	def run(self):
		while self.scheduler.running:
			time.sleep(settings.MANAGER_SLEEP)
開發者ID:bombpersons,項目名稱:MYOT,代碼行數:42,代碼來源:manager.py


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