+
+def process_command(command: str, page_history: List[str], page_chooser) -> str:
+ page = None
+ if 'hold' in command:
+ page = page_history[0]
+ elif 'back' in command:
+ page = page_history[1]
+ elif 'skip' in command:
+ while True:
+ (page, _) = page_chooser.choose_next_page()
+ if page != page_history[0]:
+ break
+ elif 'weather' in command:
+ if 'telma' in command or 'cabin' in command:
+ page = 'weather-telma_3_10800.html'
+ elif 'stevens' in command:
+ page = 'weather-stevens_3_10800.html'
+ else:
+ page = 'weather-home_3_10800.html'
+ elif 'cabin' in command:
+ if 'list' in command:
+ page = 'Cabin-(gocabin)_2_3600.html'
+ else:
+ page = 'hidden/cabin_driveway.html'
+ elif 'news' in command or 'headlines' in command:
+ page = 'cnn-CNNNews_4_25900.html'
+ elif 'clock' in command or 'time' in command:
+ page = 'clock_10_none.html'
+ elif 'countdown' in command or 'countdowns' in command:
+ page = 'countdown_3_7200.html'
+ elif 'costco' in command:
+ page = 'Costco-(gocostco)_2_3600.html'
+ elif 'calendar' in command or 'events' in command:
+ page = 'gcal_3_86400.html'
+ elif 'countdown' in command or 'countdowns' in command:
+ page = 'countdown_3_7200.html'
+ elif 'grocery' in command or 'groceries' in command:
+ page = 'Grocery-(gogrocery)_2_3600.html'
+ elif 'hardware' in command:
+ page = 'Hardware-(gohardware)_2_3600.html'
+ elif 'garage' in command:
+ page = 'myq_4_300.html'
+ elif 'menu' in command:
+ page = 'Menu-(gomenu)_2_3600.html'
+ elif 'cron' in command or 'health' in command:
+ page = 'periodic-health_6_300.html'
+ elif 'photo' in command or 'picture' in command:
+ page = 'photo_23_3600.html'
+ elif 'quote' in command or 'quotation' in command or 'quotes' in command:
+ page = 'quotes_4_10800.html'
+ elif 'stevens' in command:
+ page = 'stevens-conditions_1_86400.html'
+ elif 'stock' in command or 'stocks' in command:
+ page = 'stock_3_86400.html'
+ elif 'twitter' in command:
+ page = 'twitter_10_3600.html'
+ elif 'traffic' in command:
+ page = 'wsdot-bridges_3_none.html'
+ elif 'front' in command and 'door' in command:
+ page = 'hidden/frontdoor.html'
+ elif 'driveway' in command:
+ page = 'hidden/driveway.html'
+ elif 'backyard' in command:
+ page = 'hidden/backyard.html'
+ else:
+ page = guess_page(command, page_chooser)
+ assert page is not None
+ return page
+
+
+def thread_change_current(command_queue: Queue) -> None:
+ page_history = [ "", "" ]
+ swap_page_target = 0.0
+
+ def filter_news_during_dinnertime(page: str) -> bool:
+ now = datetime.now(tz=pytz.timezone("US/Pacific"))
+ 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
+ )