public function index(SS_HTTPRequest $request) { if ($request->isPOST()) { $update = json_decode($request->getBody()); $joblog = TranscodeJob::get()->filter('JobID', (int) $update->id)->first(); // return if status already is done (some protection) if ($joblog->JobStatus !== "started") { return "Error: job status not started"; } // save full update into log object -- no, may contain passwords etc. -- well, fixed but still... //format_id // load files into appropriate relations $transcodable = $joblog->Transcodable(); $transcodable->loadTranscodedFiles(); if (count(get_object_vars($update->errors))) { $joblog->JobErrorMessage = json_encode($update->errors); $joblog->JobStatus = "error"; } else { if ($transcodable->transcodingComplete()) { // set status to done when complete... $joblog->JobErrorMessage = ""; $joblog->JobStatus = "done"; } } // write logfile $joblog->write(); } else { // this shouldn't happen return "Well hello there..."; } return "Updated"; }