X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;ds=inline;f=kiosk.py;h=d9f607e3447b08e7616cfe66ef94e6793ce78d55;hb=d6990436e08a57ce211b10058dc61fb223cb94ec;hp=6003165a674e1f2ed76f18f8ffe8812f7c67b6e5;hpb=37b72e72c59140c4a6f7f541c716e4b0bc254b08;p=kiosk.git diff --git a/kiosk.py b/kiosk.py index 6003165..d9f607e 100755 --- a/kiosk.py +++ b/kiosk.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python3.7 +#!/usr/bin/env python3 import sys import traceback @@ -15,9 +15,22 @@ import logging import trigger_catalog import utils +def filter_news_during_dinnertime(page): + now = datetime.now() + is_dinnertime = now.hour >= 17 and now.hour <= 20 + return (not is_dinnertime or + not ("cnn" in page or + "news" in page or + "mynorthwest" in page or + "seattle" in page or + "stranger" in page or + "twitter" in page or + "wsj" in page)) + def thread_change_current(): page_chooser = chooser.weighted_random_chooser_with_triggers( - trigger_catalog.get_triggers()) + trigger_catalog.get_triggers(), + [ filter_news_during_dinnertime ]) swap_page_target = 0 last_page = "" while True: @@ -246,13 +259,14 @@ def emit_wrapped(f, filename):
- %s @ %s ago. + %s @ %s ago.