本文整理汇总了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)