config read in function
authorNeszt Tibor <neszt.tibor@euronetrt.hu>
Sun, 3 Dec 2017 16:33:31 +0000 (17:33 +0100)
committerNeszt Tibor <neszt.tibor@euronetrt.hu>
Sun, 3 Dec 2017 16:33:31 +0000 (17:33 +0100)
index.php

index 5c41138..b0235eb 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -5,15 +5,19 @@ function get_status($cmd) {
        return str_replace("\n", '<br>', `$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";