Commit b2692c40 authored by birk's avatar birk
Browse files

start parameter support added

parent af892343
......@@ -2,19 +2,26 @@ import asyncio
import os
import simplejson as json
import click
import pyglet
from random import shuffle
from api_access import api_user, api_pass, api_server
from content.api import ApiClient, MediaEntryParams
from content.api import ApiClient
from content.dispatcher import Dispatcher
from content.program import Program, FollowupProgram
from system.config import Config
from system.machine import Machine
@click.command()
@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')
class Main(object):
def __init__(self):
def __init__(self, programs, randomize, followups):
self._randomize = randomize
self._followups = followups
self._config = Config()
self._config.set_server(api_server)
self._config.set_api_auth((api_user, api_pass))
......@@ -34,11 +41,14 @@ class Main(object):
# defining programs
self._programs = []
with open('programs.json') as json_data:
with open(programs) as json_data:
for p in json.load(json_data)['programs']:
self._programs.append(Program(self._api, p))
shuffle(self._programs)
print('{} programs'.format(len(self._programs)))
if self._randomize:
shuffle(self._programs)
self._program_index = -1
pyglet.clock.schedule_interval(self.on_clock, 1)
......
......@@ -262,6 +262,9 @@ class Screen(Window):
if self.__caption:
self.__caption.draw()
def __str__(self):
return 'Screen {}'.format(self.index+1)
def on_key_press(self, symbol_, modifiers_):
super(Screen, self)
pyglet.app.exit()
......
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