padre
645745ed7c
commit
d7ca903f01
@ -0,0 +1,36 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
|
||||
def _config_error(msg):
|
||||
print("Configuration error: %s" % (msg,), file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
def _check_missing_keys(conf, sec, mandatory, users_choice=[]):
|
||||
#d = conf[sec] if sec is not None else conf
|
||||
#if sec is None:
|
||||
# sec = "main"
|
||||
|
||||
d = conf
|
||||
|
||||
allowed = mandatory + users_choice
|
||||
|
||||
for key in d.iterkeys():
|
||||
if key not in allowed:
|
||||
_config_error("Key %s is not an allowed config key in section %s (allowed are %s)" % (key, sec, ", ".join(allowed)))
|
||||
|
||||
for key in mandatory:
|
||||
if key not in d.iterkeys():
|
||||
_config_error("Key %s is not present in section %s but mandatory" % (key, sec,))
|
||||
|
||||
|
||||
def check_config(conf):
|
||||
main_keys = ["music", "savedir", "playerInput"]
|
||||
music_keys = ["startSong", "questionSong"]
|
||||
|
||||
_check_missing_keys(conf, "main", main_keys)
|
||||
_check_missing_keys(conf["music"], "music", music_keys)
|
||||
|
||||
if conf["playerInput"]:
|
||||
for i, inp in enumerate(conf["playerInput"], 1):
|
||||
_check_missing_keys(inp, "playerInput %d" % i, ["Type"], ["Args"])
|
@ -0,0 +1,27 @@
|
||||
# _
|
||||
# ___ ___ ___ _ __ __ _ _ __ __| |_ _
|
||||
# / __|/ _ \/ _ \| '_ \ / _` | '__/ _` | | | |
|
||||
# \__ \ __/ (_) | |_) | (_| | | | (_| | |_| |
|
||||
# |___/\___|\___/| .__/ \__,_|_| \__,_|\__, |
|
||||
# |_| |___/
|
||||
# Configuration
|
||||
#
|
||||
# Basicly you can configure here:
|
||||
# - player inputs
|
||||
# - pathes to theme songs
|
||||
# - path to savedir (gamestate backups while game is running)
|
||||
# Note that this is a yamlfile (no tabs -.-)
|
||||
|
||||
# path to music, set to null if you don't have the song
|
||||
music:
|
||||
startSong: path/to/theme_song.mp3
|
||||
questionSong: path/to/question_song.mp3
|
||||
|
||||
# change to path, default is /tmp/seopardy/
|
||||
savedir: /tmp/seopardy/
|
||||
|
||||
# player inputs. look in buttonreader.py for available types
|
||||
playerInput:
|
||||
# - Type: Fifo
|
||||
# Args:
|
||||
# - /tmp/seopardy_fifo
|
Cargando…
Referencia en una nueva incidencia