diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php
index e97b2d7fc..9ce53ca02 100644
--- a/airtime_mvc/application/controllers/ScheduleController.php
+++ b/airtime_mvc/application/controllers/ScheduleController.php
@@ -900,15 +900,19 @@ class ScheduleController extends Zend_Controller_Action
$startParam = $this->_getParam('startTime');
$endParam = $this->_getParam('endTime');
- $startDateTime = new DateTime($startParam);
- $endDateTime = new DateTime($endParam);
+ try{
+ $startDateTime = new DateTime($startParam);
+ $endDateTime = new DateTime($endParam);
- $UTCStartDateTime = $startDateTime->setTimezone(new DateTimeZone('UTC'));
- $UTCEndDateTime = $endDateTime->setTimezone(new DateTimeZone('UTC'));
+ $UTCStartDateTime = $startDateTime->setTimezone(new DateTimeZone('UTC'));
+ $UTCEndDateTime = $endDateTime->setTimezone(new DateTimeZone('UTC'));
- $duration = $UTCEndDateTime->diff($UTCStartDateTime);
+ $duration = $UTCEndDateTime->diff($UTCStartDateTime);
- $result = $duration->format('%r%Hh %Im');
+ $result = $duration->format('%r%Hh %Im');
+ }catch (Exception $e){
+ $result = "Invalid Date";
+ }
echo Zend_Json::encode($result);
exit();
diff --git a/airtime_mvc/application/views/scripts/form/add-show-when.phtml b/airtime_mvc/application/views/scripts/form/add-show-when.phtml
index 6f3591ac6..124aebee3 100644
--- a/airtime_mvc/application/views/scripts/form/add-show-when.phtml
+++ b/airtime_mvc/application/views/scripts/form/add-show-when.phtml
@@ -46,6 +46,7 @@
element->getElement('add_show_duration') ?>
+
element->getElement('add_show_duration')->hasErrors()){ ?>
diff --git a/airtime_mvc/application/views/scripts/partialviews/header.phtml b/airtime_mvc/application/views/scripts/partialviews/header.phtml
index 5e427d670..af6ae2b86 100644
--- a/airtime_mvc/application/views/scripts/partialviews/header.phtml
+++ b/airtime_mvc/application/views/scripts/partialviews/header.phtml
@@ -24,9 +24,12 @@
Source Streams
diff --git a/airtime_mvc/public/css/images/loader-small.gif b/airtime_mvc/public/css/images/loader-small.gif
new file mode 100644
index 000000000..d0bce1542
Binary files /dev/null and b/airtime_mvc/public/css/images/loader-small.gif differ
diff --git a/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js b/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js
index 58b3ff5bb..37afa167f 100644
--- a/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js
+++ b/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js
@@ -24,6 +24,10 @@ function getDateFromString(time){
var month = parseInt(date[1], 10) -1;
var day = parseInt(date[2], 10);
+ if (isNaN(year) || isNaN(month) || isNaN(day)){
+ return null;
+ }
+
return new Date(year, month, day);
}
diff --git a/airtime_mvc/public/js/airtime/dashboard/playlist.js b/airtime_mvc/public/js/airtime/dashboard/playlist.js
index c3b796da8..c61254857 100644
--- a/airtime_mvc/public/js/airtime/dashboard/playlist.js
+++ b/airtime_mvc/public/js/airtime/dashboard/playlist.js
@@ -20,6 +20,11 @@ var live_dj_on_air = false;
var scheduled_play_on_air = false;
var scheduled_play_source = false;
+//keep track of how many UI refreshes the ON-AIR light has been off for.
+//For example, the uiUpdateInterval is every 200ms, so if onAirOffIterations
+//is 25, then that means 5 seconds have gone by.
+var onAirOffIterations = 0;
+
//var timezoneOffset = 0;
//set to "development" if we are developing :). Useful to disable alerts
@@ -326,9 +331,16 @@ function parseSwitchStatus(obj){
}
function controlOnAirLight(){
- if((scheduled_play_on_air && scheduled_play_source)|| live_dj_on_air || master_dj_on_air){
+ if ((scheduled_play_on_air && scheduled_play_source) || live_dj_on_air || master_dj_on_air) {
$('#on-air-info').attr("class", "on-air-info on");
- }else{
+ onAirOffIterations = 0;
+ } else if (onAirOffIterations < 15) {
+ //if less than 3 seconds have gone by (< 15 executions of this function)
+ //then keep the ON-AIR light on. Only after at least 3 seconds have gone by,
+ //should we be allowed to turn it off. This is to stop the light from temporarily turning
+ //off between tracks: CC-3725
+ onAirOffIterations++;
+ } else {
$('#on-air-info').attr("class", "on-air-info off");
}
}
diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js
index e7cd05b96..f784e6ce1 100644
--- a/airtime_mvc/public/js/airtime/schedule/add-show.js
+++ b/airtime_mvc/public/js/airtime/schedule/add-show.js
@@ -460,9 +460,12 @@ function setAddShowEvents() {
})
function calculateDuration(endDateTime, startDateTime){
- var duration;
+ var loadingIcon = $('#icon-loader-small');
+
+ loadingIcon.show();
$.post("/Schedule/calculate-duration", {startTime: startDateTime, endTime: endDateTime}, function(data){
$('#add_show_duration').val(JSON.parse(data));
+ loadingIcon.hide();
});
}
}
diff --git a/python_apps/media-monitor/airtime-media-monitor b/python_apps/media-monitor/airtime-media-monitor
index a02f11735..35d2080d0 100755
--- a/python_apps/media-monitor/airtime-media-monitor
+++ b/python_apps/media-monitor/airtime-media-monitor
@@ -6,7 +6,7 @@ virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
. ${virtualenv_bin}activate
media_monitor_path="/usr/lib/airtime/media-monitor/"
-media_monitor_script="MediaMonitor.py"
+media_monitor_script="media_monitor.py"
api_client_path="/usr/lib/airtime/"
diff --git a/python_apps/media-monitor/MediaMonitor.py b/python_apps/media-monitor/media_monitor.py
similarity index 90%
rename from python_apps/media-monitor/MediaMonitor.py
rename to python_apps/media-monitor/media_monitor.py
index bcf9a0a3b..f999b791e 100644
--- a/python_apps/media-monitor/MediaMonitor.py
+++ b/python_apps/media-monitor/media_monitor.py
@@ -41,12 +41,15 @@ logger.info("\n\n*** Media Monitor bootup ***\n\n")
try:
- fs_encoding = locale.getdefaultlocale()[1].lower()
- if fs_encoding not in ['utf-8', 'utf8']:
- logger.error("Filesystem encoding needs to be UTF-8. Currently '%s'. Exiting..." % fs_encoding)
- sys.exit(1)
+ fs_encoding = locale.getdefaultlocale()[1]
+ if fs_encoding is not None:
+ if fs_encoding not in ['utf-8', 'utf8']:
+ logger.error("Filesystem encoding needs to be UTF-8. Currently '%s'. Exiting..." % fs_encoding)
+ sys.exit(1)
+ else:
+ logger.debug("Filesystem encoding: '%s'" % fs_encoding)
else:
- logger.debug("Filesystem encoding: '%s'" % fs_encoding)
+ logger.debug("Unknown encoding")
config = AirtimeMediaConfig(logger)
diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py
index c6063e9d6..0b66e7a08 100644
--- a/python_apps/pypo/pypopush.py
+++ b/python_apps/pypo/pypopush.py
@@ -73,7 +73,7 @@ class PypoPush(Thread):
if len(current_event_chain) > 0 and len(liquidsoap_queue_approx) == 0:
#Something is scheduled but Liquidsoap is not playing anything!
#Need to schedule it immediately..this might happen if Liquidsoap crashed.
- self.modify_cue_point_of_first_link(current_event_chain)
+ self.modify_cue_point(current_event_chain[0])
next_media_item_chain = current_event_chain
time_until_next_play = 0
else:
@@ -176,8 +176,11 @@ class PypoPush(Thread):
if problem_at_iteration is not None:
self.logger.debug("Change in chain at link %s", problem_at_iteration)
- #self.modify_cue_point_of_first_link(media_chain)
- self.push_to_liquidsoap(media_chain[problem_at_iteration:])
+
+ chain_to_push = media_chain[problem_at_iteration:]
+ if len(chain_to_push) > 0:
+ self.modify_cue_point(chain_to_push[0])
+ self.push_to_liquidsoap(chain_to_push)
"""
Compare whats in the liquidsoap_queue to the new schedule we just
@@ -246,24 +249,19 @@ class PypoPush(Thread):
return chains
- def modify_cue_point_of_first_link(self, chain):
+ def modify_cue_point(self, link):
tnow = datetime.utcnow()
- link = chain[0]
link_start = datetime.strptime(link['start'], "%Y-%m-%d-%H-%M-%S")
diff_td = tnow - link_start
- diff_sec = self.convert_timedelta_to_seconds(diff_td)
+ diff_sec = self.date_interval_to_seconds(diff_td)
if diff_sec > 0:
self.logger.debug("media item was supposed to start %s ago. Preparing to start..", diff_sec)
original_cue_in_td = timedelta(seconds=float(link['cue_in']))
- link['cue_in'] = self.convert_timedelta_to_seconds(original_cue_in_td) + diff_sec
-
-
- def convert_timedelta_to_seconds(self, td):
- return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
-
+ link['cue_in'] = self.date_interval_to_seconds(original_cue_in_td) + diff_sec
+
def get_current_chain(self, chains):
tnow = datetime.utcnow()