Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
eef1927f07
4 changed files with 26 additions and 12 deletions
|
@ -55,6 +55,8 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
$type = $this->_getParam('type');
|
$type = $this->_getParam('type');
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
$params = '/format/json/id/#id#/type/#type#';
|
$params = '/format/json/id/#id#/type/#type#';
|
||||||
|
|
||||||
|
@ -79,7 +81,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$file_id = $this->_getParam('id', null);
|
$file_id = $this->_getParam('id', null);
|
||||||
$file = StoredFile::Recall($file_id);
|
$file = StoredFile::Recall($file_id);
|
||||||
|
|
||||||
$url = $file->getRelativeFileUrl().'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
|
$url = $file->getRelativeFileUrl($baseUrl).'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
|
||||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
||||||
'title' => 'Download');
|
'title' => 'Download');
|
||||||
|
|
||||||
|
|
|
@ -449,10 +449,9 @@ class StoredFile {
|
||||||
* Sometimes we want a relative URL and not a full URL. See bug
|
* Sometimes we want a relative URL and not a full URL. See bug
|
||||||
* http://dev.sourcefabric.org/browse/CC-2403
|
* http://dev.sourcefabric.org/browse/CC-2403
|
||||||
*/
|
*/
|
||||||
public function getRelativeFileUrl()
|
public function getRelativeFileUrl($baseUrl)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
return $baseUrl."/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
||||||
return "api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function Insert($md=null)
|
public static function Insert($md=null)
|
||||||
|
|
|
@ -6,7 +6,7 @@ if (count($items)) : ?>
|
||||||
<li class="ui-state-default" id="spl_<?php echo $i ?>">
|
<li class="ui-state-default" id="spl_<?php echo $i ?>">
|
||||||
<div class="list-item-container">
|
<div class="list-item-container">
|
||||||
<a href="javascript:void(0);" class="big_play"
|
<a href="javascript:void(0);" class="big_play"
|
||||||
onclick="audioPreview('<?php echo $item["CcFiles"]["gunid"].".".pathinfo($item["CcFiles"]["name"], PATHINFO_EXTENSION);?>',
|
onclick="audioPreview('<?php echo $item["CcFiles"]["gunid"].".".pathinfo($item["CcFiles"]["filepath"], PATHINFO_EXTENSION);?>',
|
||||||
'spl_<?php echo $i ?>')"><span class="ui-icon ui-icon-play"></span></a>
|
'spl_<?php echo $i ?>')"><span class="ui-icon ui-icon-play"></span></a>
|
||||||
|
|
||||||
<div class="text-row top">
|
<div class="text-row top">
|
||||||
|
|
|
@ -27,13 +27,26 @@ class AirtimeNotifier(Notifier):
|
||||||
self.import_processes = {}
|
self.import_processes = {}
|
||||||
self.watched_folders = []
|
self.watched_folders = []
|
||||||
|
|
||||||
schedule_exchange = Exchange("airtime-media-monitor", "direct", durable=True, auto_delete=True)
|
while not self.init_rabbit_mq():
|
||||||
schedule_queue = Queue("media-monitor", exchange=schedule_exchange, key="filesystem")
|
logger.error("Error connecting to RabbitMQ Server. Trying again in few seconds")
|
||||||
self.connection = BrokerConnection(self.config.cfg["rabbitmq_host"], self.config.cfg["rabbitmq_user"], self.config.cfg["rabbitmq_password"], "/")
|
time.sleep(5)
|
||||||
channel = self.connection.channel()
|
|
||||||
consumer = Consumer(channel, schedule_queue)
|
def init_rabbit_mq(self):
|
||||||
consumer.register_callback(self.handle_message)
|
logger = logging.getLogger('fetch')
|
||||||
consumer.consume()
|
logger.info("Initializing RabbitMQ stuff")
|
||||||
|
try:
|
||||||
|
schedule_exchange = Exchange("airtime-media-monitor", "direct", durable=True, auto_delete=True)
|
||||||
|
schedule_queue = Queue("media-monitor", exchange=schedule_exchange, key="filesystem")
|
||||||
|
self.connection = BrokerConnection(self.config.cfg["rabbitmq_host"], self.config.cfg["rabbitmq_user"], self.config.cfg["rabbitmq_password"], "/")
|
||||||
|
channel = self.connection.channel()
|
||||||
|
consumer = Consumer(channel, schedule_queue)
|
||||||
|
consumer.register_callback(self.handle_message)
|
||||||
|
consumer.consume()
|
||||||
|
except Exception, e:
|
||||||
|
logger.error(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def handle_message(self, body, message):
|
def handle_message(self, body, message):
|
||||||
# ACK the message to take it off the queue
|
# ACK the message to take it off the queue
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue