import datetime_utils
import file_utils
-import constants
+import kiosk_constants
import file_writer
import renderer_catalog
import chooser
break
elif 'internal' in command:
if 'render' in command:
- page = constants.render_stats_pagename
+ page = kiosk_constants.render_stats_pagename
else:
- page = constants.render_stats_pagename
+ page = kiosk_constants.render_stats_pagename
elif 'weather' in command:
if 'telma' in command or 'cabin' in command:
page = 'weather-telma_3_10800.html'
page_chooser = chooser.weighted_random_chooser_with_triggers(
trigger_catalog.get_triggers(), [filter_news_during_dinnertime]
)
- current_file = os.path.join(constants.pages_dir, "current.shtml")
- emergency_file = os.path.join(constants.pages_dir, "reload_immediately.html")
+ current_file = os.path.join(kiosk_constants.pages_dir, "current.shtml")
+ emergency_file = os.path.join(kiosk_constants.pages_dir, "reload_immediately.html")
# Main chooser loop
while True:
if triggered:
if page != page_history[0] or (swap_page_target - now) < 10.0:
logger.info(f'chooser: An emergency page reload to {page} is needed at this time.')
- swap_page_target = now + constants.emergency_refresh_period_sec
+ swap_page_target = now + kiosk_constants.emergency_refresh_period_sec
# Set current.shtml to the right page.
try:
emit(
f,
page,
- override_refresh_sec = constants.emergency_refresh_period_sec,
+ override_refresh_sec = kiosk_constants.emergency_refresh_period_sec,
command = command
)
logger.debug(f'chooser: Wrote {current_file}.')
logger.info(
f'chooser: Nominal choice of {page} as the next to show.'
)
- swap_page_target = now + constants.refresh_period_sec
+ swap_page_target = now + kiosk_constants.refresh_period_sec
try:
with open(current_file, "w") as f:
emit(f, page)
return float(override_refresh_sec * 1000.0)
now = datetime.now(tz=pytz.timezone("US/Pacific"))
if now.hour < 6:
- return float(constants.refresh_period_night_sec * 1000.0)
+ return float(kiosk_constants.refresh_period_night_sec * 1000.0)
else:
- return float(constants.refresh_period_sec * 1000.0)
+ return float(kiosk_constants.refresh_period_sec * 1000.0)
age = file_utils.describe_file_ctime(f"pages/{filename}")
bgcolor = pick_background_color()
setInterval(check_reload, 500);
</SCRIPT>
</HEAD>
-""" % constants.root_url)
+""" % kiosk_constants.root_url)
f.write(f'<BODY BGCOLOR="#{bgcolor}">')
f.write(
"""
logger.info(
'renderer: Updating internal render statistics page.'
)
- with file_writer.file_writer(constants.render_stats_pagename) as f:
+ with file_writer.file_writer(kiosk_constants.render_stats_pagename) as f:
f.write(
'''
<CENTER>
# Update a page about internal stats of renderers.
renderer_update_internal_stats_page(last_render, render_counts, render_times)
logger.info('renderer: having a little nap...')
- time.sleep(constants.render_period_sec)
+ time.sleep(kiosk_constants.render_period_sec)
@bootstrap.initialize
# Have a little break and then check to make sure all threads are still alive.
logger.debug('watchdog: having a little nap.')
- time.sleep(constants.check_threads_period_sec)
+ time.sleep(kiosk_constants.check_threads_period_sec)
if __name__ == "__main__":