From 9c9abfab8d93675d310d247e1519db6a515b82ec Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Thu, 26 Apr 2012 10:15:30 -0400 Subject: [PATCH 1/8] CC-3704: No default checked day when creating repeat show better validation of user input --- airtime_mvc/public/js/airtime/dashboard/helperfunctions.js | 4 ++++ 1 file changed, 4 insertions(+) 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); } From 0fe4478bb5d2b7d4c2bd6b2ce44bef36836970ab Mon Sep 17 00:00:00 2001 From: James Date: Thu, 26 Apr 2012 10:56:08 -0400 Subject: [PATCH 2/8] CC-3478: Calendar->Show has some inconsistencies on special Days (e.g. switching to Daylight Saving Time) - added exception handling --- .../controllers/ScheduleController.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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(); From cf4101cdcd4caca46b6a0b5880d93ce8dc31b8df Mon Sep 17 00:00:00 2001 From: James Date: Thu, 26 Apr 2012 11:22:57 -0400 Subject: [PATCH 3/8] CC-3720: Switch order of streams in dashboard - done --- .../views/scripts/partialviews/header.phtml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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

From c9df8e8b150aa240a7a30a6f0284146a3ac9bce0 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 26 Apr 2012 11:56:14 -0400 Subject: [PATCH 4/8] CC-3722: Create loading indicator for AJAX call when calculating Show length - done --- .../views/scripts/form/add-show-when.phtml | 1 + airtime_mvc/public/css/images/loader-small.gif | Bin 0 -> 673 bytes .../public/js/airtime/schedule/add-show.js | 5 ++++- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 airtime_mvc/public/css/images/loader-small.gif 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/public/css/images/loader-small.gif b/airtime_mvc/public/css/images/loader-small.gif new file mode 100644 index 0000000000000000000000000000000000000000..d0bce1542342e912da81a2c260562df172f30d73 GIT binary patch literal 673 zcmZ?wbhEHb6krfw_{6~Q|Nnmm28Kh24mmkF0U1e2Nli^nlO|14{Lk&@8WQa67~pE8 zXTZz|lvDgC+Z`3#dv5h=E26FfcG1 zbL_hF&)}42ws10s6^G;;cE1^EoUR)U5A70}d2pLv!jVIT7j&Z~EblI3x0K*v_sV|m z0kj3v921Z^em#l`(k(o@H$3ZdDRc@9NidXDNbqrumReCGv$gd8+e8WW28HVqkJ_9i zH>s*<31KtHjANIPvi2#*6BEu%3Dak5O_t&NBI)H?V$TxT}#l{vOTn5naXTfF^&~Hhq+NX@#Ccc>y7T?;vjI&jdhsDsPJyAw*m0Qz>i}K7# zL9w50Ng{fT}A5JUe8lRK1h7_Y2;BWJDd=c6f&i?Wv5(5q?6|P zQw{>maxZP<537OA37Uk}7@%_$4o$EWe_Zl>&#id|lE-BpDC#+Fn|msJ%_2h{Hg1vP z#N8WAzfWasG}yq|xqE)DrWaOofX=z|?*pgc%{ig5vl!pqDlC|q&~Z0$&Rvsft&VO- z4MZj+%-+Vx%W}v;V76hyp=;+R;x+~t^Q%*xuFTQAF2})fSfTHDAs>sO!OBw`)&)o$ c0!CNZt))x~rAZP^^P&YOFfdqy5)K#u0POD40{{R3 literal 0 HcmV?d00001 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(); }); } } From b3816061b9687564cdc369cfc2613d46709ce61a Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Thu, 26 Apr 2012 14:46:29 -0400 Subject: [PATCH 5/8] CC-3610: Now Playing ->songs in the Now Playing do not reflect the changes affected changed END_OF_SHOW -fixed --- python_apps/pypo/pypopush.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) 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() From 88100e79ad6003c7c1dd90b8ace8f7951e5011a6 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Thu, 26 Apr 2012 15:26:07 -0400 Subject: [PATCH 6/8] CC-3725: Make it so that ON-AIR light never goes off between tracks. -fixed --- .../public/js/airtime/dashboard/playlist.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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"); } } From 773206ab22b4e41b104ce5d23241d9f5d3b059b4 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Thu, 26 Apr 2012 17:50:35 -0400 Subject: [PATCH 7/8] http://www.python.org/dev/peps/pep-0008/#package-and-module-names --- python_apps/media-monitor/airtime-media-monitor | 2 +- python_apps/media-monitor/{MediaMonitor.py => media_monitor.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename python_apps/media-monitor/{MediaMonitor.py => media_monitor.py} (100%) 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 100% rename from python_apps/media-monitor/MediaMonitor.py rename to python_apps/media-monitor/media_monitor.py From da7b87866cfc00314534bfeb64c62a8600643c64 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Thu, 26 Apr 2012 17:59:25 -0400 Subject: [PATCH 8/8] -check whether getdefaultlocale actually returns a value before attempting to use it. --- python_apps/media-monitor/media_monitor.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/python_apps/media-monitor/media_monitor.py b/python_apps/media-monitor/media_monitor.py index bcf9a0a3b..f999b791e 100644 --- a/python_apps/media-monitor/media_monitor.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)