From: Neszt Tibor Date: Sun, 3 Dec 2017 16:33:31 +0000 (+0100) Subject: config read in function X-Git-Url: http://git.neszt.hu/?a=commitdiff_plain;h=4b5ecd2bcab6455978cd293091c70a12b848921b;p=yawep.git config read in function --- diff --git a/index.php b/index.php index 5c41138..b0235eb 100755 --- a/index.php +++ b/index.php @@ -5,15 +5,19 @@ function get_status($cmd) { return str_replace("\n", '
', `$cmd`); } +function read_json_config($filename) { + + $json_data = file_get_contents($filename); + return json_decode($json_data, true); +} + # # Read config.json # $player_script = '/tmp/yawep_screen_player_script.sh'; -$config_file = 'config.json'; -$json_data = file_get_contents($config_file); -$config = json_decode($json_data, true); +$config = read_json_config('config.json'); $default_player_cmd = "sudo omxplayer -s -o alsa:plughw:0,1 -y --threshold %Buffer% --no-osd --layer 100 --timeout 3 --aspect-mode stretch '%URL%'"; $screenrc_file = "/tmp/yawep_player_screenrc"; $screenlog_file = "/tmp/yawep_screen.log";