public function registerStream($uid) { $user = new User($uid); $configPath = Settings::storage . $user->getBucket() . '/playlist.xml'; $playlistPath = Settings::storage . $user->getBucket() . '/playlist.m3u'; $tid = $user->getRadioId(); $stream = array('pid' => null, 'uid' => $uid, 'tid' => $tid, 'config_path' => $configPath, 'playlist_path' => $playlistPath); $res = $this->webDBUtils->registerStream($stream); if (false == $res) { $this->printErr('webDBUtilsTest::registerStream(): failed'); $this->printErr($this->session->flushError()); } else { $this->printMsg('webDBUtilsTest::registerStream(): succeeded'); print_r($res); print PHP_EOL; } }
function readDetectProcLog($app) { // sets up utils $utils = Utils::getInstance(); $wmUtils = WatermarkUtils::getInstance(); $session = Session::getInstance(); $user = User::getInstance(); // reads incoming $uid = $utils->iStr($app->request()->post('uid'), 64); if (false == $uid) { $uid = $user->getId(); } if (-1 == $uid) { $uid = $user->getId(); } // $pid = $utils->iStr($app->request()->post('pid'), 64); // $path = $utils->iStr($app->request()->post('path'), 128); // sets up a new user $targetUser = new User(intval($uid)); $path = Settings::storage . $targetUser->getBucket() . '/marked/' . $path; // reads log file of current detect proc $res = $wmUtils->readDetectProcLog($path); $err = false == $res ? $session->flushError() : ''; $res = false == $res ? 'false' : $res; // evaluates whether or not proc (pid) is running $proc = $wmUtils->isProcRunning($pid); $proc = false == $proc ? 'false' : 'true'; // sets up result $res = array('req' => 'readDetectProcLog', 'res' => $res, 'err' => $err, 'proc' => $proc); return $res; }