Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
birk
madek-broadcaster
Commits
b2692c40
Commit
b2692c40
authored
Jan 08, 2017
by
birk
Browse files
start parameter support added
parent
af892343
Changes
2
Hide whitespace changes
Inline
Side-by-side
player/main.py
View file @
b2692c40
...
...
@@ -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
)
...
...
player/system/screen.py
View file @
b2692c40
...
...
@@ -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
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment