@@ -195,7 +195,7 @@ public function save()
195195 */
196196 $ this ->worker_pid = intval ($ this ->worker_pid );
197197
198- _error_log ("Encoder::save id=( " . $ this ->getId () . ") title=( " . $ this ->getTitle () . ") streamers_id= {$ this ->streamers_id } " );
198+ _error_log ("Encoder::save id=( " . $ this ->getId () . ") title=( " . $ this ->getTitle () . ") streamers_id= {$ this ->streamers_id } status_obs= { $ this -> status_obs } " );
199199 return parent ::save ();
200200 }
201201
@@ -357,12 +357,13 @@ public function setStatus($status, $setStreamerLog = true)
357357
358358 public function setStatus_obs ($ status_obs )
359359 {
360- if (empty ($ status_ob )) {
360+ if (empty ($ status_obs )) {
361361 return false ;
362362 }
363363 _error_log ("Encoder::setStatus_obs " . json_encode (debug_backtrace ()));
364364 $ old_status_obs = $ this ->status_obs ;
365365 $ this ->status_obs = substr ($ status_obs , 0 , 200 );
366+
366367 if (!empty ($ this ->id ) && $ old_status_obs !== $ this ->status_obs ) {
367368 self ::setStreamerLog ($ this ->id , $ this ->status_obs , Encoder::LOG_TYPE_StatusObs);
368369 }
@@ -1330,7 +1331,7 @@ public static function run($try = 0)
13301331 $ encoder = new Encoder ($ encoder ->getId ());
13311332 $ return_vars = json_decode ($ encoder ->getReturn_vars ());
13321333 }
1333- $ encoder ->setStatus_obs ("Start in " . date ("Y-m-d H:i:s " ));
1334+ $ encoder ->setStatus_obs ("Started at " . date ("Y-m-d H:i:s " ));
13341335 $ encoder ->save ();
13351336 $ objFile = static ::downloadFile ($ encoder ->getId ());
13361337 if ($ objFile ->error && !self ::canEncodeNow () && !self ::canDownloadNow ()) {
@@ -1853,14 +1854,21 @@ public static function sendFile($file, $return_vars, $format, Encoder $encoder =
18531854 self ::setStreamerLog ($ encoder ->getId (), __FUNCTION__ , Encoder::LOG_TYPE_INFO );
18541855 $ obj = self ::sendToStreamer ($ target , $ postFields , $ return_vars , $ encoder );
18551856 $ obj ->videoFileSize = humanFileSize (filesize ($ file ));
1856- // _error_log("AVideo-Streamer sendFile sendToStreamer done: " . json_encode($obj) );
1857+ _error_log ("AVideo-Streamer sendFile sendToStreamer done: " . json_encode ($ obj ) );
18571858 $ obj ->file = $ file ;
18581859
18591860 if (isset ($ u ) && $ u !== false && $ obj ->error == false ) {
18601861 $ u ->setStatus (Encoder::STATUS_DONE );
18611862 $ u ->save ();
18621863 } elseif ($ obj ->error ) {
1863- _error_log ("AVideo-Streamer sendFile error: " . json_encode ($ postFields ) . ' <=> ' . json_encode (debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS )));
1864+ if (!empty ($ obj ->response ) && !empty ($ obj ->response ->msg ) && !empty ($ encoder )){
1865+ $ encoder ->setStatus (Encoder::STATUS_ERROR );
1866+ $ encoder ->setStatus_obs ($ obj ->response ->msg );
1867+ $ savedId = $ encoder ->save ();
1868+ _error_log ("AVideo-Streamer sendFile error: " . ' ' . json_encode ($ obj ->response ->msg ) . ' savedId= ' . $ savedId );
1869+ }else {
1870+ _error_log ("AVideo-Streamer sendFile error error: " . json_encode ($ postFields ) . ' <=> ' . json_encode (debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS )). ' ' . json_encode ($ obj ) );
1871+ }
18641872 }
18651873 return $ obj ;
18661874 }
0 commit comments