function brightcove_status in Brightcove Video Connect 6
Same name and namespace in other branches
- 6.2 brightcove.module \brightcove_status()
- 7.2 brightcove.module \brightcove_status()
- 7.3 brightcove.module \brightcove_status()
- 7.4 brightcove.module \brightcove_status()
- 7.5 brightcove.module \brightcove_status()
File
- ./
brightcove.module, line 244 - Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.
Code
function brightcove_status($code, $reset = FALSE) {
static $status;
if (!isset($status) || $reset) {
$status = array();
}
if (!isset($status[$code])) {
if ($cache = cache_get('brightcove:status:' . $code, 'cache')) {
$status[$code] = $cache->data;
}
else {
$bc = _brightcove_initialize();
try {
// Get the status of the desired status.
$status[$code] = $bc
->getStatus('video', $code);
} catch (BCMAPIException $error) {
watchdog('brightcove', 'Unhandled error from Brightcove when retrieving the status of video ID %video: %error', array(
'%video' => $code,
'%error' => $error
->getMessage(),
), WATCHDOG_ERROR);
$status[$code] = 'ERROR';
}
cache_set('brightcove:status:' . $code, $status[$code], 'cache', CACHE_TEMPORARY);
}
}
return $status[$code];
}