CC-1799Put Airtime Storage into a Human Readable File Naming Convention
new API method to check media status.
This commit is contained in:
parent
16cfae10ed
commit
1f9a39f22d
3 changed files with 44 additions and 1 deletions
|
@ -354,6 +354,25 @@ class ApiController extends Zend_Controller_Action
|
|||
$this->view->id = $file->getId();
|
||||
}
|
||||
|
||||
public function mediaMonitorSetupAction() {
|
||||
global $CC_CONFIG;
|
||||
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$api_key = $this->_getParam('api_key');
|
||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
||||
{
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
print 'You are not allowed to access this resource.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$this->view->stor = $CC_CONFIG['storageDir'];
|
||||
$this->view->plupload = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
||||
}
|
||||
|
||||
public function mediaItemStatusAction() {
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
|
|
@ -117,6 +117,9 @@ class ApiClientInterface:
|
|||
def upload_recorded_show(self):
|
||||
pass
|
||||
|
||||
def check_media_status(self, md5):
|
||||
pass
|
||||
|
||||
def update_media_metadata(self, md):
|
||||
pass
|
||||
|
||||
|
@ -356,6 +359,25 @@ class AirTimeApiClient(ApiClientInterface):
|
|||
|
||||
return response
|
||||
|
||||
def check_media_status(self, md5):
|
||||
logger = logging.getLogger()
|
||||
|
||||
response = None
|
||||
try:
|
||||
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["media_status_url"])
|
||||
url = url.replace("%%api_key%%", self.config["api_key"])
|
||||
url = url.replace("%%md5%%", md5)
|
||||
logger.debug(url)
|
||||
|
||||
response = urllib.urlopen(url)
|
||||
response = json.loads(response.read())
|
||||
logger.info("Json Media Status %s", response)
|
||||
|
||||
except Exception, e:
|
||||
logger.error("Exception: %s", e)
|
||||
|
||||
return response
|
||||
|
||||
def update_media_metadata(self, md):
|
||||
logger = logging.getLogger()
|
||||
response = None
|
||||
|
|
|
@ -332,7 +332,9 @@ if __name__ == '__main__':
|
|||
logger = logging.getLogger('root')
|
||||
logger.info("Added watch to %s", storage_directory)
|
||||
|
||||
notifier = AirtimeNotifier(wm, MediaMonitor(), read_freq=int(config["check_filesystem_events"]), timeout=1)
|
||||
mm = MediaMonitor()
|
||||
|
||||
notifier = AirtimeNotifier(wm, mm, read_freq=int(config["check_filesystem_events"]), timeout=1)
|
||||
notifier.coalesce_events()
|
||||
notifier.loop(callback=checkRabbitMQ)
|
||||
except KeyboardInterrupt:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue