From 867fa559a0a1654937b45ad306abf4b766a6e8b6 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 4 Sep 2012 15:10:04 -0400 Subject: [PATCH 01/10] Sexified code --- airtime_mvc/application/models/Show.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index d0cb8e9c9..643541739 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1730,17 +1730,18 @@ class Application_Model_Show { $event = array(); - $event["id"] = intval($show["instance_id"]); - $event["title"] = $show["name"]; - $event["start"] = $startDateTime->format("Y-m-d H:i:s"); - $event["startUnix"] = $startsEpoch; - $event["end"] = $endDateTime->format("Y-m-d H:i:s"); - $event["endUnix"] = $endsEpoch; - $event["allDay"] = false; - $event["showId"] = intval($show["show_id"]); - $event["record"] = intval($show["record"]); - $event["rebroadcast"] = intval($show["rebroadcast"]); - $event["soundcloud_id"] = is_null($show["soundcloud_id"]) ? -1 : $show["soundcloud_id"]; + $event["id"] = intval($show["instance_id"]); + $event["title"] = $show["name"]; + $event["start"] = $startDateTime->format("Y-m-d H:i:s"); + $event["startUnix"] = $startsEpoch; + $event["end"] = $endDateTime->format("Y-m-d H:i:s"); + $event["endUnix"] = $endsEpoch; + $event["allDay"] = false; + $event["showId"] = intval($show["show_id"]); + $event["record"] = intval($show["record"]); + $event["rebroadcast"] = intval($show["rebroadcast"]); + $event["soundcloud_id"] = is_null($show["soundcloud_id"]) + ? -1 : $show["soundcloud_id"]; //event colouring if ($show["color"] != "") { From fa5939a72fc7032a7feebe5e2768713467c1c2e8 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 4 Sep 2012 15:14:26 -0400 Subject: [PATCH 02/10] Added todo to later clean code. --- airtime_mvc/application/models/Show.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 643541739..927de61ae 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1250,6 +1250,8 @@ class Application_Model_Show */ private static function populateShow($p_showDaysRow, $p_populateUntilDateTime) { + // TODO : use constants instead of int values here? or maybe php will + // get enum types by the time somebody gets around to fix this. -- RG if ($p_showDaysRow["repeat_type"] == -1) { Application_Model_Show::populateNonRepeatingShow($p_showDaysRow, $p_populateUntilDateTime); } elseif ($p_showDaysRow["repeat_type"] == 0) { From 8c02b3ec8ad095d2e4ee2e367d3adb2c43925a4c Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 4 Sep 2012 15:14:56 -0400 Subject: [PATCH 03/10] removed redundancy --- airtime_mvc/application/models/Show.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 927de61ae..7c266b66b 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1064,8 +1064,8 @@ class Application_Model_Show $ccShow->setDbGenre($data['add_show_genre']); $ccShow->setDbColor($data['add_show_color']); $ccShow->setDbBackgroundColor($data['add_show_background_color']); - $ccShow->setDbLiveStreamUsingAirtimeAuth($data['cb_airtime_auth'] == 1?true:false); - $ccShow->setDbLiveStreamUsingCustomAuth($data['cb_custom_auth'] == 1?true:false); + $ccShow->setDbLiveStreamUsingAirtimeAuth($data['cb_airtime_auth'] == 1); + $ccShow->setDbLiveStreamUsingCustomAuth($data['cb_custom_auth'] == 1); $ccShow->setDbLiveStreamUser($data['custom_username']); $ccShow->setDbLiveStreamPass($data['custom_password']); $ccShow->save(); From 398215f1d05031667dd5360970a2182d29d9575a Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 4 Sep 2012 15:25:18 -0400 Subject: [PATCH 04/10] Corrected documentation for method. --- airtime_mvc/application/models/Show.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 7c266b66b..89be36431 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -607,7 +607,8 @@ class Application_Model_Show * Get the start date of the current show in UTC timezone. * * @return string - * The start date in the format YYYY-MM-DD + * The start date in the format YYYY-MM-DD or empty string in case + * start date could not be found */ public function getStartDateAndTime() { From 1d758db42bcd9457c5fb104012713f2d54a32ab4 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 4 Sep 2012 15:26:12 -0400 Subject: [PATCH 05/10] Sexified some code. PDO'd the shit out of some sql query. --- airtime_mvc/application/models/Show.php | 40 ++++++++++++++----------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 89be36431..ea6762060 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -615,24 +615,28 @@ class Application_Model_Show $con = Propel::getConnection(); $showId = $this->getId(); - $sql = "SELECT first_show, start_time, timezone FROM cc_show_days" - ." WHERE show_id = $showId" + $stmt = $con->prepare( + "SELECT first_show, start_time, timezone FROM cc_show_days" + ." WHERE show_id = :showId" ." ORDER BY first_show" - ." LIMIT 1"; + ." LIMIT 1"); - $query = $con->query($sql); + $stmt->bindParam(':showId', $showId); + $stmt->execute(); - if ($query->rowCount() == 0) { + //$query = $con->query($sql); + + if (!$stmt) { return ""; - } else { - $rows = $query->fetchAll(); - $row = $rows[0]; - - $dt = new DateTime($row["first_show"]." ".$row["start_time"], new DateTimeZone($row["timezone"])); - $dt->setTimezone(new DateTimeZone("UTC")); - - return $dt->format("Y-m-d H:i"); } + + $rows = $stmt->fetchAll(); + $row = $rows[0]; + + $dt = new DateTime($row["first_show"]." ".$row["start_time"], new DateTimeZone($row["timezone"])); + $dt->setTimezone(new DateTimeZone("UTC")); + + return $dt->format("Y-m-d H:i"); } /** @@ -671,12 +675,12 @@ class Application_Model_Show */ public function getEndDate() { - $startDate = $this->getStartDate(); - $startTime = $this->getStartTime(); - $duration = $this->getDuration(); + $startDate = $this->getStartDate(); + $startTime = $this->getStartTime(); + $duration = $this->getDuration(); $startDateTime = new DateTime($startDate.' '.$startTime); - $duration = explode(":", $duration); + $duration = explode(":", $duration); $endDate = $startDateTime->add(new DateInterval('PT'.$duration[0].'H'.$duration[1].'M')); @@ -878,7 +882,7 @@ class Application_Model_Show $ccShow = CcShowQuery::create()->findPK($this->_showId); $info['custom_username'] = $ccShow->getDbLiveStreamUser(); $info['cb_airtime_auth'] = $ccShow->getDbLiveStreamUsingAirtimeAuth(); - $info['cb_custom_auth'] = $ccShow->getDbLiveStreamUsingCustomAuth(); + $info['cb_custom_auth'] = $ccShow->getDbLiveStreamUsingCustomAuth(); $info['custom_username'] = $ccShow->getDbLiveStreamUser(); $info['custom_password'] = $ccShow->getDbLiveStreamPass(); From f660e1da9f256f08ee62f237e9cffe65dd87be35 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 4 Sep 2012 15:31:09 -0400 Subject: [PATCH 06/10] removed useless code --- airtime_mvc/application/models/Schedule.php | 6 +++--- airtime_mvc/application/models/Show.php | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 176c88f3c..ccb11f066 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -356,9 +356,9 @@ SQL; ." SET media_item_played=TRUE"; // we need to update 'broadcasted' column as well // check the current switch status - $live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on'?true:false; - $master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on'?true:false; - $scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') == 'on'?true:false; + $live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on'; + $master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on'; + $scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') == 'on'; if (!$live_dj && !$master_dj && $scheduled_play) { $sql .= ", broadcasted=1"; diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index ea6762060..d9c6c834c 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -475,10 +475,9 @@ class Application_Model_Show ->filterByDbShowId($this->_showId) ->findOne(); - if (!is_null($showDaysRow)) { + if (!is_null($showDaysRow)) return $showDaysRow->getDbRepeatType(); - } else - + else return -1; } From 4f4b08c0af2f2d22a52ae34d631c32f1fbdb636f Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 4 Sep 2012 15:38:48 -0400 Subject: [PATCH 07/10] major sexification --- airtime_mvc/application/models/Schedule.php | 50 ++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index ccb11f066..6699946b4 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -616,23 +616,23 @@ SQL; $temp = explode('.', Application_Model_Preference::GetDefaultTransitionFade()); // we round down transition time since PHP cannot handle millisecond. We need to // handle this better in the future - $transition_time = intval($temp[0]); + $transition_time = intval($temp[0]); $switchOffDataTime = new DateTime($kick_time, $utcTimeZone); - $switch_off_time = $switchOffDataTime->sub(new DateInterval('PT'.$transition_time.'S')); - $switch_off_time = $switch_off_time->format("Y-m-d H:i:s"); + $switch_off_time = $switchOffDataTime->sub(new DateInterval('PT'.$transition_time.'S')); + $switch_off_time = $switch_off_time->format("Y-m-d H:i:s"); $kick_start = Application_Model_Schedule::AirtimeTimeToPypoTime($kick_time); - $data["media"][$kick_start]['start'] = $kick_start; - $data["media"][$kick_start]['end'] = $kick_start; - $data["media"][$kick_start]['event_type'] = "kick_out"; - $data["media"][$kick_start]['type'] = "event"; + $data["media"][$kick_start]['start'] = $kick_start; + $data["media"][$kick_start]['end'] = $kick_start; + $data["media"][$kick_start]['event_type'] = "kick_out"; + $data["media"][$kick_start]['type'] = "event"; $data["media"][$kick_start]['independent_event'] = true; if ($kick_time !== $switch_off_time) { $switch_start = Application_Model_Schedule::AirtimeTimeToPypoTime($switch_off_time); - $data["media"][$switch_start]['start'] = $switch_start; - $data["media"][$switch_start]['end'] = $switch_start; - $data["media"][$switch_start]['event_type'] = "switch_off"; + $data["media"][$switch_start]['start'] = $switch_start; + $data["media"][$switch_start]['end'] = $switch_start; + $data["media"][$switch_start]['event_type'] = "switch_off"; $data["media"][$switch_start]['independent_event'] = true; } } @@ -757,12 +757,12 @@ SQL; { $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; - $formWhat = new Application_Form_AddShowWhat(); - $formWho = new Application_Form_AddShowWho(); - $formWhen = new Application_Form_AddShowWhen(); + $formWhat = new Application_Form_AddShowWhat(); + $formWho = new Application_Form_AddShowWho(); + $formWhen = new Application_Form_AddShowWhen(); $formRepeats = new Application_Form_AddShowRepeats(); - $formStyle = new Application_Form_AddShowStyle(); - $formLive = new Application_Form_AddShowLiveStream(); + $formStyle = new Application_Form_AddShowStyle(); + $formLive = new Application_Form_AddShowLiveStream(); $formWhat->removeDecorator('DtDdWrapper'); $formWho->removeDecorator('DtDdWrapper'); @@ -813,12 +813,12 @@ SQL; { $isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled'); - $formWhat = new Application_Form_AddShowWhat(); - $formWhen = new Application_Form_AddShowWhen(); + $formWhat = new Application_Form_AddShowWhat(); + $formWhen = new Application_Form_AddShowWhen(); $formRepeats = new Application_Form_AddShowRepeats(); - $formWho = new Application_Form_AddShowWho(); - $formStyle = new Application_Form_AddShowStyle(); - $formLive = new Application_Form_AddShowLiveStream(); + $formWho = new Application_Form_AddShowWho(); + $formStyle = new Application_Form_AddShowStyle(); + $formLive = new Application_Form_AddShowLiveStream(); $formWhat->removeDecorator('DtDdWrapper'); $formWhen->removeDecorator('DtDdWrapper'); @@ -898,12 +898,12 @@ SQL; $isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled'); $record = false; - $formWhat = new Application_Form_AddShowWhat(); - $formWho = new Application_Form_AddShowWho(); - $formWhen = new Application_Form_AddShowWhen(); + $formWhat = new Application_Form_AddShowWhat(); + $formWho = new Application_Form_AddShowWho(); + $formWhen = new Application_Form_AddShowWhen(); $formRepeats = new Application_Form_AddShowRepeats(); - $formStyle = new Application_Form_AddShowStyle(); - $formLive = new Application_Form_AddShowLiveStream(); + $formStyle = new Application_Form_AddShowStyle(); + $formLive = new Application_Form_AddShowLiveStream(); $formWhat->removeDecorator('DtDdWrapper'); $formWho->removeDecorator('DtDdWrapper'); From 9701614087d0bbefe2b97541155bd60d5440dc1c Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 4 Sep 2012 16:00:12 -0400 Subject: [PATCH 08/10] CC-4342: Enabling hardware audio output kills all stream output -fixed --- airtime_mvc/application/models/StreamSetting.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/models/StreamSetting.php b/airtime_mvc/application/models/StreamSetting.php index 2ffe7b829..c17b1ef92 100644 --- a/airtime_mvc/application/models/StreamSetting.php +++ b/airtime_mvc/application/models/StreamSetting.php @@ -175,15 +175,13 @@ class Application_Model_StreamSetting */ public static function setStreamSetting($data) { - $con = Propel::getConnection(); - foreach ($data as $key => $d) { if ($key == "output_sound_device" || $key == "icecast_vorbis_metadata") { - $v = $d == 1?"true":"false"; + $v = ($d == 1) ? "true" : "false"; self::saveStreamSetting($key, $v); } elseif ($key == "output_sound_device_type") { - self::saveStreamSetting($key, $v); + self::saveStreamSetting($key, $d); } elseif (is_array($d)) { $temp = explode('_', $key); $prefix = $temp[0]; From 4b09d5eff2d53de9545f3b585417c1c222940270 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 4 Sep 2012 16:15:07 -0400 Subject: [PATCH 09/10] CC-4199: Webstream: Please show warning when the URL is too long -upped max webstream length to 512 -show warning if > 512 characters --- airtime_mvc/application/models/Webstream.php | 3 +++ airtime_mvc/build/schema.xml | 2 +- install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/Webstream.php b/airtime_mvc/application/models/Webstream.php index 476ee5490..8c74dca5a 100644 --- a/airtime_mvc/application/models/Webstream.php +++ b/airtime_mvc/application/models/Webstream.php @@ -168,6 +168,9 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable if ($result == 0) { $valid['url'][0] = false; $valid['url'][1] = 'URL should be of form "http://domain"'; + } elseif (strlen($url) > 512) { + $valid['url'][0] = false; + $valid['url'][1] = 'URL should be 512 characters or less'; } else { try { diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 844452866..b03e14011 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -420,7 +420,7 @@ - + diff --git a/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql b/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql index aad2502f3..c2f8ba70b 100644 --- a/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql +++ b/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql @@ -95,7 +95,7 @@ CREATE TABLE cc_webstream ( id integer DEFAULT nextval('cc_webstream_id_seq'::regclass) NOT NULL, name character varying(255) NOT NULL, description character varying(255) NOT NULL, - url character varying(255) NOT NULL, + url character varying(512) NOT NULL, length interval DEFAULT '00:00:00'::interval NOT NULL, creator_id integer NOT NULL, mtime timestamp(6) without time zone NOT NULL, From 122bfc6e97a9eeea2c274336f07625c82afcf850 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 4 Sep 2012 16:25:05 -0400 Subject: [PATCH 10/10] CC-4070: Built-in help text is wrongly worded about adding files -fixed --- airtime_mvc/application/views/scripts/dashboard/help.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/views/scripts/dashboard/help.phtml b/airtime_mvc/application/views/scripts/dashboard/help.phtml index e6a4c4824..0ac5f80dc 100644 --- a/airtime_mvc/application/views/scripts/dashboard/help.phtml +++ b/airtime_mvc/application/views/scripts/dashboard/help.phtml @@ -4,7 +4,7 @@

Here's how you can get started using Airtime to automate your broadcasts:

    -
  1. Add your files to the library using the "Add Media" button. You can drag and drop your files to this window too.
  2. +
  3. Begin by adding your files to the library using the "Add Media" menu button. You can drag and drop your files to this window too.
  4. Create a show by going to "Calendar" in the menu bar, and then clicking the "+ Show" icon. This can be either a one-time or repeating show. Only admins and program managers can add shows.
  5. Add media to the show by going to your show in the Schedule calendar, left-clicking on it and selecting "Add / Remove Content".
  6. Select your media from the left pane and drag them to your show in the right pane.