body[0]->video as $video) {
$src = preg_replace('/^\//', '', $video['src']);
$src_arr = explode('/', $src);
$name = preg_replace($src_re, '', end($src_arr));
$name = str_replace('ยง', '?', $name);
$begin = $video['begin'];
$dur = $video['dur'];
$in = $video['in'];
$out = $video['out'];
$videos[] = array('start' => $start_hour, 'begin'=> $begin, 'src' => $name, 'dur' => $dur, 'in' => $in, 'out' => $out);
}
echo json_encode($videos);
}
}
// start / stop playout
if(!empty($_POST['playout'])) {
$state = $_POST['playout'];
if ($state === "start") {
$out = shell_exec("./sh/playout.sh start");
echo "Started Playout";
} else if ($state === "stop") {
$out = shell_exec("./sh/playout.sh stop");
echo "Stoped Playout";
}
echo "$out";
}