die("You need PHP 5.4 or higher"); } header("X-UA-Compatible: IE=edge"); header("Expires: 0"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); require __DIR__ . "/lib/functions.php"; require __DIR__ . "/lib/Translations.class.php"; require __DIR__ . "/lib/OMX.class.php"; try { $optionsFile = __DIR__ . "/options.json"; $options = file_exists($optionsFile) ? json_decode(file_get_contents($optionsFile), true) : array(); $folders = isset($options["folders"]) ? $options["folders"] : array(); Translations::$language = isset($options["language"]) ? $options["language"] : "en"; # json requests if (isset($_GET["json"])) { $data = NULL; switch ($_GET["action"]) { case "get-status": $data = array("status" => "stopped"); $output = $return = ""; exec('sh ' . escapeshellcmd(__DIR__ . "/omx-status.sh"), $output, $return); if ($return) { $data["status"] = "playing"; if (file_exists(OMX::$fifoStatusFile)) { $json = json_decode(file_get_contents(OMX::$fifoStatusFile), true); $data["path"] = $json["path"]; # view cache $hash = getPathHash($data["path"]);