Commit 98da206c authored by birk's avatar birk
Browse files

log latest media entry

parent bdb95f64
from datetime import datetime
from pathlib import Path
from pyglet.event import EventDispatcher
from display.mediadisplay import MediaDisplay
from system.config import Config
class Dispatcher(EventDispatcher):
......@@ -14,6 +18,7 @@ class Dispatcher(EventDispatcher):
for s in screens_:
self._screens.append(s)
self._program = None
self._config = Config()
def set_program(self, program_):
self._program = program_
......@@ -104,6 +109,7 @@ class Dispatcher(EventDispatcher):
media_display_ = MediaDisplay(media_entry_, screen_, self._program, index_)
media_display_.push_handlers(on_end=self.on_screen_ready)
screen_.set_media(media_display_)
self.log_media(media_entry_)
def on_screen_ready(self, media_display_, screen_):
"""
......@@ -136,6 +142,11 @@ class Dispatcher(EventDispatcher):
return self._program.length
return 0
def log_media(self, media_entry_):
with open(str(Path(self._config.log_dir,'last_media_entry.txt')), 'w') as f:
f.write('{} {}\n'.format(datetime.now().strftime('%H:%M:%S'),media_entry_.uuid))
class ScreenEntry():
def __init__(self, entry_, screen_=None, index_=None):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment