Commit 660145a3 authored by birk's avatar birk
Browse files

added developer mode for shorter durations of media entries

parent e05c0108
......@@ -100,7 +100,7 @@ class Dispatcher(EventDispatcher):
:param collection_: Collection that contains the MediaEntry
:return: None
"""
print('play_media_on_screen {} - {}'.format(screen_, media_entry_))
print('play_media_on_screen {} - {} - {} sec.'.format(screen_, media_entry_, media_entry_.duration))
media_display_ = MediaDisplay(media_entry_, screen_, self._program, index_)
media_display_.load_file()
media_display_.push_handlers(on_end=self.on_screen_ready)
......
......@@ -2,6 +2,7 @@ import os
import random
from content.apidata import ApiData
from system.config import Config
class MediaEntryData(ApiData):
......@@ -37,7 +38,10 @@ class MediaEntryData(ApiData):
self.is_published = None
self.responsible_user_id = None
self.media_file = None
self.duration = random.randint(8,15)
if Config().dev_mode:
self.duration = random.randint(3, 5)
else:
self.duration = random.randint(30, 40)
def set_media_file(self, media_file_):
self.media_file = media_file_
......
......@@ -18,12 +18,14 @@ from system.machine import Machine
@click.option('--programs', default='programs.json', help='JSON file with programs')
@click.option('--randomize', default=True, help='Randomize order of programs')
@click.option('--followups', default=True, help='Add followup programs')
@click.option('--devmode', default=False, help='Mode for development with shorter durations')
class Main(object):
def __init__(self, programs, randomize, followups):
def __init__(self, programs, randomize, followups, devmode):
self._randomize = randomize
self._followups = followups
self._config = Config()
self._config.set_server(api_server)
self._config.set_dev_mode(devmode)
self._config.set_api_auth((api_user, api_pass))
self._config.set_meta_data_white_list(['madek_core:authors', 'madek_core:description', 'madek_core:title', 'media_content:title',
'media_content:date_created', 'madek_core:keywords', 'media_set:title',
......
......@@ -18,6 +18,7 @@ class Config:
self.__api_auth = None
self.__server = None
self.__meta_datum_white_list = []
self.__dev_mode = False
def set_server(self, server_):
self.__server = server_
......@@ -39,6 +40,9 @@ class Config:
"""
self.__meta_datum_white_list = list_
def set_dev_mode(self, dev_mode_):
self.__dev_mode = dev_mode_
@property
def server(self):
return self.__server
......@@ -51,6 +55,10 @@ class Config:
def meta_data_white_list(self):
return list(set(self.__meta_datum_white_list) | set(Config.META_DATA_MINIMUM))
@property
def dev_mode(self):
return self.__dev_mode
def __init__(self):
if not Config.instance:
Config.instance = Config.__Config()
......
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