You are here

public function TranscoderAbstractionFactoryZencoder::getCurrentStatus in Video 7.2

Check the current Zencoder API status.

1 call to TranscoderAbstractionFactoryZencoder::getCurrentStatus()
TranscoderAbstractionFactoryZencoder::adminSettings in transcoders/TranscoderAbstractionFactoryZencoder.inc
Admin settings form for the transcoder

File

transcoders/TranscoderAbstractionFactoryZencoder.inc, line 950
File containing class TranscoderAbstractionFactoryZencoder

Class

TranscoderAbstractionFactoryZencoder
Class that handles Zencoder transcoding.

Code

public function getCurrentStatus() {
  $json = drupal_http_request('http://status.zencoder.com/api/events.json');
  $message = t('All systems go');
  if ($json->code != 200) {
    $message = t('The Zencoder Status API URL cannot be retrieved: @error (@code).', array(
      '@code' => $json->code,
      '@error' => empty($json->error) ? t('unknown error') : $json->error,
    ));
  }
  else {
    $status_messages = drupal_json_decode($json->data);
    if (!empty($status_messages)) {
      $last_message = reset($status_messages);
      $last_event = $last_message['event'];
      $message = nl2br(t('@status', array(
        '@status' => $last_event['description'],
      )));
    }
  }
  return $message;
}