def update_crawl_message(crawl_messages):
crawl_messages.set_message(0, config.EVENT_NAME)
crawl_messages.set_message_colors(0, graphics.BRIGHT_BLUE, graphics.BLACK)
now = datetime.utcnow()
crawl_messages.set_message(1, datetime.strftime(now, '%H:%M:%S'))
if now < config.EVENT_START_TIME:
delta = config.EVENT_START_TIME - now
seconds = delta.total_seconds()
bg = graphics.BLUE if seconds > 3600 else graphics.RED
crawl_messages.set_message(2, '%s starts in %s' % (config.EVENT_NAME, delta_time_to_string(delta)))
crawl_messages.set_message_colors(2, graphics.WHITE, bg)
elif now < config.EVENT_END_TIME:
delta = config.EVENT_END_TIME - now
seconds = delta.total_seconds()
fg = graphics.YELLOW if seconds > 3600 else graphics.ORANGE
crawl_messages.set_message(2, '%s ends in %s' % (config.EVENT_NAME, delta_time_to_string(delta)))
crawl_messages.set_message_colors(2, fg, graphics.BLACK)
else:
crawl_messages.set_message(2, '%s is over.' % config.EVENT_NAME)
crawl_messages.set_message_colors(2, graphics.RED, graphics.BLACK)
评论列表
文章目录