From 2924da4bd4456a72e33e6d216ecc27cb628046bd Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 30 Mar 2011 17:06:04 -0400 Subject: [PATCH 1/3] CC-1990:Widget to display schedule and "Now Playing" on any website -added internationalization support for all WADR widgets --- plugins/jquery.showinfo.js | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/plugins/jquery.showinfo.js b/plugins/jquery.showinfo.js index 87b5c1ad8..bda16ce29 100644 --- a/plugins/jquery.showinfo.js +++ b/plugins/jquery.showinfo.js @@ -4,6 +4,7 @@ var defaults = { updatePeriod: 20, //seconds sourceDomain: "http://localhost/", //where to get show status from + text: {onAirToday:"On air today"} }; var options = $.extend(defaults, options); options.sourceDomain = addEndingBackslash(options.sourceDomain); @@ -30,7 +31,7 @@ } tableString = ""; - tableString += "

On air today

"; + tableString += "

"+options.text.onAirToday+"

"; tableString += ""+ ""; @@ -41,7 +42,7 @@ tableString += "" + "" + - "" + + "" + ""; } @@ -55,10 +56,13 @@ updateWidget(); } + function airtimeScheduleJsonpError(jqXHR, textStatus, errorThrown){ + } + function getServerData(){ $.ajax({ url: options.sourceDomain + "api/live-info/", dataType:"jsonp", success:function(data){ processData(data); - }, error:function(jqXHR, textStatus, errorThrown){}}); + }, error:airtimeScheduleJsonpError}); setTimeout(getServerData, options.updatePeriod*1000); } }); @@ -72,7 +76,8 @@ var defaults = { updatePeriod: 5, //seconds sourceDomain: "http://localhost/", //where to get show status from - audioStreamSource: "http://localhost:8000/airtime.mp3" //where to get audio stream from + audioStreamSource: "http://localhost:8000/airtime.mp3", //where to get audio stream from + text: {listenLive:"Listen WADR Live", onAirNow:"On Air Now", offline:"Offline", current:"Current", next:"Next"} }; var options = $.extend(defaults, options); options.sourceDomain = addEndingBackslash(options.sourceDomain); @@ -86,7 +91,7 @@ var currentShow = sd.getCurrentShow(); var nextShows = sd.getNextShows(); - var showStatus = "Offline"; + var showStatus = options.text.offline; var currentShowName = ""; var timeElapsed = ""; var timeRemaining = ""; @@ -95,7 +100,7 @@ var nextShowRange = ""; if (currentShow.length > 0){ - showStatus = "On Air Now"; + showStatus = options.text.onAirNow; currentShowName = currentShow[0].getName(); timeElapsed = sd.getShowTimeElapsed(currentShow[0]); @@ -108,14 +113,14 @@ } obj.empty(); - obj.append("Listen WADR Live"); + obj.append(""+options.text.listenLive+""); obj.append("

"+showStatus+" >>

"); obj.append(""); //refresh the UI to update the elapsed/remaining time @@ -127,10 +132,13 @@ updateWidget(); } + function airtimeScheduleJsonpError(jqXHR, textStatus, errorThrown){ + } + function getServerData(){ $.ajax({ url: options.sourceDomain + "api/live-info/", dataType:"jsonp", success:function(data){ processData(data); - }, error:function(jqXHR, textStatus, errorThrown){}}); + }, error:airtimeScheduleJsonpError}); setTimeout(getServerData, options.updatePeriod*1000); } }); @@ -220,10 +228,13 @@ updateWidget(data); } + function airtimeScheduleJsonpError(jqXHR, textStatus, errorThrown){ + } + function getServerData(){ $.ajax({ url: options.sourceDomain + "api/week-info/", dataType:"jsonp", success:function(data){ processData(data); - }, error:function(jqXHR, textStatus, errorThrown){}}); + }, error:airtimeScheduleJsonpError}); setTimeout(getServerData, options.updatePeriod*1000); } }); From e5cbfa6ecdd3c1519dbabf98830e4f3c10577d35 Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Wed, 30 Mar 2011 17:27:14 -0400 Subject: [PATCH 2/3] Added Ofir's Calendar load test. In order to make it work, I made the following changes: Merged Playlist::Insert() into the create() function, now there is only one way to create a playlist. Renamed Show::addShow() to Show::create() to make the API like the other classes. It returns the created show ID now. Renamed Show::populateShowUntilLastGeneratedDate() to Show::populateShowUntil(), allowed it to accept a second parameter for an end date. Renamed Show::populateShowsUntil() to Show::populateAllShowsInRange(). Added documentation to a number of functions. --- .../controllers/ScheduleController.php | 4 +- application/models/Playlist.php | 51 ++--- application/models/Schedule.php | 8 +- application/models/Shows.php | 187 ++++++++++++------ application/models/tests/populator.php | 98 +++++++++ utils/upgrade-sql.php | 3 - 6 files changed, 255 insertions(+), 96 deletions(-) create mode 100644 application/models/tests/populator.php delete mode 100644 utils/upgrade-sql.php diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php index acbc7bc60..d1fa6cf90 100644 --- a/application/controllers/ScheduleController.php +++ b/application/controllers/ScheduleController.php @@ -397,8 +397,8 @@ class ScheduleController extends Zend_Controller_Action $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $user = new User($userInfo->id); - if($user->isAdmin()) { - Show::addShow($data); + if ($user->isAdmin()) { + Show::create($data); } //send back a new form for the user. diff --git a/application/models/Playlist.php b/application/models/Playlist.php index 732a142e9..826977be6 100644 --- a/application/models/Playlist.php +++ b/application/models/Playlist.php @@ -102,27 +102,9 @@ class Playlist { return $res; } - public static function Insert($p_values) + + public static function Delete($id) { - // Create the StoredPlaylist object - $storedPlaylist = new Playlist(); - $storedPlaylist->name = isset($p_values['filename']) ? $p_values['filename'] : date("H:i:s"); - $storedPlaylist->mtime = new DateTime("now"); - - $pl = new CcPlaylist(); - $pl->setDbName($storedPlaylist->name); - $pl->setDbState("incomplete"); - $pl->setDbMtime($storedPlaylist->mtime); - $pl->save(); - - $storedPlaylist->id = $pl->getDbId(); - $storedPlaylist->setState('ready'); - - return $storedPlaylist->id; - - } - - public static function Delete($id) { $pl = CcPlaylistQuery::create()->findPK($id); if($pl === NULL) return FALSE; @@ -207,7 +189,7 @@ class Playlist { return $this->name; } $pl = CcPlaylistQuery::create()->findPK($id); - if($pl === NULL) + if ($pl === NULL) return FALSE; return $pl->getDbName(); @@ -395,18 +377,27 @@ class Playlist { } /** - * Create instance of Playlist object and insert empty file + * Create instance of a Playlist object. * - * @param string $fname - * name of new file - * @return instance of Playlist object + * @param string $p_fname + * Name of the playlist + * @return Playlist */ - public function create($fname=NULL) + public function create($p_fname=NULL) { - $values = array("filename" => $fname); - $pl_id = Playlist::Insert($values); - $this->id = $pl_id; - return $this->id; + $this->name = !empty($p_fname) ? $p_fname : date("H:i:s"); + $this->mtime = new DateTime("now"); + + $pl = new CcPlaylist(); + $pl->setDbName($this->name); + $pl->setDbState("incomplete"); + $pl->setDbMtime($this->mtime); + $pl->save(); + + $this->id = $pl->getDbId(); + $this->setState('ready'); + + return $this; } /** diff --git a/application/models/Schedule.php b/application/models/Schedule.php index d336546a5..07a23b81c 100644 --- a/application/models/Schedule.php +++ b/application/models/Schedule.php @@ -27,6 +27,8 @@ class ScheduleGroup { /** * Add a music clip or playlist to the schedule. * + * @param int $p_showInstance + * ID of the show. * @param $p_datetime * In the format YYYY-MM-DD HH:MM:SS.mmmmmm * @param $p_audioFileId @@ -40,7 +42,7 @@ class ScheduleGroup { * Return PEAR_Error if the item could not be added. * Error code 555 is a scheduling conflict. */ - public function add($show_instance, $p_datetime, $p_audioFileId = null, $p_playlistId = null, $p_options = null) { + public function add($p_showInstance, $p_datetime, $p_audioFileId = null, $p_playlistId = null, $p_options = null) { global $CC_CONFIG, $CC_DBC; if (!is_null($p_audioFileId)) { @@ -64,7 +66,7 @@ class ScheduleGroup { $sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"] ." (instance_id, starts, ends, clip_length, group_id, file_id, cue_out)" - ." VALUES ($show_instance, TIMESTAMP '$p_datetime', " + ." VALUES ($p_showInstance, TIMESTAMP '$p_datetime', " ." (TIMESTAMP '$p_datetime' + INTERVAL '$length')," ." '$length'," ." {$this->groupId}, $p_audioFileId, '$length')"; @@ -103,7 +105,7 @@ class ScheduleGroup { $sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"] ." (instance_id, playlist_id, starts, ends, group_id, file_id," ." clip_length, cue_in, cue_out, fade_in, fade_out)" - ." VALUES ($show_instance, $p_playlistId, TIMESTAMP '$itemStartTime', " + ." VALUES ($p_showInstance, $p_playlistId, TIMESTAMP '$itemStartTime', " ." (TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength')," ." '{$this->groupId}', '{$row['file_id']}', '$trackLength', '{$row['cuein']}'," ." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')"; diff --git a/application/models/Shows.php b/application/models/Shows.php index cf7df53ab..46bb29ef6 100644 --- a/application/models/Shows.php +++ b/application/models/Shows.php @@ -58,11 +58,16 @@ class Show { $show->setDbBackgroundColor($backgroundColor); } + public function getId() + { + return $this->_showId; + } + public function getHosts() { global $CC_DBC; - $sql = "SELECT first_name, last_name + $sql = "SELECT first_name, last_name FROM cc_show_hosts LEFT JOIN cc_subjs ON cc_show_hosts.subjs_id = cc_subjs.id WHERE show_id = {$this->_showId}"; @@ -70,7 +75,7 @@ class Show { $res = array(); foreach($hosts as $host) { - $res[] = $host['first_name']." ".$host['last_name']; + $res[] = $host['first_name']." ".$host['last_name']; } return $res; @@ -93,8 +98,17 @@ class Show { RabbitMq::PushSchedule(); } - //end dates are non inclusive. - public static function addShow($data) + + /** + * Create a show. + * + * Note: end dates are non inclusive. + * + * @param array $data + * @return int + * Show ID + */ + public static function create($data) { $con = Propel::getConnection(CcShowPeer::DATABASE_NAME); @@ -106,11 +120,11 @@ class Show { $r = $con->query($sql); $startDow = $r->fetchColumn(0); - if($data['add_show_no_end']) { + if ($data['add_show_no_end']) { $endDate = NULL; $data['add_show_repeats'] = 1; } - else if($data['add_show_repeats']) { + else if ($data['add_show_repeats']) { $sql = "SELECT date '{$data['add_show_end_date']}' + INTERVAL '1 day' "; $r = $con->query($sql); $endDate = $r->fetchColumn(0); @@ -122,15 +136,15 @@ class Show { } //only want the day of the week from the start date. - if(!$data['add_show_repeats']) { + if (!$data['add_show_repeats']) { $data['add_show_day_check'] = array($startDow); } - else if($data['add_show_repeats'] && $data['add_show_day_check'] == "") { + else if ($data['add_show_repeats'] && $data['add_show_day_check'] == "") { $data['add_show_day_check'] = array($startDow); } //find repeat type or set to a non repeating show. - if($data['add_show_repeats']) { + if ($data['add_show_repeats']) { $repeat_type = $data["add_show_repeat_type"]; } else { @@ -147,7 +161,7 @@ class Show { $showId = $show->getDbId(); - if($data['add_show_record']){ + if ($data['add_show_record']){ $isRecorded = 1; } else { @@ -155,7 +169,7 @@ class Show { } //don't set day for monthly repeat type, it's invalid. - if($data['add_show_repeats'] && $data["add_show_repeat_type"] == 2) { + if ($data['add_show_repeats'] && $data["add_show_repeat_type"] == 2) { $showDay = new CcShowDays(); $showDay->setDbFirstShow($data['add_show_start_date']); $showDay->setDbLastShow($endDate); @@ -168,7 +182,7 @@ class Show { } else { foreach ($data['add_show_day_check'] as $day) { - if($startDow !== $day){ + if ($startDow !== $day){ if ($startDow > $day) $daysAdd = 6 - $startDow + 1 + $day; @@ -183,7 +197,7 @@ class Show { $start = $data['add_show_start_date']; } - if(strtotime($start) < strtotime($endDate) || is_null($endDate)) { + if (strtotime($start) < strtotime($endDate) || is_null($endDate)) { $showDay = new CcShowDays(); $showDay->setDbFirstShow($start); $showDay->setDbLastShow($endDate); @@ -199,11 +213,11 @@ class Show { } //adding rows to cc_show_rebroadcast - if($data['add_show_record'] && $data['add_show_rebroadcast'] && $repeat_type != -1) { + if ($data['add_show_record'] && $data['add_show_rebroadcast'] && $repeat_type != -1) { - for($i=1; $i<=5; $i++) { + for ($i=1; $i<=5; $i++) { - if($data['add_show_rebroadcast_date_'.$i]) { + if ($data['add_show_rebroadcast_date_'.$i]) { $showRebroad = new CcShowRebroadcast(); $showRebroad->setDbDayOffset($data['add_show_rebroadcast_date_'.$i]); $showRebroad->setDbStartTime($data['add_show_rebroadcast_time_'.$i]); @@ -212,11 +226,11 @@ class Show { } } } - else if($data['add_show_record'] && $data['add_show_rebroadcast'] && $repeat_type == -1){ + else if ($data['add_show_record'] && $data['add_show_rebroadcast'] && $repeat_type == -1){ - for($i=1; $i<=5; $i++) { + for ($i=1; $i<=5; $i++) { - if($data['add_show_rebroadcast_absolute_date_'.$i]) { + if ($data['add_show_rebroadcast_absolute_date_'.$i]) { $sql = "SELECT date '{$data['add_show_rebroadcast_absolute_date_'.$i]}' - date '{$data['add_show_start_date']}' "; $r = $con->query($sql); $offset_days = $r->fetchColumn(0); @@ -230,7 +244,7 @@ class Show { } } - if(is_array($data['add_show_hosts'])) { + if (is_array($data['add_show_hosts'])) { //add selected hosts to cc_show_hosts table. foreach ($data['add_show_hosts'] as $host) { $showHost = new CcShowHosts(); @@ -240,10 +254,19 @@ class Show { } } - Show::populateShowUntilLastGeneratedDate($showId); + Show::populateShowUntil($showId); RabbitMq::PushSchedule(); + return $showId; } + /** + * @param string $start_timestamp + * In the format "YYYY-MM-DD HH:mm:ss" + * @param string $end_timestamp + * In the format "YYYY-MM-DD HH:mm:ss" + * @param unknown_type $excludeInstance + * @param boolean $onlyRecord + */ public static function getShows($start_timestamp, $end_timestamp, $excludeInstance=NULL, $onlyRecord=FALSE) { global $CC_DBC; @@ -301,7 +324,7 @@ class Show { $next_date = $first_show." ".$start_time; - if(strtotime($next_date) < strtotime($end_timestamp)) { + if (strtotime($next_date) < strtotime($end_timestamp)) { $start = $next_date; @@ -345,7 +368,8 @@ class Show { //for a show with repeat_type == 0,1,2 private static function populateRepeatingShow($show_id, $next_pop_date, $first_show, $last_show, - $start_time, $duration, $day, $record, $end_timestamp, $interval) { + $start_time, $duration, $day, $record, $end_timestamp, $interval) + { global $CC_DBC; if(isset($next_pop_date)) { @@ -422,53 +446,81 @@ class Show { } } - //used to catch up a newly added show - private static function populateShowUntilLastGeneratedDate($show_id) { - global $CC_DBC; - $showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil(); - $sql = "SELECT * FROM cc_show_days WHERE show_id = {$show_id}"; + /** + * Generate repeating show instances for a single show up to the given date. + * If no date is given, use the one in the user's preferences, which is stored + * automatically by FullCalendar as the furthest date in the future the user + * has looked at. + * + * @param int $p_showId + * @param string $p_date + * In the format "YYYY-MM-DD HH:mm:ss" + */ + public static function populateShowUntil($p_showId, $p_date = NULL) + { + global $CC_DBC; + if (is_null($p_date)) { + $p_date = Application_Model_Preference::GetShowsPopulatedUntil(); + } + + $sql = "SELECT * FROM cc_show_days WHERE show_id = {$p_showId}"; $res = $CC_DBC->GetAll($sql); - foreach($res as $row) { + foreach ($res as $row) { Show::populateShow($row["repeat_type"], $row["show_id"], $row["next_pop_date"], $row["first_show"], - $row["last_show"], $row["start_time"], $row["duration"], $row["day"], $row["record"], $showsPopUntil); + $row["last_show"], $row["start_time"], $row["duration"], $row["day"], $row["record"], $p_date); } } - public static function populateShowsUntil($pop_timestamp, $end_timestamp) { + /** + * Generate all the repeating shows in the given range. + * + * @param string $p_startTimestamp + * In the format "YYYY-MM-DD HH:mm:ss" + * @param string $p_endTimestamp + * In the format "YYYY-MM-DD HH:mm:ss" + */ + public static function populateAllShowsInRange($p_startTimestamp, $p_endTimestamp) + { global $CC_DBC; - if($pop_timestamp != "") { + if ($pop_timestamp != "") { $sql = "SELECT * FROM cc_show_days - WHERE last_show IS NULL - OR first_show < '{$end_timestamp}' AND last_show > '{$pop_timestamp}'"; + WHERE last_show IS NULL + OR first_show < '{$p_endTimestamp}' AND last_show > '{$p_startTimestamp}'"; } else { $today_timestamp = date("Y-m-d"); - $sql = "SELECT * FROM cc_show_days - WHERE last_show IS NULL - OR first_show < '{$end_timestamp}' AND last_show > '{$today_timestamp}'"; + WHERE last_show IS NULL + OR first_show < '{$p_endTimestamp}' AND last_show > '{$today_timestamp}'"; } $res = $CC_DBC->GetAll($sql); - foreach($res as $row) { + foreach ($res as $row) { Show::populateShow($row["repeat_type"], $row["show_id"], $row["next_pop_date"], $row["first_show"], - $row["last_show"], $row["start_time"], $row["duration"], $row["day"], $row["record"], $end_timestamp); + $row["last_show"], $row["start_time"], $row["duration"], $row["day"], $row["record"], $p_endTimestamp); } } - public static function getFullCalendarEvents($start, $end, $editable=false) { - + /** + * + * @param string $start + * In the format "YYYY-MM-DD HH:mm:ss" + * @param string $end + * In the format "YYYY-MM-DD HH:mm:ss" + * @param boolean $editable + */ + public static function getFullCalendarEvents($start, $end, $editable=false) + { $events = array(); $showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil(); //if fullcalendar is requesting shows past our previous populated until date, generate shows up until this point. - if($showsPopUntil == "" || strtotime($showsPopUntil) < strtotime($end)) { - - Show::populateShowsUntil($showsPopUntil, $end); + if ($showsPopUntil == "" || strtotime($showsPopUntil) < strtotime($end)) { + Show::populateAllShowsInRange($showsPopUntil, $end); Application_Model_Preference::SetShowsPopulatedUntil($end); } @@ -476,7 +528,7 @@ class Show { $today_timestamp = date("Y-m-d H:i:s"); foreach ($shows as $show) { - if($editable && strtotime($today_timestamp) < strtotime($show["starts"])) + if ($editable && strtotime($today_timestamp) < strtotime($show["starts"])) $events[] = Show::makeFullCalendarEvent($show, array("editable" => true)); else $events[] = Show::makeFullCalendarEvent($show); @@ -683,6 +735,10 @@ class ShowInstance { RabbitMq::PushSchedule(); } + /** + * Get the group ID for this show. + * + */ private function getLastGroupId() { global $CC_DBC; @@ -691,13 +747,18 @@ class ShowInstance { return $res; } + /** + * Add a playlist as the last item of the current show. + * + * @param int $plId + * Playlist ID. + */ public function addPlaylistToShow($plId) { $sched = new ScheduleGroup(); $lastGroupId = $this->getLastGroupId(); - if(is_null($lastGroupId)) { - + if (is_null($lastGroupId)) { $groupId = $sched->add($this->_instanceId, $this->getShowStart(), null, $plId); } else { @@ -706,14 +767,18 @@ class ShowInstance { RabbitMq::PushSchedule(); } - public function addFileToShow($file_id) + /** + * Add a media file as the last item in the show. + * + * @param int $file_id + */ + public function addFileToShow($file_id) { $sched = new ScheduleGroup(); $lastGroupId = $this->getLastGroupId(); - - if(is_null($lastGroupId)) { - $groupId = $sched->add($this->_instanceId, $this->getShowStart(), $file_id); + if (is_null($lastGroupId)) { + $groupId = $sched->add($this->_instanceId, $this->getShowStart(), $file_id); } else { $groupId = $sched->addFileAfter($this->_instanceId, $lastGroupId, $file_id); @@ -721,12 +786,18 @@ class ShowInstance { RabbitMq::PushSchedule(); } - public function scheduleShow($plIds) { - - foreach($plIds as $plId) { - $this->addPlaylistToShow($plId); - } - } + /** + * Add the given playlists to the show. + * + * @param array $plIds + * An array of playlist IDs. + */ + public function scheduleShow($plIds) + { + foreach ($plIds as $plId) { + $this->addPlaylistToShow($plId); + } + } public function removeGroupFromShow($group_id) { @@ -961,7 +1032,7 @@ class Show_DAL { //Result: 5 global $CC_CONFIG, $CC_DBC; - $sql = "SELECT" + $sql = "SELECT" ." si.starts as show_starts," ." si.ends as show_ends," ." s.name as show_name," diff --git a/application/models/tests/populator.php b/application/models/tests/populator.php new file mode 100644 index 000000000..9f0445eb6 --- /dev/null +++ b/application/models/tests/populator.php @@ -0,0 +1,98 @@ + __DIR__."/test10001.mp3"); +$storedFile = StoredFile::Insert($values, false); + +// Add a file +$values = array("filepath" => __DIR__."/test10002.mp3"); +$storedFile2 = StoredFile::Insert($values, false); + +$playlist = new Playlist(); +$playlist->create("Calendar Load test playlist ".uniqid()); +$result = $playlist->addAudioClip($storedFile->getId()); +$result = $playlist->addAudioClip($storedFile2->getId()); +$result = $playlist->addAudioClip($storedFile2->getId()); + +echo "Created playlist ".$playlist->getName()." with ID ".$playlist->getId()."\n"; + +// Create the shows + +$data = array(); + +$currentDate = date("Y\\-m\\-d"); + +$year = date("Y"); +$month = date("m"); +$day = date("d"); + +$nextDay = $currentDate; + +#echo $currentDate; +$currentHour = date("H"); +$setHour = $currentHour + 1; + +$showNumber = 1; +for ($days=1; $days<100; $days=$days+1) +{ + // Adding shows until the end of the day + while ($setHour < 24) + { + echo 'Adding show: '.$nextDay. ' '.$setHour.":00\n"; + $data['add_show_name'] = 'automated show '.$showNumber; + $data['add_show_start_date'] = $nextDay; + $data['add_show_start_time'] = $setHour.':00'; + $showNumber = $showNumber + 1; + $data['add_show_duration'] = '1:00'; + $data['add_show_no_end'] = 0; + $data['add_show_repeats'] = 0; + $data['add_show_description'] = 'automated show'; + $data['add_show_url'] = 'http://www.OfirGal.com'; + $data['add_show_color'] = ""; + $data['add_show_background_color'] = ""; + $data['add_show_record'] = 0; + $data['add_show_hosts'] =""; + $showId = Show::create($data); + Show::populateShowUntil($showId, "2012-01-01 00:00:00"); + + // populating the show with a playlist + $show = new ShowInstance($showId); + $show->scheduleShow(array($playlist->getId())); + + $setHour = $setHour + 1; + } + // set the next day + $setHour = 0; + if ($day<30) { + $day = $day + 1; + } else { + $day = 1; + if ($month<12) + { + $month = $month + 1; + } else { + $month = 1; + $year = $year + 1; + } + } + $nextDay = $year."-".$month."-".$day; +} diff --git a/utils/upgrade-sql.php b/utils/upgrade-sql.php deleted file mode 100644 index 5d792357a..000000000 --- a/utils/upgrade-sql.php +++ /dev/null @@ -1,3 +0,0 @@ - Date: Wed, 30 Mar 2011 17:32:23 -0400 Subject: [PATCH 3/3] Tweaks to the calendar load test. --- application/models/tests/populator.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/application/models/tests/populator.php b/application/models/tests/populator.php index 9f0445eb6..98992b650 100644 --- a/application/models/tests/populator.php +++ b/application/models/tests/populator.php @@ -1,12 +1,12 @@ create("Calendar Load test playlist ".uniqid()); // Add a file $values = array("filepath" => __DIR__."/test10001.mp3"); $storedFile = StoredFile::Insert($values, false); +$result = $playlist->addAudioClip($storedFile->getId()); // Add a file $values = array("filepath" => __DIR__."/test10002.mp3"); $storedFile2 = StoredFile::Insert($values, false); -$playlist = new Playlist(); -$playlist->create("Calendar Load test playlist ".uniqid()); -$result = $playlist->addAudioClip($storedFile->getId()); $result = $playlist->addAudioClip($storedFile2->getId()); $result = $playlist->addAudioClip($storedFile2->getId()); @@ -73,11 +73,11 @@ for ($days=1; $days<100; $days=$days+1) $data['add_show_hosts'] =""; $showId = Show::create($data); Show::populateShowUntil($showId, "2012-01-01 00:00:00"); - + // populating the show with a playlist $show = new ShowInstance($showId); $show->scheduleShow(array($playlist->getId())); - + $setHour = $setHour + 1; } // set the next day
"+shows[i].getRange()+""+shows[i].getName()+" Listen"+shows[i].getName()+"