From 0040f29fd209886f3bb8fd5156eb8f2aa59a3dcf Mon Sep 17 00:00:00 2001 From: James Date: Fri, 8 Jun 2012 14:57:59 -0400 Subject: [PATCH 1/9] CC-3953: Airtime will not auto query for new schedule after 1 hour if it received new messages unrelated to schedule in the meantime - fixed --- python_apps/pypo/pypofetch.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index b9c55ccec..0919115ad 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -42,6 +42,8 @@ class PypoFetch(Thread): self.fetch_queue = pypoFetch_q self.push_queue = pypoPush_q self.media_prepare_queue = media_q + self.last_update_schedule_timestamp = time.time() + self.listener_timeout = 3600 self.telnet_lock = telnet_lock @@ -78,6 +80,7 @@ class PypoFetch(Thread): self.logger.info("Handling command: " + command) if command == 'update_schedule': + self.last_update_schedule_timestamp = time.time() self.schedule_data = m['schedule'] self.process_schedule(self.schedule_data) elif command == 'update_stream_setting': @@ -98,6 +101,15 @@ class PypoFetch(Thread): elif command == 'disconnect_source': self.logger.info("disconnect_on_source show command received...") self.disconnect_source(self.logger, self.telnet_lock, m['sourcename']) + + # update timeout value + if command == 'update_schedule': + self.listener_timeout = 3600 + else: + self.listener_timeout = self.last_update_schedule_timestamp - time.time() + 3600 + if self.listener_timeout < 0: + self.listener_timeout = 0 + self.logger.info("New timeout: %s" % self.listener_timeout) except Exception, e: import traceback top = traceback.format_exc() @@ -476,7 +488,9 @@ class PypoFetch(Thread): Currently we are checking every 3600 seconds (1 hour) """ - message = self.fetch_queue.get(block=True, timeout=3600) + + + message = self.fetch_queue.get(block=True, timeout=self.listener_timeout) self.handle_message(message) except Exception, e: import traceback From 841dd298d5fdccb6fb068bd1f1d49a048b749e7e Mon Sep 17 00:00:00 2001 From: James Date: Fri, 8 Jun 2012 15:07:14 -0400 Subject: [PATCH 2/9] CC-3946: Files with upper case "MP3" extension not being imported - fixed --- .../media-monitor/airtimefilemonitor/mediamonitorcommon.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py b/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py index ac899d8d3..9cbefd28f 100644 --- a/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py +++ b/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py @@ -35,7 +35,7 @@ class MediaMonitorCommon: # if file doesn't have any extension, info[-2] throws exception # Hence, checking length of info before we do anything if(len(info) >= 2): - if(info[-2] in self.supported_file_formats): + if(info[-2].lower() in self.supported_file_formats): return True else: return False @@ -45,7 +45,7 @@ class MediaMonitorCommon: def is_audio_file(self, filename): info = filename.split(".") - if(info[-1] in self.supported_file_formats): + if(info[-1].lower() in self.supported_file_formats): return True else: return False From 1625cc6a25525e47e7b7ad5ebbc762597bc8f727 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 8 Jun 2012 15:14:30 -0400 Subject: [PATCH 3/9] CC-3948: Dashboard -> Source Info panel: Cannot turn off source if source is disconnect. - fixed --- airtime_mvc/application/controllers/DashboardController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/controllers/DashboardController.php b/airtime_mvc/application/controllers/DashboardController.php index 31d820f11..6a8c2995b 100644 --- a/airtime_mvc/application/controllers/DashboardController.php +++ b/airtime_mvc/application/controllers/DashboardController.php @@ -53,7 +53,7 @@ class DashboardController extends Zend_Controller_Action $show_id = isset($show[0]['id'])?$show[0]['id']:0; $source_connected = Application_Model_Preference::GetSourceStatus($sourcename); - if($user->canSchedule($show_id) && ($source_connected || $sourcename == 'scheduled_play')){ + if($user->canSchedule($show_id) && ($source_connected || $sourcename == 'scheduled_play' || $current_status == "on")){ $change_status_to = "on"; From 628f1518a7344378c1e08ebfc13a71645755b20e Mon Sep 17 00:00:00 2001 From: James Date: Fri, 8 Jun 2012 15:24:37 -0400 Subject: [PATCH 4/9] CC-3906: PlaylistLibrary-> user can not delete track which has been already played even after cancelling the show. - fixed --- airtime_mvc/application/models/Schedule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 338923877..c8edc4453 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -12,7 +12,7 @@ class Application_Model_Schedule { global $CC_CONFIG; $con = Propel::getConnection(); $sql = "SELECT COUNT(*) FROM ".$CC_CONFIG["scheduleTable"] - ." WHERE file_id = {$p_fileId} AND starts > NOW()"; + ." WHERE file_id = {$p_fileId} AND ends > NOW() AT TIME ZONE 'UTC'"; $count = $con->query($sql)->fetchColumn(0); if (is_numeric($count) && ($count != '0')) { return TRUE; From e661f400a453523100bff5b89a0464405068ca68 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 8 Jun 2012 15:31:45 -0400 Subject: [PATCH 5/9] CC-3950: apache log errors part2 - fixed --- airtime_mvc/application/models/Show.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 5486e6aa2..aa303f706 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1061,7 +1061,7 @@ class Application_Model_Show { //check if we are adding or updating a show, and if updating //erase all the show's future show_rebroadcast information first. - if (($data['add_show_id'] != -1) && $data['add_show_rebroadcast']){ + if (($data['add_show_id'] != -1) && isset($data['add_show_rebroadcast']) && $data['add_show_rebroadcast']){ CcShowRebroadcastQuery::create() ->filterByDbShowId($data['add_show_id']) ->delete(); From 0bae3f90380bf071d18db0ac7a8398325dff0a69 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 8 Jun 2012 16:18:27 -0400 Subject: [PATCH 6/9] CC-3949: On edit empty show, time_filled becomes null - fixed --- .../application/models/airtime/CcShowInstances.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/airtime/CcShowInstances.php b/airtime_mvc/application/models/airtime/CcShowInstances.php index 6b2812ee1..e2366cc4f 100644 --- a/airtime_mvc/application/models/airtime/CcShowInstances.php +++ b/airtime_mvc/application/models/airtime/CcShowInstances.php @@ -160,8 +160,12 @@ class CcShowInstances extends BaseCcShowInstances { * @param PropelPDO $con A connection object */ public function updateDbTimeFilled(PropelPDO $con) - { - $this->setDbTimeFilled($this->computeDbTimeFilled($con)); + { + $timefilled = $this->computeDbTimeFilled($con); + if($timefilled == null){ + $timefilled = "00:00:00"; + } + $this->setDbTimeFilled($timefilled); $this->save($con); } From 62eee61d4e0987b24dc09ce001a9ded5087e204c Mon Sep 17 00:00:00 2001 From: James Date: Fri, 8 Jun 2012 17:58:21 -0400 Subject: [PATCH 7/9] CC-3956: PHP script can enter inifinite loop - fixed --- airtime_mvc/application/models/Show.php | 80 +++++++++++++------------ 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index aa303f706..6cfe7a335 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1309,8 +1309,9 @@ class Application_Model_Show { $ccShowInstance = $show->getInstanceOnDate($utcStartDateTime); if ($ccShowInstance->getDbModifiedInstance()){ - //show instance on this date has been deleted. - continue; + //show instance on this date has been deleted. + $utcStartDateTime = self::advanceRepeatingDate($p_interval, $start, $timezone); + continue; } $newInstance = false; @@ -1342,44 +1343,48 @@ class Application_Model_Show { $showInstance->deleteRebroadcasts(); self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone); - - if ($p_interval == 'P1M'){ - /* When adding months, there is a problem if we are on January 31st and add one month with PHP. - * What ends up happening is that since February 31st doesn't exist, the date returned is - * March 3rd. For now let's ignore the day and assume we are always working with the - * first of each month, and use PHP to add 1 month to this (this will take care of rolling - * over the years 2011->2012, etc.). Then let's append the actual day, and use the php - * checkdate() function, to see if it is valid. If not, then we'll just skip this month. */ - - $startDt = new DateTime($start, new DateTimeZone($timezone)); - - /* pass in only the year and month (not the day) */ - $dt = new DateTime($startDt->format("Y-m"), new DateTimeZone($timezone)); - - /* Keep adding 1 month, until we find the next month that contains the day - * we are looking for (31st day for example) */ - do { - $dt->add(new DateInterval($p_interval)); - } while(!checkdate($dt->format("m"), $startDt->format("d"), $dt->format("Y"))); - $dt->setDate($dt->format("Y"), $dt->format("m"), $startDt->format("d")); - - $start = $dt->format("Y-m-d H:i:s"); - - $dt->setTimezone(new DateTimeZone('UTC')); - $utcStartDateTime = $dt; - } else { - $dt = new DateTime($start, new DateTimeZone($timezone)); - $dt->add(new DateInterval($p_interval)); - $start = $dt->format("Y-m-d H:i:s"); - - $dt->setTimezone(new DateTimeZone('UTC')); - $utcStartDateTime = $dt; - } + $utcStartDateTime = self::advanceRepeatingDate($p_interval, $start, $timezone); } Application_Model_Show::setNextPop($start, $show_id, $day); } + + private static function advanceRepeatingDate($p_interval, $start, $timezone){ + if ($p_interval == 'P1M'){ + /* When adding months, there is a problem if we are on January 31st and add one month with PHP. + * What ends up happening is that since February 31st doesn't exist, the date returned is + * March 3rd. For now let's ignore the day and assume we are always working with the + * first of each month, and use PHP to add 1 month to this (this will take care of rolling + * over the years 2011->2012, etc.). Then let's append the actual day, and use the php + * checkdate() function, to see if it is valid. If not, then we'll just skip this month. */ + + /* pass in only the year and month (not the day) */ + $dt = new DateTime($startDt->format("Y-m"), new DateTimeZone($timezone)); + + $dt = new DateTime($startDt->format("Y-m"), new DateTimeZone($timezone)); + + /* Keep adding 1 month, until we find the next month that contains the day + * we are looking for (31st day for example) */ + do { + $dt->add(new DateInterval($p_interval)); + } while(!checkdate($dt->format("m"), $startDt->format("d"), $dt->format("Y"))); + $dt->setDate($dt->format("Y"), $dt->format("m"), $startDt->format("d")); + + $start = $dt->format("Y-m-d H:i:s"); + + $dt->setTimezone(new DateTimeZone('UTC')); + $utcStartDateTime = $dt; + } else { + $dt = new DateTime($start, new DateTimeZone($timezone)); + $dt->add(new DateInterval($p_interval)); + $start = $dt->format("Y-m-d H:i:s"); + + $dt->setTimezone(new DateTimeZone('UTC')); + $utcStartDateTime = $dt; + } + return $utcStartDateTime; + } /* * @param $p_start @@ -1477,7 +1482,6 @@ class Application_Model_Show { //UTC DateTime object $showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil(); - //if application is requesting shows past our previous populated until date, generate shows up until this point. if (is_null($showsPopUntil) || $showsPopUntil->getTimestamp() < $end_timestamp->getTimestamp()) { Application_Model_Show::populateAllShowsInRange($showsPopUntil, $end_timestamp); @@ -1492,7 +1496,6 @@ class Application_Model_Show { LEFT JOIN cc_show_instances AS si2 ON si1.instance_id = si2.id LEFT JOIN cc_show AS show ON show.id = si1.show_id WHERE si1.modified_instance = FALSE"; - //only want shows that are starting at the time or later. $start_string = $start_timestamp->format("Y-m-d H:i:s"); $end_string = $end_timestamp->format("Y-m-d H:i:s"); @@ -1563,7 +1566,6 @@ class Application_Model_Show { //Logging::log($sql); $res = $con->query($sql)->fetchAll(); - foreach ($res as $row) { Application_Model_Show::populateShow($row, $p_endTimestamp); } @@ -1584,7 +1586,7 @@ class Application_Model_Show { $days = $interval->format('%a'); $shows = Application_Model_Show::getShows($p_start, $p_end); $nowEpoch = time(); - + foreach ($shows as $show) { $options = array(); From 16b6f094200631bfa648dfbac403435ee2a91b47 Mon Sep 17 00:00:00 2001 From: denise Date: Mon, 11 Jun 2012 14:55:26 -0400 Subject: [PATCH 8/9] CC-3959: Make default username "source" for master and show inputs -done (just added tooltip) --- .../scripts/form/add-show-live-stream.phtml | 1 + .../scripts/form/preferences_livestream.phtml | 1 + .../scripts/form/stream-setting-form.phtml | 4 +++- airtime_mvc/public/css/styles.css | 2 +- .../js/airtime/preferences/streamsetting.js | 21 +++++++++++++++++++ .../public/js/airtime/schedule/add-show.js | 20 ++++++++++++++++++ 6 files changed, 47 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/views/scripts/form/add-show-live-stream.phtml b/airtime_mvc/application/views/scripts/form/add-show-live-stream.phtml index 86272f3ce..1ce5b8459 100644 --- a/airtime_mvc/application/views/scripts/form/add-show-live-stream.phtml +++ b/airtime_mvc/application/views/scripts/form/add-show-live-stream.phtml @@ -21,6 +21,7 @@
diff --git a/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml b/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml index bb8ac4f47..dcd56fee5 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml @@ -33,6 +33,7 @@
diff --git a/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml b/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml index 23d678dc5..f61c06117 100644 --- a/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml +++ b/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml @@ -68,7 +68,9 @@
- +
element->getElement('user')?> diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index 7517bb2a0..81d165a92 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -104,7 +104,7 @@ select { line-height:16px !important; } -.airtime_auth_help_icon, .custom_auth_help_icon { +.airtime_auth_help_icon, .custom_auth_help_icon, .stream_username_help_icon { cursor: help; position: relative; display:inline-block; zoom:1; diff --git a/airtime_mvc/public/js/airtime/preferences/streamsetting.js b/airtime_mvc/public/js/airtime/preferences/streamsetting.js index 2aabd635e..759702230 100644 --- a/airtime_mvc/public/js/airtime/preferences/streamsetting.js +++ b/airtime_mvc/public/js/airtime/preferences/streamsetting.js @@ -304,4 +304,25 @@ $(document).ready(function() { at: "right center" }, }) + + $(".stream_username_help_icon").qtip({ + content: { + text: "If your live streaming client does not ask for a username, this field should be 'source'." + }, + hide: { + delay: 500, + fixed: true + }, + style: { + border: { + width: 0, + radius: 4 + }, + classes: "ui-tooltip-dark ui-tooltip-rounded" + }, + position: { + my: "left bottom", + at: "right center" + }, + }) }); diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index 017640903..e367aa2a3 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -220,6 +220,26 @@ function setAddShowEvents() { at: "right center" } }); + form.find(".stream_username_help_icon").qtip({ + content: { + text: "If your live streaming client does not ask for a username, this field should be 'source'." + }, + hide: { + delay: 500, + fixed: true + }, + style: { + border: { + width: 0, + radius: 4 + }, + classes: "ui-tooltip-dark ui-tooltip-rounded" + }, + position: { + my: "left bottom", + at: "right center" + } + }); function endDateVisibility(){ if(form.find("#add_show_no_end").is(':checked')){ From d348d21c10fbac4fde0ff0f80317575b077487c6 Mon Sep 17 00:00:00 2001 From: denise Date: Mon, 11 Jun 2012 15:08:02 -0400 Subject: [PATCH 9/9] CC-3960: Day of week text is missing from monthly Calendar view -fixed --- .../public/js/fullcalendar/AIRTIME_DEV_README_June_7_2012 | 5 ++--- airtime_mvc/public/js/fullcalendar/fullcalendar.js | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README_June_7_2012 b/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README_June_7_2012 index 1caa62b9e..1ee9f9d79 100644 --- a/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README_June_7_2012 +++ b/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README_June_7_2012 @@ -91,16 +91,15 @@ denise@denise-DX4860:~/airtime/airtime_mvc/public/js/fullcalendar$ diff -u fullc clearEvents(); } - updateCells(firstTime); -+ getOffset(); ++ getOffset(firstTime); } - - -+ function getOffset() { ++ function getOffset(firstTime) { + var timezoneOffset; + $.ajax({ url: "/Api/calendar-init/format/json", dataType:"json", success:function(data) { + timezoneOffset = data.calendarInit.timezoneOffset*1000; -+ var firstTime = !body; + updateCells(firstTime, timezoneOffset); + }, error:function(jqXHR, textStatus, errorThrown){}}); + } diff --git a/airtime_mvc/public/js/fullcalendar/fullcalendar.js b/airtime_mvc/public/js/fullcalendar/fullcalendar.js index 6604f977f..ba8c20e7a 100644 --- a/airtime_mvc/public/js/fullcalendar/fullcalendar.js +++ b/airtime_mvc/public/js/fullcalendar/fullcalendar.js @@ -2187,14 +2187,13 @@ function BasicView(element, calendar, viewName) { }else{ clearEvents(); } - getOffset(); + getOffset(firstTime); } - function getOffset() { + function getOffset(firstTime) { var timezoneOffset; $.ajax({ url: "/Api/calendar-init/format/json", dataType:"json", success:function(data) { timezoneOffset = data.calendarInit.timezoneOffset*1000; - var firstTime = !body; updateCells(firstTime, timezoneOffset); }, error:function(jqXHR, textStatus, errorThrown){}}); }