Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Yuchen Wang 2011-12-08 16:46:13 -05:00
commit c49cd436fa
18 changed files with 76 additions and 12 deletions

View File

@ -1,2 +1,2 @@
PRODUCT_ID=Airtime PRODUCT_ID=Airtime
PRODUCT_RELEASE=2.0.0-beta1 PRODUCT_RELEASE=2.0.0

View File

@ -141,15 +141,19 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
try{
try {
$showInstance = new Application_Model_ShowInstance($showInstanceId); $showInstance = new Application_Model_ShowInstance($showInstanceId);
}catch(Exception $e){ }
catch(Exception $e){
$this->view->show_error = true; $this->view->show_error = true;
return false; return false;
} }
$showInstance->delete(); $showInstance->delete();
$this->view->show_id = $showInstance->getShowId();
} }
} }
@ -801,15 +805,18 @@ class ScheduleController extends Zend_Controller_Action
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');
try{ try {
$showInstance = new Application_Model_ShowInstance($showInstanceId); $showInstance = new Application_Model_ShowInstance($showInstanceId);
}catch(Exception $e){ }
catch(Exception $e){
$this->view->show_error = true; $this->view->show_error = true;
return false; return false;
} }
$show = new Application_Model_Show($showInstance->getShowId()); $show = new Application_Model_Show($showInstance->getShowId());
$show->cancelShow($showInstance->getShowInstanceStart()); $show->cancelShow($showInstance->getShowInstanceStart());
$this->view->show_id = $showInstance->getShowId();
} }
} }

View File

@ -368,6 +368,7 @@ class Application_Model_Preference
$outputArray['STATION_COUNTRY'] = self::GetStationCountry(); $outputArray['STATION_COUNTRY'] = self::GetStationCountry();
$outputArray['STATION_CITY'] = self::GetStationCity(); $outputArray['STATION_CITY'] = self::GetStationCity();
$outputArray['STATION_DESCRIPTION'] = self::GetStationDescription(); $outputArray['STATION_DESCRIPTION'] = self::GetStationDescription();
// get web server info // get web server info
if(isset($systemInfoArray["AIRTIME_VERSION_URL"])){ if(isset($systemInfoArray["AIRTIME_VERSION_URL"])){
@ -387,6 +388,8 @@ class Application_Model_Preference
$outputArray['UNIQUE_ID'] = self::GetUniqueId(); $outputArray['UNIQUE_ID'] = self::GetUniqueId();
$outputArray['SAAS'] = self::GetPlanLevel(); $outputArray['SAAS'] = self::GetPlanLevel();
$outputArray['INSTALL_METHOD'] = self::GetInstallMethod(); $outputArray['INSTALL_METHOD'] = self::GetInstallMethod();
$outputArray['NUM_OF_STREAMS'] = self::GetNumOfStreams();
$outputArray['STREAM_INFO'] = Application_Model_StreamSetting::getStreamInfoForDataCollection();
$outputArray = array_merge($systemInfoArray, $outputArray); $outputArray = array_merge($systemInfoArray, $outputArray);
@ -396,7 +399,16 @@ class Application_Model_Preference
continue; continue;
} }
if($out != ''){ if($out != ''){
$outputString .= $key.' : '.$out."\n"; if($key == "STREAM_INFO"){
$outputString .= $key." :\n";
foreach($out as $s_info){
foreach($s_info as $k => $v){
$outputString .= "\t".strtoupper($k)." : ".$v."\n";
}
}
}else{
$outputString .= $key.' : '.$out."\n";
}
} }
} }
if($returnArray){ if($returnArray){

View File

@ -164,4 +164,31 @@ class Application_Model_StreamSetting {
} }
return $result; return $result;
} }
/*
* Only returns info that is needed for data collection
* returns array('s1'=>array(keyname=>value))
*/
public static function getStreamInfoForDataCollection(){
global $CC_DBC;
$out = array();
$enabled_stream = self::getEnabledStreamIds();
foreach($enabled_stream as $stream){
$keys = "'".$stream."_output', "."'".$stream."_type', "."'".$stream."_bitrate', "."'".$stream."_host'";
$sql = "SELECT keyname, value FROM cc_stream_setting"
." WHERE keyname IN ($keys)";
$rows = $CC_DBC->getAll($sql);
$info = array();
foreach($rows as $r){
$temp = explode("_", $r['keyname']);
$info[$temp[1]] = $r['value'];
$out[$stream] = $info;
}
}
return $out;
}
} }

View File

@ -8,6 +8,14 @@ function scheduleRefetchEvents(json) {
if(json.show_error == true){ if(json.show_error == true){
alert("The show instance doesn't exist anymore!") alert("The show instance doesn't exist anymore!")
} }
if(json.show_id) {
var dialog_id = parseInt($("#add_show_id").val(), 10);
//if you've deleted the show you are currently editing, close the add show dialog.
if (dialog_id === json.show_id) {
$("#add-show-close").click();
}
}
$("#schedule_calendar").fullCalendar( 'refetchEvents' ); $("#schedule_calendar").fullCalendar( 'refetchEvents' );
} }

View File

@ -1,3 +1,3 @@
<?php <?php
define('AIRTIME_VERSION', '2.0.0-beta1'); define('AIRTIME_VERSION', '2.0.0');

View File

@ -13,6 +13,7 @@ log_dir = '/var/log/airtime/media-monitor'
rabbitmq_host = 'localhost' rabbitmq_host = 'localhost'
rabbitmq_user = 'guest' rabbitmq_user = 'guest'
rabbitmq_password = 'guest' rabbitmq_password = 'guest'
rabbitmq_vhost = '/'
############################################ ############################################
# Media-Monitor preferences # # Media-Monitor preferences #

View File

@ -39,6 +39,7 @@ ls_port = '1234'
rabbitmq_host = 'localhost' rabbitmq_host = 'localhost'
rabbitmq_user = 'guest' rabbitmq_user = 'guest'
rabbitmq_password = 'guest' rabbitmq_password = 'guest'
rabbitmq_vhost = '/'
############################################ ############################################
# pypo preferences # # pypo preferences #

View File

@ -15,6 +15,7 @@ log_dir = '/var/log/airtime/show-recorder'
rabbitmq_host = 'localhost' rabbitmq_host = 'localhost'
rabbitmq_user = 'guest' rabbitmq_user = 'guest'
rabbitmq_password = 'guest' rabbitmq_password = 'guest'
rabbitmq_vhost = '/'
############################################ ############################################
# Recorded Audio settings # # Recorded Audio settings #

View File

@ -21,7 +21,7 @@ from urlparse import urlparse
import base64 import base64
from configobj import ConfigObj from configobj import ConfigObj
AIRTIME_VERSION = "2.0.0-beta1" AIRTIME_VERSION = "2.0.0"
def api_client_factory(config): def api_client_factory(config):
logger = logging.getLogger() logger = logging.getLogger()

View File

@ -39,7 +39,7 @@ class AirtimeNotifier(Notifier):
try: try:
schedule_exchange = Exchange("airtime-media-monitor", "direct", durable=True, auto_delete=True) schedule_exchange = Exchange("airtime-media-monitor", "direct", durable=True, auto_delete=True)
schedule_queue = Queue("media-monitor", exchange=schedule_exchange, key="filesystem") 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"], "/") self.connection = BrokerConnection(self.config.cfg["rabbitmq_host"], self.config.cfg["rabbitmq_user"], self.config.cfg["rabbitmq_password"], self.config.cfg["rabbitmq_vhost"])
channel = self.connection.channel() channel = self.connection.channel()
consumer = Consumer(channel, schedule_queue) consumer = Consumer(channel, schedule_queue)
consumer.register_callback(self.handle_message) consumer.register_callback(self.handle_message)

View File

@ -13,6 +13,7 @@ log_dir = '/var/log/airtime/media-monitor'
rabbitmq_host = 'localhost' rabbitmq_host = 'localhost'
rabbitmq_user = 'guest' rabbitmq_user = 'guest'
rabbitmq_password = 'guest' rabbitmq_password = 'guest'
rabbitmq_vhost = '/'
############################################ ############################################
# Media-Monitor preferences # # Media-Monitor preferences #

View File

@ -38,6 +38,9 @@ s3_host = "127.0.0.1"
s1_port = 8000 s1_port = 8000
s2_port = 8000 s2_port = 8000
s3_port = 8000 s3_port = 8000
s1_user = ""
s2_user = ""
s3_user = ""
s1_pass = "hackme" s1_pass = "hackme"
s2_pass = "hackme" s2_pass = "hackme"
s3_pass = "hackme" s3_pass = "hackme"

View File

@ -39,6 +39,7 @@ ls_port = '1234'
rabbitmq_host = 'localhost' rabbitmq_host = 'localhost'
rabbitmq_user = 'guest' rabbitmq_user = 'guest'
rabbitmq_password = 'guest' rabbitmq_password = 'guest'
rabbitmq_vhost = '/'
############################################ ############################################
# pypo preferences # # pypo preferences #

View File

@ -57,7 +57,7 @@ class PypoFetch(Thread):
try: try:
schedule_exchange = Exchange("airtime-pypo", "direct", durable=True, auto_delete=True) schedule_exchange = Exchange("airtime-pypo", "direct", durable=True, auto_delete=True)
schedule_queue = Queue("pypo-fetch", exchange=schedule_exchange, key="foo") schedule_queue = Queue("pypo-fetch", exchange=schedule_exchange, key="foo")
self.connection = BrokerConnection(config["rabbitmq_host"], config["rabbitmq_user"], config["rabbitmq_password"], "/") self.connection = BrokerConnection(config["rabbitmq_host"], config["rabbitmq_user"], config["rabbitmq_password"], config["rabbitmq_vhost"])
channel = self.connection.channel() channel = self.connection.channel()
consumer = Consumer(channel, schedule_queue) consumer = Consumer(channel, schedule_queue)
consumer.register_callback(self.handle_message) consumer.register_callback(self.handle_message)

View File

@ -15,6 +15,7 @@ log_dir = '/var/log/airtime/show-recorder'
rabbitmq_host = 'localhost' rabbitmq_host = 'localhost'
rabbitmq_user = 'guest' rabbitmq_user = 'guest'
rabbitmq_password = 'guest' rabbitmq_password = 'guest'
rabbitmq_vhost = '/'
############################################ ############################################
# Recorded Audio settings # # Recorded Audio settings #

View File

@ -183,7 +183,7 @@ class CommandListener():
try: try:
schedule_exchange = Exchange("airtime-show-recorder", "direct", durable=True, auto_delete=True) schedule_exchange = Exchange("airtime-show-recorder", "direct", durable=True, auto_delete=True)
schedule_queue = Queue("recorder-fetch", exchange=schedule_exchange, key="foo") schedule_queue = Queue("recorder-fetch", exchange=schedule_exchange, key="foo")
self.connection = BrokerConnection(config["rabbitmq_host"], config["rabbitmq_user"], config["rabbitmq_password"], "/") self.connection = BrokerConnection(config["rabbitmq_host"], config["rabbitmq_user"], config["rabbitmq_password"], config["rabbitmq_vhost"])
channel = self.connection.channel() channel = self.connection.channel()
consumer = Consumer(channel, schedule_queue) consumer = Consumer(channel, schedule_queue)
consumer.register_callback(self.handle_message) consumer.register_callback(self.handle_message)

View File

@ -36,6 +36,7 @@ require_once($CC_CONFIG['phpDir'].'/application/models/Schedule.php');
require_once($CC_CONFIG['phpDir'].'/application/models/Show.php'); require_once($CC_CONFIG['phpDir'].'/application/models/Show.php');
require_once($CC_CONFIG['phpDir'].'/application/models/ShowInstance.php'); require_once($CC_CONFIG['phpDir'].'/application/models/ShowInstance.php');
require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php'); require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');
require_once($CC_CONFIG['phpDir'].'/application/models/StreamSetting.php');
//Pear classes. //Pear classes.
set_include_path($CC_CONFIG['phpDir'].'/library/pear' . PATH_SEPARATOR . get_include_path()); set_include_path($CC_CONFIG['phpDir'].'/library/pear' . PATH_SEPARATOR . get_include_path());