当前位置: 首页>>代码示例>>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;未经允许,请勿转载。