From 4b5ecd2bcab6455978cd293091c70a12b848921b Mon Sep 17 00:00:00 2001 From: Neszt Tibor Date: Sun, 3 Dec 2017 17:33:31 +0100 Subject: [PATCH] config read in function --- index.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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"; -- 2.1.4