diff --git a/airtime_mvc/application/controllers/NowplayingController.php b/airtime_mvc/application/controllers/NowplayingController.php index 0cf0a3850..39841ab78 100644 --- a/airtime_mvc/application/controllers/NowplayingController.php +++ b/airtime_mvc/application/controllers/NowplayingController.php @@ -18,7 +18,11 @@ class NowplayingController extends Zend_Controller_Action $baseUrl = $request->getBaseUrl(); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js','text/javascript'); + + //nowplayingdatagrid.js requires this variable, so that datePicker widget can be offset to server time instead of client time + $this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds"); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js','text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowview.js','text/javascript'); $refer_sses = new Zend_Session_Namespace('referrer'); @@ -104,7 +108,11 @@ class NowplayingController extends Zend_Controller_Action $baseUrl = $request->getBaseUrl(); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js','text/javascript'); + + //nowplayingdatagrid.js requires this variable, so that datePicker widget can be offset to server time instead of client time + $this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds"); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js','text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/dayview.js','text/javascript'); } diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index bf81e44af..ec846c52e 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -199,7 +199,6 @@ class PreferenceController extends Zend_Controller_Action $values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata'); } - var_dump($form->getValue('icecast_vorbis_metadata')); if(!$error){ Application_Model_StreamSetting::setStreamSetting($values); $data = array(); diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index cd31e75bb..1e3d2b896 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -46,8 +46,12 @@ class ScheduleController extends Zend_Controller_Action $this->view->headScript()->appendFile($baseUrl.'/js/fullcalendar/fullcalendar.js','text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker-0.0.6.js','text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/colorpicker/js/colorpicker.js','text/javascript'); + + //full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time + $this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds"); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/full-calendar-functions.js','text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js','text/javascript'); + + $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js','text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js','text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js','text/javascript'); diff --git a/airtime_mvc/application/forms/StreamSetting.php b/airtime_mvc/application/forms/StreamSetting.php index fc07544a5..857e4e3a8 100644 --- a/airtime_mvc/application/forms/StreamSetting.php +++ b/airtime_mvc/application/forms/StreamSetting.php @@ -28,7 +28,7 @@ class Application_Form_StreamSetting extends Zend_Form } $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); - $icecast_vorbis_metadata->setLabel('Icecast Vorbis Meatadata') + $icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata') ->setRequired(false) ->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0) ->setDecorators(array('ViewHelper')); diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index bedc14a5b..c376ab5ce 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -178,13 +178,27 @@ class Application_Model_Show { * Sunday are removed. * * @param array p_uncheckedDays - * An array specifying which days should be removed. + * An array specifying which days should be removed. (in the local timezone) */ public function removeUncheckedDaysInstances($p_uncheckedDays) { global $CC_DBC; - - $uncheckedDaysImploded = implode(",", $p_uncheckedDays); + + //need to convert local doftw to UTC doftw (change made for 2.0 since shows are stored in UTC) + $daysRemovedUTC = array(); + + $showDays = CcShowDaysQuery::create() + ->filterByDbShowId($this->getId()) + ->find(); + foreach($showDays as $showDay) { + if (in_array($showDay->getDbDay(), $p_uncheckedDays)) { + $startDay = new DateTime("{$showDay->getDbFirstShow()} {$showDay->getDbStartTime()}", new DateTimeZone($showDay->getDbTimezone())); + $startDay->setTimezone(new DateTimeZone("UTC")); + $daysRemovedUTC[] = $startDay->format("w"); + } + } + + $uncheckedDaysImploded = implode(",", $daysRemovedUTC); $showId = $this->getId(); $timestamp = gmdate("Y-m-d H:i:s"); @@ -194,9 +208,6 @@ class Application_Model_Show { ." AND starts > TIMESTAMP '$timestamp'" ." AND show_id = $showId"; - Logging::log("sql for removing unchecked days"); - Logging::log($sql); - $CC_DBC->query($sql); } @@ -797,6 +808,7 @@ class Application_Model_Show { $daysRemoved = array_diff($showDaysArray, $p_data['add_show_day_check']); if (count($daysRemoved) > 0){ + $this->removeUncheckedDaysInstances($daysRemoved); } } diff --git a/airtime_mvc/application/models/StreamSetting.php b/airtime_mvc/application/models/StreamSetting.php index 577bab05c..d14843d8b 100644 --- a/airtime_mvc/application/models/StreamSetting.php +++ b/airtime_mvc/application/models/StreamSetting.php @@ -21,7 +21,23 @@ class Application_Model_StreamSetting { return $ids; } - + + /* Retruns only global data as array*/ + public static function getGlobalData(){ + global $CC_DBC; + $sql = "SELECT * " + ."FROM cc_stream_setting " + ."WHERE keyname IN ('output_sound_device', 'icecast_vorbis_metadata')"; + + $rows = $CC_DBC->getAll($sql); + $data = array(); + + foreach($rows as $row){ + $data[$row["keyname"]] = $row["value"]; + } + + return $data; + } /* Returns all information related to a specific stream. An example * of a stream id is 's1' or 's2'. */ public static function getStreamData($p_streamId){ @@ -66,7 +82,6 @@ class Application_Model_StreamSetting { $CC_DBC->query($sql); } else{ - var_dump($key); $temp = explode('_', $key); $prefix = $temp[0]; foreach($d as $k=>$v){ diff --git a/airtime_mvc/public/js/airtime/common/common.js b/airtime_mvc/public/js/airtime/common/common.js index 10736e837..85fe984e6 100644 --- a/airtime_mvc/public/js/airtime/common/common.js +++ b/airtime_mvc/public/js/airtime/common/common.js @@ -6,3 +6,16 @@ $(document).ready(function() { savePanelSpace: true }); }); + +function adjustDateToServerDate(date, serverTimezoneOffset){ + //date object stores time in the browser's localtime. We need to artificially shift + //it to + var timezoneOffset = date.getTimezoneOffset()*60*1000; + + date.setTime(date.getTime() + timezoneOffset + serverTimezoneOffset*1000); + + /* date object has been shifted to artificial UTC time. Now let's + * shift it to the server's timezone */ + + return date; +} diff --git a/airtime_mvc/public/js/airtime/nowplaying/nowplayingdatagrid.js b/airtime_mvc/public/js/airtime/nowplaying/nowplayingdatagrid.js index d56d5b33a..2eea84acb 100644 --- a/airtime_mvc/public/js/airtime/nowplaying/nowplayingdatagrid.js +++ b/airtime_mvc/public/js/airtime/nowplaying/nowplayingdatagrid.js @@ -204,7 +204,7 @@ $(document).ready(function() { $("#datepicker").datepicker({ onSelect: function(dateText, inst) { getData();}}); - $("#datepicker").datepicker("setDate", new Date()); + $("#datepicker").datepicker("setDate", adjustDateToServerDate(new Date(), timezoneOffset)); } else { $('#day_view').click(function(){redirect('/Nowplaying/day-view')}); } diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index 49a0c4bea..65bafc04c 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -19,11 +19,10 @@ function startDpSelect(dateText, inst) { function endDpSelect(dateText, inst) { var time, date; - + time = dateText.split("-"); date = new Date(time[0], time[1] - 1, time[2]); - //$("#add_show_start_date").datepicker( "option", "maxDate", date); if (inst.input) inst.input.trigger('change'); } @@ -32,7 +31,7 @@ function createDateInput(el, onSelect) { var date; el.datepicker({ - minDate: new Date(), + minDate: adjustDateToServerDate(new Date(), timezoneOffset), onSelect: onSelect, dateFormat: 'yy-mm-dd' }); @@ -188,7 +187,7 @@ function setAddShowEvents() { }); form.find('input[name^="add_show_rebroadcast_date_absolute"]').datepicker({ - minDate: new Date(), + minDate: adjustDateToServerDate(new Date(), timezoneOffset), dateFormat: 'yy-mm-dd' }); form.find('input[name^="add_show_rebroadcast_time"]').timepicker({ diff --git a/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js b/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js index 898144376..7910f498f 100644 --- a/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js +++ b/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js @@ -75,19 +75,6 @@ function makeTimeStamp(date){ return timestamp; } -function adjustDateToServerDate(date, serverTimezoneOffset){ - //date object stores time in the browser's localtime. We need to artificially shift - //it to - var timezoneOffset = date.getTimezoneOffset()*60*1000; - - date.setTime(date.getTime() + timezoneOffset + serverTimezoneOffset*1000); - - /* date object has been shifted to artificial UTC time. Now let's - * shift it to the server's timezone */ - - return date; -} - function pad(number, length) { var str = '' + number; while (str.length < length) { @@ -101,7 +88,7 @@ function dayClick(date, allDay, jsEvent, view) { var now, today, selected, chosenDate, chosenTime; now = adjustDateToServerDate(new Date(), serverTimezoneOffset); - + if(view.name === "month") { today = new Date(now.getFullYear(), now.getMonth(), now.getDate()); selected = new Date(date.getFullYear(), date.getMonth(), date.getDate()); diff --git a/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README b/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README index 468b1e497..ffa4294a0 100644 --- a/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README +++ b/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README @@ -50,7 +50,7 @@ martin@Thinkpad-T410:~/workspace/airtime/airtime_mvc/public/js/fullcalendar$ dif +})(jQuery); -adjustDateToServerDate() function is defined in "js/airtime/schedule/full-calendar-functions.js" +adjustDateToServerDate() function is defined in "js/airtime/common/common.js" Please make this change before updating!!! diff --git a/install_minimal/airtime-install b/install_minimal/airtime-install index 2ff047857..e4ab44793 100755 --- a/install_minimal/airtime-install +++ b/install_minimal/airtime-install @@ -7,6 +7,10 @@ if [ `whoami` != 'root' ]; then exit 1 fi +export INSTALL_PYPO=1 +export INSTALL_MEDIA_MONITOR=1 +export INSTALL_SHOW_RECORDER=1 + set +e DEB=$(dpkg -s airtime 2> /dev/null | grep Status) set -e @@ -62,13 +66,14 @@ fi $SCRIPTPATH/include/airtime-copy-files.sh $SCRIPTPATH/include/airtime-initialize.sh $@ +#deactivate virtualenv +deactivate + /usr/lib/airtime/utils/rabbitmq-update-pid.sh echo -e "\n*** Verifying your system environment, running airtime-check-system ***" sleep 10 airtime-check-system -#deactivate virtualenv -deactivate echo -e "\n******************************* Install Complete *******************************" diff --git a/install_minimal/include/airtime-copy-files.sh b/install_minimal/include/airtime-copy-files.sh index 9c22e3ed7..43349a7d9 100755 --- a/install_minimal/include/airtime-copy-files.sh +++ b/install_minimal/include/airtime-copy-files.sh @@ -39,25 +39,12 @@ if [ ! -e /etc/airtime/airtime.conf ]; then cp $AIRTIMEROOT/airtime_mvc/build/airtime.conf /etc/airtime fi -if [ ! -e /etc/airtime/api_client.cfg ]; then -cp $AIRTIMEROOT/python_apps/api_clients/api_client.cfg /etc/airtime +echo "* Creating /etc/airtime" +mkdir -p /etc/monit/conf.d/ +if [ ! -e /etc/monit/conf.d/monit-airtime-generic.cfg ]; then + cp $AIRTIMEROOT/python_apps/monit/monit-airtime-generic.cfg /etc/monit/conf.d/ fi -if [ ! -e /etc/airtime/recorder.cfg ]; then -cp $AIRTIMEROOT/python_apps/show-recorder/recorder.cfg /etc/airtime -fi - -if [ ! -e /etc/airtime/media-monitor.cfg ]; then -cp $AIRTIMEROOT/python_apps/media-monitor/media-monitor.cfg /etc/airtime -fi - -if [ ! -e /etc/airtime/pypo.cfg ]; then -cp $AIRTIMEROOT/python_apps/pypo/pypo.cfg /etc/airtime -fi - -if [ ! -e /etc/airtime/liquidsoap.cfg ]; then -cp $AIRTIMEROOT/python_apps/pypo/liquidsoap_scripts/liquidsoap.cfg /etc/airtime -fi echo "* Creating /etc/cron.d/airtime-crons" HOUR=$(($RANDOM%24)) @@ -68,11 +55,20 @@ echo "$MIN $HOUR * * * root /usr/lib/airtime/utils/phone_home_stat" > /etc/cron. #. ${virtualenv_bin}activate echo "* Creating /usr/lib/airtime" -python $AIRTIMEROOT/python_apps/api_clients/install/api_client_install.py -python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py -python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-copy-files.py -python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-copy-files.py +if [ "$INSTALL_PYPO" -eq "1" -o "$INSTALL_MEDIA_MONITOR" -eq "1" -o "$INSTALL_SHOW_RECORDER" -eq "1" ]; then + python $AIRTIMEROOT/python_apps/api_clients/install/api_client_install.py +fi + +if [ "$INSTALL_PYPO" -eq "1" ]; then + python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py +fi +if [ "$INSTALL_MEDIA_MONITOR" -eq "1" ]; then + python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-copy-files.py +fi +if [ "$INSTALL_SHOW_RECORDER" -eq "1" ]; then + python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-copy-files.py +fi cp -R $AIRTIMEROOT/utils /usr/lib/airtime echo "* Creating symbolic links in /usr/bin" diff --git a/install_minimal/include/airtime-initialize.sh b/install_minimal/include/airtime-initialize.sh index 9361e6b91..5856c805f 100755 --- a/install_minimal/include/airtime-initialize.sh +++ b/install_minimal/include/airtime-initialize.sh @@ -30,9 +30,15 @@ if [ "$DO_UPGRADE" -eq "0" ]; then fi set -e -python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py -python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-initialize.py -python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-initialize.py +if [ "$INSTALL_PYPO" -eq "1" ]; then + python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py +fi +if [ "$INSTALL_MEDIA_MONITOR" -eq "1" ]; then + python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-initialize.py +fi +if [ "$INSTALL_SHOW_RECORDER" -eq "1" ]; then + python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-initialize.py +fi # Start monit if it is not running, or restart if it is. # Need to ensure monit is running before Airtime daemons are run. This is @@ -45,9 +51,16 @@ python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-initialize.py sleep 1 set +e -monit monitor airtime-media-monitor -monit monitor airtime-liquidsoap -monit monitor airtime-playout -monit monitor airtime-show-recorder +if [ "$INSTALL_PYPO" -eq "1" ]; then + monit monitor airtime-playout + monit monitor airtime-liquidsoap +fi +if [ "$INSTALL_MEDIA_MONITOR" -eq "1" ]; then + monit monitor airtime-media-monitor +fi +if [ "$INSTALL_SHOW_RECORDER" -eq "1" ]; then + monit monitor airtime-show-recorder +fi + monit monitor rabbitmq-server set -e diff --git a/python_apps/api_clients/install/api_client_install.py b/python_apps/api_clients/install/api_client_install.py index ad31bb271..461dea372 100644 --- a/python_apps/api_clients/install/api_client_install.py +++ b/python_apps/api_clients/install/api_client_install.py @@ -12,8 +12,13 @@ def copy_dir(src_dir, dest_dir): if not (os.path.exists(dest_dir)): #print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir) shutil.copytree(src_dir, dest_dir) + +PATH_INI_FILE = '/etc/airtime/api_client.cfg' current_script_dir = get_current_script_dir() + +if not os.path.exists(PATH_INI_FILE): + shutil.copy('%s/../api_client.cfg'%current_script_dir, PATH_INI_FILE) """load config file""" try: diff --git a/python_apps/media-monitor/install/media-monitor-copy-files.py b/python_apps/media-monitor/install/media-monitor-copy-files.py index 6d0282bd4..8c083aa63 100644 --- a/python_apps/media-monitor/install/media-monitor-copy-files.py +++ b/python_apps/media-monitor/install/media-monitor-copy-files.py @@ -27,17 +27,20 @@ def create_dir(path): PATH_INI_FILE = '/etc/airtime/media-monitor.cfg' -# load config file -try: - config = ConfigObj(PATH_INI_FILE) -except Exception, e: - print 'Error loading config file: ', e - sys.exit(1) - try: # Absolute path this script is in current_script_dir = get_current_script_dir() + if not os.path.exists(PATH_INI_FILE): + shutil.copy('%s/../media-monitor.cfg'%current_script_dir, PATH_INI_FILE) + + # load config file + try: + config = ConfigObj(PATH_INI_FILE) + except Exception, e: + print 'Error loading config file: ', e + sys.exit(1) + #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/') diff --git a/python_apps/media-monitor/install/media-monitor-uninitialize.py b/python_apps/media-monitor/install/media-monitor-uninitialize.py index 0063406aa..f147673c8 100644 --- a/python_apps/media-monitor/install/media-monitor-uninitialize.py +++ b/python_apps/media-monitor/install/media-monitor-uninitialize.py @@ -8,7 +8,7 @@ if os.geteuid() != 0: try: print "Waiting for media-monitor processes to stop...", - if (os.path.exists('/etc/init.d/airtime-playout')): + if (os.path.exists('/etc/init.d/airtime-media-monitor')): p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True) sts = os.waitpid(p.pid, 0)[1] print "OK" diff --git a/python_apps/pypo/install/pypo-copy-files.py b/python_apps/pypo/install/pypo-copy-files.py index 681544a24..d0baac86a 100644 --- a/python_apps/pypo/install/pypo-copy-files.py +++ b/python_apps/pypo/install/pypo-copy-files.py @@ -27,17 +27,20 @@ def create_dir(path): PATH_INI_FILE = '/etc/airtime/pypo.cfg' -# load config file -try: - config = ConfigObj(PATH_INI_FILE) -except Exception, e: - print 'Error loading config file: ', e - sys.exit(1) - -try: +try: # Absolute path this script is in current_script_dir = get_current_script_dir() + if not os.path.exists(PATH_INI_FILE): + shutil.copy('%s/../pypo.cfg'%current_script_dir, PATH_INI_FILE) + + # load config file + try: + config = ConfigObj(PATH_INI_FILE) + except Exception, e: + print 'Error loading config file: ', e + sys.exit(1) + #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/') diff --git a/python_apps/python-virtualenv/virtualenv-install.sh b/python_apps/python-virtualenv/virtualenv-install.sh index 580c675e8..757d22008 100755 --- a/python_apps/python-virtualenv/virtualenv-install.sh +++ b/python_apps/python-virtualenv/virtualenv-install.sh @@ -38,14 +38,14 @@ echo -e "\n*** Creating Virtualenv for Airtime ***" EXTRAOPTION=$(virtualenv --help | grep extra-search-dir) if [ "$?" -eq "0" ]; then -virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv || exit 1 + virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv 2>/dev/null || exit 1 else # copy distribute-0.6.10.tar.gz to /usr/share/python-virtualenv/ # this is due to the bug in virtualenv 1.4.9 if [ -d "$VIRTUAL_ENV_SHARE" ]; then cp ${SCRIPTPATH}/3rd_party/distribute-0.6.10.tar.gz /usr/share/python-virtualenv/ fi - virtualenv --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv || exit 1 + virtualenv --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv 2>/dev/null || exit 1 fi echo -e "\n*** Installing Python Libraries ***" diff --git a/python_apps/show-recorder/install/recorder-copy-files.py b/python_apps/show-recorder/install/recorder-copy-files.py index 7765d9799..d78a22f6f 100644 --- a/python_apps/show-recorder/install/recorder-copy-files.py +++ b/python_apps/show-recorder/install/recorder-copy-files.py @@ -27,16 +27,20 @@ def create_dir(path): PATH_INI_FILE = '/etc/airtime/recorder.cfg' -# load config file -try: - config = ConfigObj(PATH_INI_FILE) -except Exception, e: - print 'Error loading config file: ', e - sys.exit(1) - try: # Absolute path this script is in current_script_dir = get_current_script_dir() + + if not os.path.exists(PATH_INI_FILE): + shutil.copy('%s/../recorder.cfg'%current_script_dir, PATH_INI_FILE) + + # load config file + try: + config = ConfigObj(PATH_INI_FILE) + except Exception, e: + print 'Error loading config file: ', e + sys.exit(1) + #copy monit files shutil.copy('%s/../monit-airtime-show-recorder.cfg'%current_script_dir, '/etc/monit/conf.d/') diff --git a/python_apps/show-recorder/install/recorder-uninitialize.py b/python_apps/show-recorder/install/recorder-uninitialize.py index 82808b159..168ff14b8 100644 --- a/python_apps/show-recorder/install/recorder-uninitialize.py +++ b/python_apps/show-recorder/install/recorder-uninitialize.py @@ -8,7 +8,7 @@ if os.geteuid() != 0: try: print "Waiting for show-recorder processes to stop...", - if (os.path.exists('/etc/init.d/airtime-playout')): + if (os.path.exists('/etc/init.d/airtime-show-recorder')): p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True) sts = os.waitpid(p.pid, 0)[1] print "OK"