Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
905775552d
|
@ -8,7 +8,9 @@
|
||||||
* that the user can customize these.
|
* that the user can customize these.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$ini = parse_ini_file('/etc/airtime/airtime.conf', true);
|
|
||||||
|
$configFile = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||||
|
$ini = parse_ini_file($configFile, true);
|
||||||
|
|
||||||
$dbhost = $ini['database']['host'];
|
$dbhost = $ini['database']['host'];
|
||||||
$dbname = $ini['database']['dbname'];
|
$dbname = $ini['database']['dbname'];
|
||||||
|
|
|
@ -23,7 +23,9 @@ $CC_CONFIG = array(
|
||||||
'phingPath' => dirname(__FILE__).'/../../library/phing'
|
'phingPath' => dirname(__FILE__).'/../../library/phing'
|
||||||
);
|
);
|
||||||
|
|
||||||
Config::loadConfig("/etc/airtime/airtime.conf");
|
|
||||||
|
$configFile = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||||
|
Config::loadConfig($configFile);
|
||||||
|
|
||||||
// Add database table names
|
// Add database table names
|
||||||
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist';
|
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist';
|
||||||
|
|
|
@ -23,8 +23,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
->addActionContext('get-stream-setting', 'json')
|
->addActionContext('get-stream-setting', 'json')
|
||||||
->addActionContext('status', 'json')
|
->addActionContext('status', 'json')
|
||||||
->addActionContext('register-component', 'json')
|
->addActionContext('register-component', 'json')
|
||||||
->addActionContext('update-liquidsoap-error', 'json')
|
->addActionContext('update-liquidsoap-status', 'json')
|
||||||
->addActionContext('update-liquidsoap-connection', 'json')
|
|
||||||
->addActionContext('library-init', 'json')
|
->addActionContext('library-init', 'json')
|
||||||
->addActionContext('live-chat', 'json')
|
->addActionContext('live-chat', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
|
@ -780,22 +779,14 @@ class ApiController extends Zend_Controller_Action
|
||||||
Application_Model_ServiceRegister::Register($component, $remoteAddr);
|
Application_Model_ServiceRegister::Register($component, $remoteAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateLiquidsoapErrorAction(){
|
public function updateLiquidsoapStatusAction(){
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
$error_msg = $request->getParam('error_msg');
|
$msg = $request->getParam('msg');
|
||||||
$stream_id = $request->getParam('stream_id');
|
$stream_id = $request->getParam('stream_id');
|
||||||
$boot_time = $request->getParam('boot_time');
|
$boot_time = $request->getParam('boot_time');
|
||||||
Application_Model_StreamSetting::setLiquidsoapError($stream_id, $error_msg, $boot_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function updateLiquidsoapConnectionAction(){
|
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
$stream_id = $request->getParam('stream_id');
|
Application_Model_StreamSetting::setLiquidsoapError($stream_id, $msg, $boot_time);
|
||||||
$boot_time = $request->getParam('boot_time');
|
|
||||||
// setting error_msg as "" when there is no error_msg
|
|
||||||
Application_Model_StreamSetting::setLiquidsoapError($stream_id, "OK", $boot_time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -133,6 +133,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js','text/javascript');
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js','text/javascript');
|
||||||
|
|
||||||
// get current settings
|
// get current settings
|
||||||
$temp = Application_Model_StreamSetting::getStreamSetting();
|
$temp = Application_Model_StreamSetting::getStreamSetting();
|
||||||
|
|
|
@ -7,7 +7,9 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract
|
||||||
if (Application_Model_RabbitMq::$doPush) {
|
if (Application_Model_RabbitMq::$doPush) {
|
||||||
$md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists());
|
$md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists());
|
||||||
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
|
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
|
||||||
Application_Model_RabbitMq::SendMessageToShowRecorder("update_schedule");
|
if (!isset($_SERVER['AIRTIME_SRV'])){
|
||||||
|
Application_Model_RabbitMq::SendMessageToShowRecorder("update_schedule");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,10 @@ class Application_Form_StreamSetting extends Zend_Form
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isValid($data){
|
public function isValid($data){
|
||||||
$this->populate(array("output_sound_device"=>$data['output_sound_device'], "icecast_vorbis_metadata"=>$data['icecast_vorbis_metadata'],
|
if($data['output_sound_device']){
|
||||||
|
$this->populate(array("output_sound_device"=>$data['output_sound_device'], "icecast_vorbis_metadata"=>$data['icecast_vorbis_metadata'],
|
||||||
"output_sound_device_type"=>$data['output_sound_device_type'], "streamFormat"=>$data['streamFormat']));
|
"output_sound_device_type"=>$data['output_sound_device_type'], "streamFormat"=>$data['streamFormat']));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,10 +83,13 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$host = new Zend_Form_Element_Text('host');
|
$host = new Zend_Form_Element_Text('host');
|
||||||
$host->setLabel("Server")
|
$host->setLabel("Server")
|
||||||
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
|
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
|
||||||
|
->setValidators(array(
|
||||||
|
array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if($disable_all){
|
||||||
$host->setAttrib("disabled", "disabled");
|
$host->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
|
$host->setAttrib('alt', 'domain');
|
||||||
$this->addElement($host);
|
$this->addElement($host);
|
||||||
|
|
||||||
$port = new Zend_Form_Element_Text('port');
|
$port = new Zend_Form_Element_Text('port');
|
||||||
|
@ -103,10 +106,13 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$pass = new Zend_Form_Element_Text('pass');
|
$pass = new Zend_Form_Element_Text('pass');
|
||||||
$pass->setLabel("Password")
|
$pass->setLabel("Password")
|
||||||
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
|
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
|
||||||
|
->setValidators(array(
|
||||||
|
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if($disable_all){
|
||||||
$pass->setAttrib("disabled", "disabled");
|
$pass->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
|
$pass->setAttrib('alt', 'regular_text');
|
||||||
$this->addElement($pass);
|
$this->addElement($pass);
|
||||||
|
|
||||||
$genre = new Zend_Form_Element_Text('genre');
|
$genre = new Zend_Form_Element_Text('genre');
|
||||||
|
@ -121,10 +127,13 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$url = new Zend_Form_Element_Text('url');
|
$url = new Zend_Form_Element_Text('url');
|
||||||
$url->setLabel("URL")
|
$url->setLabel("URL")
|
||||||
->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"")
|
->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"")
|
||||||
|
->setValidators(array(
|
||||||
|
array('regex', false, array('/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if($disable_all){
|
||||||
$url->setAttrib("disabled", "disabled");
|
$url->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
|
$url->setAttrib('alt', 'url');
|
||||||
$this->addElement($url);
|
$this->addElement($url);
|
||||||
|
|
||||||
$description = new Zend_Form_Element_Text('description');
|
$description = new Zend_Form_Element_Text('description');
|
||||||
|
@ -139,19 +148,25 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$mount = new Zend_Form_Element_Text('mount');
|
$mount = new Zend_Form_Element_Text('mount');
|
||||||
$mount->setLabel("Mount Point")
|
$mount->setLabel("Mount Point")
|
||||||
->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"")
|
->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"")
|
||||||
|
->setValidators(array(
|
||||||
|
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if($disable_all){
|
||||||
$mount->setAttrib("disabled", "disabled");
|
$mount->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
|
$mount->setAttrib('alt', 'regular_text');
|
||||||
$this->addElement($mount);
|
$this->addElement($mount);
|
||||||
|
|
||||||
$user = new Zend_Form_Element_Text('user');
|
$user = new Zend_Form_Element_Text('user');
|
||||||
$user->setLabel("Username")
|
$user->setLabel("Username")
|
||||||
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
|
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
|
||||||
|
->setValidators(array(
|
||||||
|
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if($disable_all){
|
||||||
$user->setAttrib("disabled", "disabled");
|
$user->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
|
$user->setAttrib('alt', 'regular_text');
|
||||||
$this->addElement($user);
|
$this->addElement($user);
|
||||||
|
|
||||||
$liquidsopa_error_msg = '<div class="stream-status status-info"><h3>Getting information from the server...</h3></div>';
|
$liquidsopa_error_msg = '<div class="stream-status status-info"><h3>Getting information from the server...</h3></div>';
|
||||||
|
|
|
@ -409,11 +409,13 @@ class Application_Model_StoredFile {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFilePath()
|
public function getFilePath()
|
||||||
{
|
{
|
||||||
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
|
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
|
||||||
|
$directory = $music_dir->getDirectory();
|
||||||
|
|
||||||
$filepath = $this->_file->getDbFilepath();
|
$filepath = $this->_file->getDbFilepath();
|
||||||
|
|
||||||
return $music_dir->getDirectory().$filepath;
|
return $directory.$filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -877,8 +879,13 @@ class Application_Model_StoredFile {
|
||||||
|
|
||||||
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
||||||
|
|
||||||
$r = @copy($audio_file, $audio_stor);
|
Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
|
||||||
$r = @unlink($audio_file);
|
|
||||||
|
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
|
||||||
|
$r = @rename($audio_file, $audio_stor);
|
||||||
|
|
||||||
|
//$r = @copy($audio_file, $audio_stor);
|
||||||
|
//$r = @unlink($audio_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFileCount()
|
public static function getFileCount()
|
||||||
|
|
|
@ -174,5 +174,18 @@ $(document).ready(function() {
|
||||||
|
|
||||||
showErrorSections()
|
showErrorSections()
|
||||||
setInterval('checkLiquidsoapStatus()', 1000)
|
setInterval('checkLiquidsoapStatus()', 1000)
|
||||||
|
$.mask.rules = {
|
||||||
|
'@': /[^ &<>]/,
|
||||||
|
'u': /[0-9a-zA-Z-_.:/]/,
|
||||||
|
'd': /[0-9a-zA-Z-_.]/
|
||||||
|
}
|
||||||
|
// add masking on the fields that don't allow special chars
|
||||||
|
|
||||||
|
$.mask.masks = $.extend($.mask.masks,{
|
||||||
|
regular_text:{ mask: '@', type:'repeat', 'maxLength': 256, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),:/]'},
|
||||||
|
url:{ mask: 'u', type:'repeat', 'maxLength': 261, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),]'},
|
||||||
|
domain:{ mask: 'd', type:'repeat', 'maxLength': 261, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),:/]'}
|
||||||
|
})
|
||||||
|
$('input:text').setMask()
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,16 +17,17 @@ fi
|
||||||
|
|
||||||
showhelp () {
|
showhelp () {
|
||||||
echo "Usage: airtime-install [options]
|
echo "Usage: airtime-install [options]
|
||||||
--help|-h Displays usage information.
|
--help|-h Displays usage information.
|
||||||
--overwrite|-o Overwrite any existing config files.
|
--overwrite|-o Overwrite any existing config files.
|
||||||
--preserve|-p Keep any existing config files.
|
--preserve|-p Keep any existing config files.
|
||||||
--no-db|-n Turn off database install.
|
--no-db|-n Turn off database install.
|
||||||
--reinstall|-r Force a fresh install of this Airtime Version
|
--reinstall|-r Force a fresh install of this Airtime Version
|
||||||
--media-monitor|-m Install only media-monitor
|
--media-monitor|-m Install only media-monitor
|
||||||
--pypo|-p Install only pypo and liquidsoap
|
--pypo|-p Install only pypo and liquidsoap
|
||||||
--show-recorder|-s Install only show-recorder
|
--show-recorder|-s Install only show-recorder
|
||||||
--web|-w Install only files for web-server
|
--web|-w Install only files for web-server
|
||||||
--liquidsoap-keep-alive|-l Keep Liquidsoap alive when upgrading"
|
--liquidsoap-keep-alive|-l Keep Liquidsoap alive when upgrading
|
||||||
|
--disable-auto-start-services|-d Disable auto-starting Airtime services"
|
||||||
}
|
}
|
||||||
|
|
||||||
overwrite="f"
|
overwrite="f"
|
||||||
|
@ -38,8 +39,9 @@ pypo="f"
|
||||||
showrecorder="f"
|
showrecorder="f"
|
||||||
web="f"
|
web="f"
|
||||||
liquidsoap_keep_alive="f"
|
liquidsoap_keep_alive="f"
|
||||||
|
disable_auto_start_services="f"
|
||||||
|
|
||||||
set -- $(getopt -l help,overwrite,preserve,no-db,reinstall,media-monitor,pypo,show-recorder,web,liquidsoap-keep-alive "hopnrmyswl" "$@")
|
set -- $(getopt -l help,overwrite,preserve,no-db,reinstall,media-monitor,pypo,show-recorder,web,liquidsoap-keep-alive,disable-auto-start-services "hopnrmyswld" "$@")
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -53,6 +55,7 @@ do
|
||||||
(-s|--show-recorder) showrecorder="t";;
|
(-s|--show-recorder) showrecorder="t";;
|
||||||
(-w|--web) web="t";;
|
(-w|--web) web="t";;
|
||||||
(-l|--liquidsoap-keep-alive) liquidsoap_keep_alive="t";;
|
(-l|--liquidsoap-keep-alive) liquidsoap_keep_alive="t";;
|
||||||
|
(-d|--disable-auto-start-services) disable_auto_start_services="t";;
|
||||||
|
|
||||||
(--) shift; break;;
|
(--) shift; break;;
|
||||||
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
|
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
|
||||||
|
@ -107,6 +110,7 @@ export nodb
|
||||||
export overwrite
|
export overwrite
|
||||||
export preserve
|
export preserve
|
||||||
export liquidsoap_keep_alive
|
export liquidsoap_keep_alive
|
||||||
|
export disable_auto_start_services
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
test "$mediamonitor" = "t" -o "$pypo" = "t" -o "$showrecorder" = "t"
|
test "$mediamonitor" = "t" -o "$pypo" = "t" -o "$showrecorder" = "t"
|
||||||
|
|
|
@ -53,15 +53,17 @@ sleep 1
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
if [ "$mediamonitor" = "t" ]; then
|
if [ "$disable_auto_start_services" = "f" ]; then
|
||||||
monit monitor airtime-media-monitor
|
if [ "$mediamonitor" = "t" ]; then
|
||||||
fi
|
monit monitor airtime-media-monitor
|
||||||
if [ "$pypo" = "t" ]; then
|
fi
|
||||||
monit monitor airtime-playout
|
if [ "$pypo" = "t" ]; then
|
||||||
monit monitor airtime-liquidsoap
|
monit monitor airtime-playout
|
||||||
fi
|
monit monitor airtime-liquidsoap
|
||||||
if [ "$showrecorder" = "t" ]; then
|
fi
|
||||||
monit monitor airtime-show-recorder
|
if [ "$showrecorder" = "t" ]; then
|
||||||
|
monit monitor airtime-show-recorder
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
monit monitor rabbitmq-server
|
monit monitor rabbitmq-server
|
||||||
|
|
|
@ -92,11 +92,8 @@ generate_range_url = 'generate_range_dp.php'
|
||||||
# URL to tell Airtime we want to get stream setting
|
# URL to tell Airtime we want to get stream setting
|
||||||
get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/'
|
get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/'
|
||||||
|
|
||||||
#URL to update liquidsoap error msg
|
#URL to update liquidsoap status
|
||||||
update_liquidsoap_error = 'update-liquidsoap-error/format/json/api_key/%%api_key%%/error_msg/%%error_msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%'
|
update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%'
|
||||||
|
|
||||||
#URL to update liquidsoap connection
|
|
||||||
update_liquidsoap_connection = 'update-liquidsoap-connection/format/json/api_key/%%api_key%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%'
|
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# OBP config #
|
# OBP config #
|
||||||
|
|
|
@ -92,11 +92,8 @@ generate_range_url = 'generate_range_dp.php'
|
||||||
# URL to tell Airtime we want to get stream setting
|
# URL to tell Airtime we want to get stream setting
|
||||||
get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/'
|
get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/'
|
||||||
|
|
||||||
#URL to update liquidsoap error msg
|
#URL to update liquidsoap status
|
||||||
update_liquidsoap_error = 'update-liquidsoap-error/format/json/api_key/%%api_key%%/error_msg/%%error_msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%'
|
update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%'
|
||||||
|
|
||||||
#URL to update liquidsoap connection
|
|
||||||
update_liquidsoap_connection = 'update-liquidsoap-connection/format/json/api_key/%%api_key%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%'
|
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# OBP config #
|
# OBP config #
|
||||||
|
|
|
@ -571,29 +571,15 @@ class AirTimeApiClient(ApiClientInterface):
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.error("Exception: %s", e)
|
logger.error("Exception: %s", e)
|
||||||
|
|
||||||
def notify_liquidsoap_error(self, error_msg, stream_id, time):
|
def notify_liquidsoap_status(self, msg, stream_id, time):
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
try:
|
try:
|
||||||
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_liquidsoap_error"])
|
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_liquidsoap_status"])
|
||||||
|
|
||||||
url = url.replace("%%api_key%%", self.config["api_key"])
|
|
||||||
error_msg = error_msg.replace('/', ' ')
|
|
||||||
encoded_msg = urllib.quote(error_msg, '')
|
|
||||||
url = url.replace("%%error_msg%%", encoded_msg)
|
|
||||||
url = url.replace("%%stream_id%%", stream_id)
|
|
||||||
url = url.replace("%%boot_time%%", time)
|
|
||||||
logger.debug(url)
|
|
||||||
req = urllib2.Request(url)
|
|
||||||
response = urllib2.urlopen(req).read()
|
|
||||||
except Exception, e:
|
|
||||||
logger.error("Exception: %s", e)
|
|
||||||
|
|
||||||
def notify_liquidsoap_connection(self, stream_id, time):
|
|
||||||
logger = logging.getLogger()
|
|
||||||
try:
|
|
||||||
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_liquidsoap_connection"])
|
|
||||||
|
|
||||||
url = url.replace("%%api_key%%", self.config["api_key"])
|
url = url.replace("%%api_key%%", self.config["api_key"])
|
||||||
|
msg = msg.replace('/', ' ')
|
||||||
|
encoded_msg = urllib.quote(msg, '')
|
||||||
|
url = url.replace("%%msg%%", encoded_msg)
|
||||||
url = url.replace("%%stream_id%%", stream_id)
|
url = url.replace("%%stream_id%%", stream_id)
|
||||||
url = url.replace("%%boot_time%%", time)
|
url = url.replace("%%boot_time%%", time)
|
||||||
logger.debug(url)
|
logger.debug(url)
|
||||||
|
|
|
@ -42,8 +42,9 @@ try:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#copy monit files
|
#copy monit files
|
||||||
shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
|
||||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
if os.environ["disable_auto_start_services"] == "f":
|
||||||
|
shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
|
||||||
#create log dir
|
#create log dir
|
||||||
create_dir(config['log_dir'])
|
create_dir(config['log_dir'])
|
||||||
|
|
|
@ -6,15 +6,17 @@ if os.geteuid() != 0:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
#update-rc.d init script
|
|
||||||
p = Popen("update-rc.d airtime-media-monitor defaults >/dev/null 2>&1", shell=True)
|
if os.environ["disable_auto_start_services"] == "f":
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
#update-rc.d init script
|
||||||
|
p = Popen("update-rc.d airtime-media-monitor defaults >/dev/null 2>&1", shell=True)
|
||||||
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
|
|
||||||
#Start media-monitor daemon
|
#Start media-monitor daemon
|
||||||
print "* Waiting for media-monitor processes to start..."
|
print "* Waiting for media-monitor processes to start..."
|
||||||
p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True)
|
p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True)
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
p = Popen("/etc/init.d/airtime-media-monitor start-no-monit", shell=True)
|
p = Popen("/etc/init.d/airtime-media-monitor start-no-monit", shell=True)
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
|
|
|
@ -3,8 +3,3 @@
|
||||||
|
|
||||||
set httpd port 2812
|
set httpd port 2812
|
||||||
allow admin:monit
|
allow admin:monit
|
||||||
|
|
||||||
check process rabbitmq-server
|
|
||||||
with pidfile "/var/run/rabbitmq.pid"
|
|
||||||
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; /usr/lib/airtime/utils/rabbitmq-update-pid.sh'"
|
|
||||||
stop program = "/etc/init.d/rabbitmq-server stop"
|
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
set daemon 10 # Poll at 5 second intervals
|
set daemon 10 # Poll at 5 second intervals
|
||||||
#set logfile syslog facility log_daemon
|
|
||||||
set logfile /var/log/monit.log
|
set logfile /var/log/monit.log
|
||||||
|
|
||||||
set httpd port 2812
|
|
||||||
allow admin:monit
|
|
||||||
|
|
||||||
check process rabbitmq-server
|
check process rabbitmq-server
|
||||||
with pidfile "/var/run/rabbitmq.pid"
|
with pidfile "/var/run/rabbitmq.pid"
|
||||||
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid'"
|
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; /usr/lib/airtime/utils/rabbitmq-update-pid.sh'"
|
||||||
stop program = "/etc/init.d/rabbitmq-server stop"
|
stop program = "/etc/init.d/rabbitmq-server stop"
|
||||||
|
|
|
@ -42,9 +42,11 @@ try:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#copy monit files
|
#copy monit files
|
||||||
shutil.copy('%s/../monit-airtime-playout.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
|
||||||
shutil.copy('%s/../monit-airtime-liquidsoap.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
|
||||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
shutil.copy('%s/../../monit/monit-airtime-rabbitmq-server.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
if os.environ["disable_auto_start_services"] == "f":
|
||||||
|
shutil.copy('%s/../monit-airtime-liquidsoap.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
shutil.copy('%s/../monit-airtime-playout.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
|
||||||
#create pypo log dir
|
#create pypo log dir
|
||||||
create_dir(config['pypo_log_dir'])
|
create_dir(config['pypo_log_dir'])
|
||||||
|
|
|
@ -87,10 +87,6 @@ try:
|
||||||
print "Unsupported system architecture."
|
print "Unsupported system architecture."
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#initialize init.d scripts
|
|
||||||
p = Popen("update-rc.d airtime-playout defaults >/dev/null 2>&1", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
|
||||||
|
|
||||||
#generate liquidsoap config file
|
#generate liquidsoap config file
|
||||||
#access the DB and generate liquidsoap.cfg under /etc/airtime/
|
#access the DB and generate liquidsoap.cfg under /etc/airtime/
|
||||||
ac = api_client.api_client_factory(config)
|
ac = api_client.api_client_factory(config)
|
||||||
|
@ -101,18 +97,23 @@ try:
|
||||||
else:
|
else:
|
||||||
print "Unable to connect to the Airtime server."
|
print "Unable to connect to the Airtime server."
|
||||||
|
|
||||||
#restart airtime-playout
|
if os.environ["disable_auto_start_services"] == "f":
|
||||||
print "* Waiting for pypo processes to start..."
|
#initialize init.d scripts
|
||||||
if os.environ["liquidsoap_keep_alive"] == "f":
|
p = Popen("update-rc.d airtime-playout defaults >/dev/null 2>&1", shell=True)
|
||||||
print " * Restarting any previous Liquidsoap instances"
|
|
||||||
p = Popen("/etc/init.d/airtime-playout stop", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
else:
|
|
||||||
print " * Keeping any previous Liquidsoap instances running"
|
#restart airtime-playout
|
||||||
p = Popen("/etc/init.d/airtime-playout pypo-stop", shell=True)
|
print "* Waiting for pypo processes to start..."
|
||||||
|
if os.environ["liquidsoap_keep_alive"] == "f":
|
||||||
|
print " * Restarting any previous Liquidsoap instances"
|
||||||
|
p = Popen("/etc/init.d/airtime-playout stop", shell=True)
|
||||||
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
|
else:
|
||||||
|
print " * Keeping any previous Liquidsoap instances running"
|
||||||
|
p = Popen("/etc/init.d/airtime-playout pypo-stop", shell=True)
|
||||||
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
|
p = Popen("/etc/init.d/airtime-playout start-no-monit", shell=True)
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
p = Popen("/etc/init.d/airtime-playout start-no-monit", shell=True)
|
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
|
|
|
@ -37,15 +37,17 @@ def to_live(old,new) =
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, user, s, stream) =
|
def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, user, s, stream, connected) =
|
||||||
def on_error(msg)
|
def on_error(msg)
|
||||||
system("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --error='#{msg}' --stream-id=#{stream} --time=#{time}")
|
connected := "false"
|
||||||
log("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --error='#{msg}' --stream-id=#{stream} --time=#{time}")
|
system("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --error='#{msg}' --stream-id=#{stream} --time=#{!time}")
|
||||||
|
log("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --error='#{msg}' --stream-id=#{stream} --time=#{!time}")
|
||||||
5.
|
5.
|
||||||
end
|
end
|
||||||
def on_connect()
|
def on_connect()
|
||||||
system("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --connect --stream-id=#{stream} --time=#{time}")
|
connected := "true"
|
||||||
log("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --connect --stream-id=#{stream} --time=#{time}")
|
system("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --connect --stream-id=#{stream} --time=#{!time}")
|
||||||
|
log("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --connect --stream-id=#{stream} --time=#{!time}")
|
||||||
end
|
end
|
||||||
if output_type == "icecast" then
|
if output_type == "icecast" then
|
||||||
user_ref = ref user
|
user_ref = ref user
|
||||||
|
@ -136,7 +138,8 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
|
||||||
if url == "" then
|
if url == "" then
|
||||||
url_ref := "N/A"
|
url_ref := "N/A"
|
||||||
end
|
end
|
||||||
output.shoutcast = output.shoutcast(host = host,
|
output.shoutcast = output.shoutcast(id = "shoutcast_stream_#{stream}",
|
||||||
|
host = host,
|
||||||
port = port,
|
port = port,
|
||||||
password = pass,
|
password = pass,
|
||||||
fallible = true,
|
fallible = true,
|
||||||
|
|
|
@ -6,7 +6,7 @@ set("log.stdout", true)
|
||||||
set("server.telnet", true)
|
set("server.telnet", true)
|
||||||
set("server.telnet.port", 1234)
|
set("server.telnet.port", 1234)
|
||||||
|
|
||||||
time = gettimeofday()
|
time = ref string_of(gettimeofday())
|
||||||
|
|
||||||
queue = audio_to_stereo(request.queue(id="queue", length=0.5))
|
queue = audio_to_stereo(request.queue(id="queue", length=0.5))
|
||||||
queue = cue_cut(queue)
|
queue = cue_cut(queue)
|
||||||
|
@ -17,6 +17,13 @@ stream_metadata_type = ref 0
|
||||||
station_name = ref ''
|
station_name = ref ''
|
||||||
show_name = ref ''
|
show_name = ref ''
|
||||||
|
|
||||||
|
s1_connected = ref ''
|
||||||
|
s2_connected = ref ''
|
||||||
|
s3_connected = ref ''
|
||||||
|
s1_namespace = ref ''
|
||||||
|
s2_namespace = ref ''
|
||||||
|
s3_namespace = ref ''
|
||||||
|
|
||||||
%include "ls_lib.liq"
|
%include "ls_lib.liq"
|
||||||
|
|
||||||
server.register(namespace="vars", "pypo_data", fun (s) -> begin pypo_data := s "Done" end)
|
server.register(namespace="vars", "pypo_data", fun (s) -> begin pypo_data := s "Done" end)
|
||||||
|
@ -24,6 +31,8 @@ server.register(namespace="vars", "web_stream_enabled", fun (s) -> begin web_str
|
||||||
server.register(namespace="vars", "stream_metadata_type", fun (s) -> begin stream_metadata_type := int_of_string(s) s end)
|
server.register(namespace="vars", "stream_metadata_type", fun (s) -> begin stream_metadata_type := int_of_string(s) s end)
|
||||||
server.register(namespace="vars", "show_name", fun (s) -> begin show_name := s s end)
|
server.register(namespace="vars", "show_name", fun (s) -> begin show_name := s s end)
|
||||||
server.register(namespace="vars", "station_name", fun (s) -> begin station_name := s s end)
|
server.register(namespace="vars", "station_name", fun (s) -> begin station_name := s s end)
|
||||||
|
server.register(namespace="vars", "bootup_time", fun (s) -> begin time := s s end)
|
||||||
|
server.register(namespace="streams", "connection_status", fun (s) -> begin "1:#{!s1_connected},2:#{!s2_connected},3:#{!s3_connected}" end)
|
||||||
|
|
||||||
|
|
||||||
default = amplify(0.00001, noise())
|
default = amplify(0.00001, noise())
|
||||||
|
@ -100,19 +109,34 @@ if output_sound_device then
|
||||||
end
|
end
|
||||||
|
|
||||||
if s1_enable == true then
|
if s1_enable == true then
|
||||||
#output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, s)
|
if s1_output == 'shoutcast' then
|
||||||
output_to(s1_output, s1_type, s1_bitrate, s1_host, s1_port, s1_pass, s1_mount, s1_url, s1_description, s1_genre, s1_user, s, "1")
|
s1_namespace := "shoutcast_stream_1"
|
||||||
|
else
|
||||||
|
s1_namespace := s1_mount
|
||||||
|
end
|
||||||
|
server.register(namespace=!s1_namespace, "connected", fun (s) -> begin !s1_connected end)
|
||||||
|
output_to(s1_output, s1_type, s1_bitrate, s1_host, s1_port, s1_pass, s1_mount, s1_url, s1_description, s1_genre, s1_user, s, "1", s1_connected)
|
||||||
end
|
end
|
||||||
|
|
||||||
if s2_enable == true then
|
if s2_enable == true then
|
||||||
#output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, s)
|
if s2_output == 'shoutcast' then
|
||||||
output_to(s2_output, s2_type, s2_bitrate, s2_host, s2_port, s2_pass, s2_mount, s2_url, s2_description, s2_genre, s2_user, s, "2")
|
s2_namespace := "shoutcast_stream_2"
|
||||||
|
else
|
||||||
|
s2_namespace := s2_mount
|
||||||
|
end
|
||||||
|
server.register(namespace=!s2_namespace, "connected", fun (s) -> begin !s2_connected end)
|
||||||
|
output_to(s2_output, s2_type, s2_bitrate, s2_host, s2_port, s2_pass, s2_mount, s2_url, s2_description, s2_genre, s2_user, s, "2", s2_connected)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if s3_enable == true then
|
if s3_enable == true then
|
||||||
#output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, s)
|
if s3_output == 'shoutcast' then
|
||||||
output_to(s3_output, s3_type, s3_bitrate, s3_host, s3_port, s3_pass, s3_mount, s3_url, s3_description, s3_genre, s3_user, s, "3")
|
s3_namespace := "shoutcast_stream_3"
|
||||||
|
else
|
||||||
|
s3_namespace := s3_mount
|
||||||
|
end
|
||||||
|
server.register(namespace=!s3_namespace, "connected", fun (s) -> begin !s3_connected end)
|
||||||
|
output_to(s3_output, s3_type, s3_bitrate, s3_host, s3_port, s3_pass, s3_mount, s3_url, s3_description, s3_genre, s3_user, s, "3", s3_connected)
|
||||||
end
|
end
|
||||||
|
|
||||||
ignore(output.dummy(blank()))
|
ignore(output.dummy(blank()))
|
||||||
|
|
|
@ -82,24 +82,14 @@ class Notify:
|
||||||
logger.debug("Response: "+json.dumps(response))
|
logger.debug("Response: "+json.dumps(response))
|
||||||
|
|
||||||
# @pram time: time that LS started
|
# @pram time: time that LS started
|
||||||
def notify_liquidsoap_error(self, error_msg, stream_id, time):
|
def notify_liquidsoap_status(self, msg, stream_id, time):
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
logger.debug('#################################################')
|
logger.debug('#################################################')
|
||||||
logger.debug('# Calling server to update liquidsoap error #')
|
logger.debug('# Calling server to update liquidsoap status #')
|
||||||
logger.debug('#################################################')
|
logger.debug('#################################################')
|
||||||
logger.debug('error msg = '+ str(error_msg))
|
logger.debug('msg = '+ str(msg))
|
||||||
response = self.api_client.notify_liquidsoap_error(error_msg, stream_id, time)
|
response = self.api_client.notify_liquidsoap_status(msg, stream_id, time)
|
||||||
logger.debug("Response: "+json.dumps(response))
|
|
||||||
|
|
||||||
# @pram time: time that LS started
|
|
||||||
def notify_liquidsoap_connection(self, stream_id, time):
|
|
||||||
logger = logging.getLogger()
|
|
||||||
|
|
||||||
logger.debug('#################################################')
|
|
||||||
logger.debug('# Calling server to update liquidsoap connection#')
|
|
||||||
logger.debug('#################################################')
|
|
||||||
response = self.api_client.notify_liquidsoap_connection(stream_id, time)
|
|
||||||
logger.debug("Response: "+json.dumps(response))
|
logger.debug("Response: "+json.dumps(response))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -115,13 +105,13 @@ if __name__ == '__main__':
|
||||||
if options.error and options.stream_id:
|
if options.error and options.stream_id:
|
||||||
try:
|
try:
|
||||||
n = Notify()
|
n = Notify()
|
||||||
n.notify_liquidsoap_error(options.error, options.stream_id, options.time)
|
n.notify_liquidsoap_status(options.error, options.stream_id, options.time)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
elif options.connect and options.stream_id:
|
elif options.connect and options.stream_id:
|
||||||
try:
|
try:
|
||||||
n = Notify()
|
n = Notify()
|
||||||
n.notify_liquidsoap_connection(options.stream_id, options.time)
|
n.notify_liquidsoap_status("OK", options.stream_id, options.time)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -216,6 +216,41 @@ class PypoFetch(Thread):
|
||||||
self.process_schedule(self.schedule_data, "scheduler", False)
|
self.process_schedule(self.schedule_data, "scheduler", False)
|
||||||
else:
|
else:
|
||||||
logger.info("No change detected in setting...")
|
logger.info("No change detected in setting...")
|
||||||
|
self.update_liquidsoap_connection_status()
|
||||||
|
"""
|
||||||
|
updates the status of liquidsoap connection to the streaming server
|
||||||
|
This fucntion updates the bootup time variable in liquidsoap script
|
||||||
|
"""
|
||||||
|
def update_liquidsoap_connection_status(self):
|
||||||
|
logger = logging.getLogger('fetch')
|
||||||
|
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
||||||
|
# update the boot up time of liquidsoap. Since liquidsoap is not restarting,
|
||||||
|
# we are manually adjusting the bootup time variable so the status msg will get
|
||||||
|
# updated.
|
||||||
|
current_time = time.time()
|
||||||
|
boot_up_time_command = "vars.bootup_time "+str(current_time)+"\n"
|
||||||
|
tn.write(boot_up_time_command)
|
||||||
|
tn.write("streams.connection_status\n")
|
||||||
|
tn.write('exit\n')
|
||||||
|
|
||||||
|
output = tn.read_all()
|
||||||
|
output_list = output.split("\r\n")
|
||||||
|
stream_info = output_list[2]
|
||||||
|
|
||||||
|
# streamin info is in the form of:
|
||||||
|
# eg. s1:true,2:true,3:false
|
||||||
|
streams = stream_info.split(",")
|
||||||
|
logger.info(streams)
|
||||||
|
|
||||||
|
fake_time = current_time + 1
|
||||||
|
for s in streams:
|
||||||
|
info = s.split(':')
|
||||||
|
stream_id = info[0]
|
||||||
|
status = info[1]
|
||||||
|
if(status == "true"):
|
||||||
|
self.api_client.notify_liquidsoap_status("OK", stream_id, str(fake_time))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def set_export_source(self, export_source):
|
def set_export_source(self, export_source):
|
||||||
logger = logging.getLogger('fetch')
|
logger = logging.getLogger('fetch')
|
||||||
|
|
|
@ -41,10 +41,11 @@ try:
|
||||||
print 'Error loading config file: ', e
|
print 'Error loading config file: ', e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
#copy monit files
|
#copy monit files
|
||||||
shutil.copy('%s/../monit-airtime-show-recorder.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
if os.environ["disable_auto_start_services"] == "f":
|
||||||
|
shutil.copy('%s/../monit-airtime-show-recorder.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
|
||||||
#create temporary media-storage directory
|
#create temporary media-storage directory
|
||||||
#print "Creating temporary media storage directory"
|
#print "Creating temporary media storage directory"
|
||||||
|
|
|
@ -7,15 +7,16 @@ if os.geteuid() != 0:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
#register init.d script
|
if os.environ["disable_auto_start_services"] == "f":
|
||||||
p = Popen("update-rc.d airtime-show-recorder defaults >/dev/null 2>&1", shell=True)
|
#register init.d script
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
p = Popen("update-rc.d airtime-show-recorder defaults >/dev/null 2>&1", shell=True)
|
||||||
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
#start daemon
|
|
||||||
print "* Waiting for show-recorder processes to start..."
|
#start daemon
|
||||||
p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True)
|
print "* Waiting for show-recorder processes to start..."
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True)
|
||||||
p = Popen("/etc/init.d/airtime-show-recorder start-no-monit", shell=True)
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
p = Popen("/etc/init.d/airtime-show-recorder start-no-monit", shell=True)
|
||||||
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
|
|
|
@ -79,7 +79,7 @@ if(Application_Model_Preference::GetSupportFeedback() == '1'){
|
||||||
|
|
||||||
// Get latest version from stat server and store to db
|
// Get latest version from stat server and store to db
|
||||||
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
||||||
$url = 'http://stat.sourcefabric.org/airtime_latest_version';
|
$url = 'http://stat.sourcefabric.org/airtime-stats/airtime_latest_version';
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
Loading…
Reference in New Issue