From de2d0ab212a31e160bee91c20dcaf356e217069a Mon Sep 17 00:00:00 2001 From: largmost Date: Tue, 1 Jan 2019 08:49:34 +0800 Subject: [PATCH] add time mode --- bin/timelit.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/timelit.py b/bin/timelit.py index 020f054..7768946 100644 --- a/bin/timelit.py +++ b/bin/timelit.py @@ -31,13 +31,16 @@ def main(): show(image_path_prefix + 'quote_Leg_0_credits.png') while True: - now = datetime.datetime.now().strftime('%H%M') + now = datetime.datetime.now() + now_time = now.strftime('%H%M') image_name = "quote_{}_*_credits.png" - images = glob.glob(image_path_prefix + image_name.format(now)) + images = glob.glob(image_path_prefix + image_name.format(now_time)) + + FAST_MODE = 120 if 500 < int(now_time) < 2300 else 900 if len(images) > 0: show(random.choice(images)) - time.sleep(60) + time.sleep(FAST_MODE) else: time.sleep(60)