/**
  * @param KalturaConvertJobData $data
  * @param string $errMessage
  * @return number
  */
 public function parse(KalturaConvertJobData &$data, &$errMessage)
 {
     $sendData = new KEncodingComData();
     $sendData->setUserId($this->getUserId());
     $sendData->setUserKey($this->getUserKey());
     $sendData->setAction(KEncodingComData::ACTION_GET_STATUS);
     $sendData->setMediaId($data->remoteMediaId);
     $err = null;
     $requestXml = $sendData->getXml();
     $responseXml = $this->sendRequest($requestXml, $err);
     if (!$responseXml) {
         $errMessage = "Error: {$err}";
         return KalturaBatchJobStatus::ALMOST_DONE;
     }
     preg_match('/\\<status\\>([\\w\\s]*)\\<\\/status\\>/', $responseXml, $status);
     $status = isset($status[1]) ? $status[1] : null;
     if (!$status) {
         $errMessage = 'status not found';
         return KalturaBatchJobStatus::ALMOST_DONE;
     }
     if (strtolower($status) == "error") {
         preg_match_all('/\\<description\\>([^<]*)\\<\\/description\\>/', $responseXml, $description);
         $errMessage = implode("\n", $description[1]);
         return KalturaBatchJobStatus::FAILED;
     }
     if (strtolower($status) != "finished") {
         $errMessage = $status;
         return KalturaBatchJobStatus::ALMOST_DONE;
     }
     preg_match('/\\<s3_destination\\>(.*)\\<\\/s3_destination\\>/', $responseXml, $s3_destination);
     $s3_destination = isset($s3_destination[1]) ? $s3_destination[1] : null;
     $data->destFileSyncRemoteUrl = $s3_destination;
     $errMessage = "Remote url: {$s3_destination}";
     return KalturaBatchJobStatus::FINISHED;
 }