From c6edfc320818b941e0e399c29a320bacdb3efa3e Mon Sep 17 00:00:00 2001
From: Naomi Aro <naomiaro@gmail.com>
Date: Fri, 24 Feb 2012 16:05:01 +0100
Subject: [PATCH] CC-3174 : showbuilder

removing columns that no longer should be in cc_schedule.

changing cc_files length column to be of type interval.

adding length formatter to showbuilder.
---
 .../application/models/ShowBuilder.php        |  29 +-
 airtime_mvc/application/models/StoredFile.php |  20 +-
 .../models/airtime/map/CcFilesTableMap.php    |   2 +-
 .../models/airtime/map/CcScheduleTableMap.php |   3 -
 .../models/airtime/om/BaseCcFiles.php         |  82 ++----
 .../models/airtime/om/BaseCcFilesQuery.php    |  23 +-
 .../models/airtime/om/BaseCcSchedule.php      | 248 ++++--------------
 .../models/airtime/om/BaseCcSchedulePeer.php  |  41 +--
 .../models/airtime/om/BaseCcScheduleQuery.php |  91 -------
 airtime_mvc/build/schema.xml                  |   5 +-
 airtime_mvc/build/sql/schema.sql              |   5 +-
 .../public/js/airtime/showbuilder/builder.js  |   2 +-
 12 files changed, 101 insertions(+), 450 deletions(-)

diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php
index 1a715ea7e..17e5c4605 100644
--- a/airtime_mvc/application/models/ShowBuilder.php
+++ b/airtime_mvc/application/models/ShowBuilder.php
@@ -1,5 +1,7 @@
 <?php
 
+require_once 'formatters/LengthFormatter.php';
+
 class Application_Model_ShowBuilder {
 
     private $timezone;
@@ -41,26 +43,6 @@ class Application_Model_ShowBuilder {
         $this->epoch_now = time();
     }
 
-    /*
-     * @param DateInterval $p_interval
-     *
-     * @return string $runtime
-     */
-    private function formatDuration($p_interval){
-
-        $hours = $p_interval->format("%h");
-        $mins = $p_interval->format("%i");
-
-        if( $hours == 0) {
-            $runtime = $p_interval->format("%i:%S");
-        }
-        else {
-            $runtime = $p_interval->format("%h:%I:%S");
-        }
-
-        return $runtime;
-    }
-
     private function formatTimeFilled($p_sec) {
 
         $formatted = "";
@@ -188,13 +170,14 @@ class Application_Model_ShowBuilder {
 
             $this->getItemStatus($p_item, $row);
 
-            $runtime = $schedStartDT->diff($schedEndDT);
-
             $row["id"] = intval($p_item["sched_id"]);
             $row["instance"] = intval($p_item["si_id"]);
             $row["starts"] = $schedStartDT->format("H:i:s");
             $row["ends"] = $schedEndDT->format("H:i:s");
-            $row["runtime"] = $this->formatDuration($runtime);
+
+            $formatter = new LengthFormatter($p_item['file_length']);
+            $row['runtime'] = $formatter->format();
+
             $row["title"] = $p_item["file_track_title"];
             $row["creator"] = $p_item["file_artist_name"];
             $row["album"] = $p_item["file_album_title"];
diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php
index a4484e666..aa4c2de09 100644
--- a/airtime_mvc/application/models/StoredFile.php
+++ b/airtime_mvc/application/models/StoredFile.php
@@ -580,20 +580,13 @@ class Application_Model_StoredFile {
                 $plSelect[] = "login AS ".$key;
                 $fileSelect[] = $key;
             }
-            else if ($key === "length") {
+            //same columns in each table.
+            else if(in_array($key, array("length", "utime", "mtime"))) {
                 $plSelect[] = $key;
-                $fileSelect[] = $key."::interval";
+                $fileSelect[] = $key;
             }
             else if ($key === "year") {
-                $plSelect[] = "CAST(utime AS varchar) AS ".$key;
-                $fileSelect[] = $key;
-            }
-            else if ($key === "utime") {
-                $plSelect[] = $key;
-                $fileSelect[] = $key;
-            }
-            else if ($key === "mtime") {
-                $plSelect[] = $key;
+                $plSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS ".$key;
                 $fileSelect[] = $key;
             }
             //need to cast certain data as ints for the union to search on.
@@ -644,11 +637,6 @@ class Application_Model_StoredFile {
             // add checkbox row
             $row['checkbox'] = "<input type='checkbox' name='cb_".$row['id']."'>";
 
-            // a full timestamp is being returned for playlists' year column;
-            // split it and grab only the year info
-            $yearSplit = explode('-', $row['year']);
-            $row['year'] = $yearSplit[0];
-
             $type = substr($row['ftype'], 0, 2);
 
             $row['tr_id'] = "{$type}_{$row['id']}";
diff --git a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php
index bb4bb72ec..7426b39e4 100644
--- a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php
@@ -57,7 +57,7 @@ class CcFilesTableMap extends TableMap {
 		$this->addColumn('BIT_RATE', 'DbBitRate', 'VARCHAR', false, 32, null);
 		$this->addColumn('SAMPLE_RATE', 'DbSampleRate', 'VARCHAR', false, 32, null);
 		$this->addColumn('FORMAT', 'DbFormat', 'VARCHAR', false, 128, null);
-		$this->addColumn('LENGTH', 'DbLength', 'TIME', false, null, null);
+		$this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
 		$this->addColumn('ALBUM_TITLE', 'DbAlbumTitle', 'VARCHAR', false, 512, null);
 		$this->addColumn('GENRE', 'DbGenre', 'VARCHAR', false, 64, null);
 		$this->addColumn('COMMENTS', 'DbComments', 'LONGVARCHAR', false, null, null);
diff --git a/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php
index 12fa8d712..ebbe397c8 100644
--- a/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php
@@ -39,17 +39,14 @@ class CcScheduleTableMap extends TableMap {
 		$this->setPrimaryKeyMethodInfo('cc_schedule_id_seq');
 		// columns
 		$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
-		$this->addColumn('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', false, null, null);
 		$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
 		$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
-		$this->addColumn('GROUP_ID', 'DbGroupId', 'INTEGER', false, null, null);
 		$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
 		$this->addColumn('CLIP_LENGTH', 'DbClipLength', 'TIME', false, null, '00:00:00');
 		$this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00');
 		$this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00');
 		$this->addColumn('CUE_IN', 'DbCueIn', 'TIME', false, null, '00:00:00');
 		$this->addColumn('CUE_OUT', 'DbCueOut', 'TIME', false, null, '00:00:00');
-		$this->addColumn('SCHEDULE_GROUP_PLAYED', 'DbScheduleGroupPlayed', 'BOOLEAN', false, null, false);
 		$this->addColumn('MEDIA_ITEM_PLAYED', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false);
 		$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null);
 		// validators
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php
index 15cde9a2b..6bdbd6b3d 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php
@@ -146,6 +146,7 @@ abstract class BaseCcFiles extends BaseObject  implements Persistent
 
 	/**
 	 * The value for the length field.
+	 * Note: this column has a database default value of: '00:00:00'
 	 * @var        string
 	 */
 	protected $length;
@@ -456,6 +457,7 @@ abstract class BaseCcFiles extends BaseObject  implements Persistent
 		$this->filepath = '';
 		$this->state = 'empty';
 		$this->currentlyaccessing = 0;
+		$this->length = '00:00:00';
 		$this->file_exists = true;
 	}
 
@@ -729,36 +731,13 @@ abstract class BaseCcFiles extends BaseObject  implements Persistent
 	}
 
 	/**
-	 * Get the [optionally formatted] temporal [length] column value.
+	 * Get the [length] column value.
 	 * 
-	 *
-	 * @param      string $format The date/time format string (either date()-style or strftime()-style).
-	 *							If format is NULL, then the raw DateTime object will be returned.
-	 * @return     mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
-	 * @throws     PropelException - if unable to parse/validate the date/time value.
+	 * @return     string
 	 */
-	public function getDbLength($format = '%X')
+	public function getDbLength()
 	{
-		if ($this->length === null) {
-			return null;
-		}
-
-
-
-		try {
-			$dt = new DateTime($this->length);
-		} catch (Exception $x) {
-			throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->length, true), $x);
-		}
-
-		if ($format === null) {
-			// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
-			return $dt;
-		} elseif (strpos($format, '%') !== false) {
-			return strftime($format, $dt->format('U'));
-		} else {
-			return $dt->format($format);
-		}
+		return $this->length;
 	}
 
 	/**
@@ -1657,50 +1636,21 @@ abstract class BaseCcFiles extends BaseObject  implements Persistent
 	} // setDbFormat()
 
 	/**
-	 * Sets the value of [length] column to a normalized version of the date/time value specified.
+	 * Set the value of [length] column.
 	 * 
-	 * @param      mixed $v string, integer (timestamp), or DateTime value.  Empty string will
-	 *						be treated as NULL for temporal objects.
+	 * @param      string $v new value
 	 * @return     CcFiles The current object (for fluent API support)
 	 */
 	public function setDbLength($v)
 	{
-		// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
-		// -- which is unexpected, to say the least.
-		if ($v === null || $v === '') {
-			$dt = null;
-		} elseif ($v instanceof DateTime) {
-			$dt = $v;
-		} else {
-			// some string/numeric value passed; we normalize that so that we can
-			// validate it.
-			try {
-				if (is_numeric($v)) { // if it's a unix timestamp
-					$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
-					// We have to explicitly specify and then change the time zone because of a
-					// DateTime bug: http://bugs.php.net/bug.php?id=43003
-					$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
-				} else {
-					$dt = new DateTime($v);
-				}
-			} catch (Exception $x) {
-				throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
-			}
+		if ($v !== null) {
+			$v = (string) $v;
 		}
 
-		if ( $this->length !== null || $dt !== null ) {
-			// (nested ifs are a little easier to read in this case)
-
-			$currNorm = ($this->length !== null && $tmpDt = new DateTime($this->length)) ? $tmpDt->format('H:i:s') : null;
-			$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
-
-			if ( ($currNorm !== $newNorm) // normalized values don't match 
-					)
-			{
-				$this->length = ($dt ? $dt->format('H:i:s') : null);
-				$this->modifiedColumns[] = CcFilesPeer::LENGTH;
-			}
-		} // if either are not null
+		if ($this->length !== $v || $this->isNew()) {
+			$this->length = $v;
+			$this->modifiedColumns[] = CcFilesPeer::LENGTH;
+		}
 
 		return $this;
 	} // setDbLength()
@@ -2579,6 +2529,10 @@ abstract class BaseCcFiles extends BaseObject  implements Persistent
 				return false;
 			}
 
+			if ($this->length !== '00:00:00') {
+				return false;
+			}
+
 			if ($this->file_exists !== true) {
 				return false;
 			}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php
index 16aba102b..4921e9eb8 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php
@@ -863,29 +863,20 @@ abstract class BaseCcFilesQuery extends ModelCriteria
 	/**
 	 * Filter the query on the length column
 	 * 
-	 * @param     string|array $dbLength The value to use as filter.
-	 *            Accepts an associative array('min' => $minValue, 'max' => $maxValue)
+	 * @param     string $dbLength The value to use as filter.
+	 *            Accepts wildcards (* and % trigger a LIKE)
 	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
 	 *
 	 * @return    CcFilesQuery The current query, for fluid interface
 	 */
 	public function filterByDbLength($dbLength = null, $comparison = null)
 	{
-		if (is_array($dbLength)) {
-			$useMinMax = false;
-			if (isset($dbLength['min'])) {
-				$this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength['min'], Criteria::GREATER_EQUAL);
-				$useMinMax = true;
-			}
-			if (isset($dbLength['max'])) {
-				$this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength['max'], Criteria::LESS_EQUAL);
-				$useMinMax = true;
-			}
-			if ($useMinMax) {
-				return $this;
-			}
-			if (null === $comparison) {
+		if (null === $comparison) {
+			if (is_array($dbLength)) {
 				$comparison = Criteria::IN;
+			} elseif (preg_match('/[\%\*]/', $dbLength)) {
+				$dbLength = str_replace('*', '%', $dbLength);
+				$comparison = Criteria::LIKE;
 			}
 		}
 		return $this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength, $comparison);
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php
index 26a91778d..751babc2d 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php
@@ -30,12 +30,6 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 	 */
 	protected $id;
 
-	/**
-	 * The value for the playlist_id field.
-	 * @var        int
-	 */
-	protected $playlist_id;
-
 	/**
 	 * The value for the starts field.
 	 * @var        string
@@ -48,12 +42,6 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 	 */
 	protected $ends;
 
-	/**
-	 * The value for the group_id field.
-	 * @var        int
-	 */
-	protected $group_id;
-
 	/**
 	 * The value for the file_id field.
 	 * @var        int
@@ -95,13 +83,6 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 	 */
 	protected $cue_out;
 
-	/**
-	 * The value for the schedule_group_played field.
-	 * Note: this column has a database default value of: false
-	 * @var        boolean
-	 */
-	protected $schedule_group_played;
-
 	/**
 	 * The value for the media_item_played field.
 	 * Note: this column has a database default value of: false
@@ -155,7 +136,6 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 		$this->fade_out = '00:00:00';
 		$this->cue_in = '00:00:00';
 		$this->cue_out = '00:00:00';
-		$this->schedule_group_played = false;
 		$this->media_item_played = false;
 	}
 
@@ -179,16 +159,6 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 		return $this->id;
 	}
 
-	/**
-	 * Get the [playlist_id] column value.
-	 * 
-	 * @return     int
-	 */
-	public function getDbPlaylistId()
-	{
-		return $this->playlist_id;
-	}
-
 	/**
 	 * Get the [optionally formatted] temporal [starts] column value.
 	 * 
@@ -255,16 +225,6 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 		}
 	}
 
-	/**
-	 * Get the [group_id] column value.
-	 * 
-	 * @return     int
-	 */
-	public function getDbGroupId()
-	{
-		return $this->group_id;
-	}
-
 	/**
 	 * Get the [file_id] column value.
 	 * 
@@ -440,16 +400,6 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 		}
 	}
 
-	/**
-	 * Get the [schedule_group_played] column value.
-	 * 
-	 * @return     boolean
-	 */
-	public function getDbScheduleGroupPlayed()
-	{
-		return $this->schedule_group_played;
-	}
-
 	/**
 	 * Get the [media_item_played] column value.
 	 * 
@@ -490,26 +440,6 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 		return $this;
 	} // setDbId()
 
-	/**
-	 * Set the value of [playlist_id] column.
-	 * 
-	 * @param      int $v new value
-	 * @return     CcSchedule The current object (for fluent API support)
-	 */
-	public function setDbPlaylistId($v)
-	{
-		if ($v !== null) {
-			$v = (int) $v;
-		}
-
-		if ($this->playlist_id !== $v) {
-			$this->playlist_id = $v;
-			$this->modifiedColumns[] = CcSchedulePeer::PLAYLIST_ID;
-		}
-
-		return $this;
-	} // setDbPlaylistId()
-
 	/**
 	 * Sets the value of [starts] column to a normalized version of the date/time value specified.
 	 * 
@@ -608,26 +538,6 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 		return $this;
 	} // setDbEnds()
 
-	/**
-	 * Set the value of [group_id] column.
-	 * 
-	 * @param      int $v new value
-	 * @return     CcSchedule The current object (for fluent API support)
-	 */
-	public function setDbGroupId($v)
-	{
-		if ($v !== null) {
-			$v = (int) $v;
-		}
-
-		if ($this->group_id !== $v) {
-			$this->group_id = $v;
-			$this->modifiedColumns[] = CcSchedulePeer::GROUP_ID;
-		}
-
-		return $this;
-	} // setDbGroupId()
-
 	/**
 	 * Set the value of [file_id] column.
 	 * 
@@ -902,26 +812,6 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 		return $this;
 	} // setDbCueOut()
 
-	/**
-	 * Set the value of [schedule_group_played] column.
-	 * 
-	 * @param      boolean $v new value
-	 * @return     CcSchedule The current object (for fluent API support)
-	 */
-	public function setDbScheduleGroupPlayed($v)
-	{
-		if ($v !== null) {
-			$v = (boolean) $v;
-		}
-
-		if ($this->schedule_group_played !== $v || $this->isNew()) {
-			$this->schedule_group_played = $v;
-			$this->modifiedColumns[] = CcSchedulePeer::SCHEDULE_GROUP_PLAYED;
-		}
-
-		return $this;
-	} // setDbScheduleGroupPlayed()
-
 	/**
 	 * Set the value of [media_item_played] column.
 	 * 
@@ -996,10 +886,6 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 				return false;
 			}
 
-			if ($this->schedule_group_played !== false) {
-				return false;
-			}
-
 			if ($this->media_item_played !== false) {
 				return false;
 			}
@@ -1027,19 +913,16 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 		try {
 
 			$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
-			$this->playlist_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
-			$this->starts = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
-			$this->ends = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
-			$this->group_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
-			$this->file_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
-			$this->clip_length = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
-			$this->fade_in = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
-			$this->fade_out = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
-			$this->cue_in = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
-			$this->cue_out = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
-			$this->schedule_group_played = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null;
-			$this->media_item_played = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null;
-			$this->instance_id = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null;
+			$this->starts = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+			$this->ends = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+			$this->file_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
+			$this->clip_length = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+			$this->fade_in = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+			$this->fade_out = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
+			$this->cue_in = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
+			$this->cue_out = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
+			$this->media_item_played = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null;
+			$this->instance_id = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null;
 			$this->resetModified();
 
 			$this->setNew(false);
@@ -1048,7 +931,7 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 				$this->ensureConsistency();
 			}
 
-			return $startcol + 14; // 14 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
+			return $startcol + 11; // 11 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
 
 		} catch (Exception $e) {
 			throw new PropelException("Error populating CcSchedule object", $e);
@@ -1398,42 +1281,33 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 				return $this->getDbId();
 				break;
 			case 1:
-				return $this->getDbPlaylistId();
-				break;
-			case 2:
 				return $this->getDbStarts();
 				break;
-			case 3:
+			case 2:
 				return $this->getDbEnds();
 				break;
-			case 4:
-				return $this->getDbGroupId();
-				break;
-			case 5:
+			case 3:
 				return $this->getDbFileId();
 				break;
-			case 6:
+			case 4:
 				return $this->getDbClipLength();
 				break;
-			case 7:
+			case 5:
 				return $this->getDbFadeIn();
 				break;
-			case 8:
+			case 6:
 				return $this->getDbFadeOut();
 				break;
-			case 9:
+			case 7:
 				return $this->getDbCueIn();
 				break;
-			case 10:
+			case 8:
 				return $this->getDbCueOut();
 				break;
-			case 11:
-				return $this->getDbScheduleGroupPlayed();
-				break;
-			case 12:
+			case 9:
 				return $this->getDbMediaItemPlayed();
 				break;
-			case 13:
+			case 10:
 				return $this->getDbInstanceId();
 				break;
 			default:
@@ -1461,19 +1335,16 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 		$keys = CcSchedulePeer::getFieldNames($keyType);
 		$result = array(
 			$keys[0] => $this->getDbId(),
-			$keys[1] => $this->getDbPlaylistId(),
-			$keys[2] => $this->getDbStarts(),
-			$keys[3] => $this->getDbEnds(),
-			$keys[4] => $this->getDbGroupId(),
-			$keys[5] => $this->getDbFileId(),
-			$keys[6] => $this->getDbClipLength(),
-			$keys[7] => $this->getDbFadeIn(),
-			$keys[8] => $this->getDbFadeOut(),
-			$keys[9] => $this->getDbCueIn(),
-			$keys[10] => $this->getDbCueOut(),
-			$keys[11] => $this->getDbScheduleGroupPlayed(),
-			$keys[12] => $this->getDbMediaItemPlayed(),
-			$keys[13] => $this->getDbInstanceId(),
+			$keys[1] => $this->getDbStarts(),
+			$keys[2] => $this->getDbEnds(),
+			$keys[3] => $this->getDbFileId(),
+			$keys[4] => $this->getDbClipLength(),
+			$keys[5] => $this->getDbFadeIn(),
+			$keys[6] => $this->getDbFadeOut(),
+			$keys[7] => $this->getDbCueIn(),
+			$keys[8] => $this->getDbCueOut(),
+			$keys[9] => $this->getDbMediaItemPlayed(),
+			$keys[10] => $this->getDbInstanceId(),
 		);
 		if ($includeForeignObjects) {
 			if (null !== $this->aCcShowInstances) {
@@ -1517,42 +1388,33 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 				$this->setDbId($value);
 				break;
 			case 1:
-				$this->setDbPlaylistId($value);
-				break;
-			case 2:
 				$this->setDbStarts($value);
 				break;
-			case 3:
+			case 2:
 				$this->setDbEnds($value);
 				break;
-			case 4:
-				$this->setDbGroupId($value);
-				break;
-			case 5:
+			case 3:
 				$this->setDbFileId($value);
 				break;
-			case 6:
+			case 4:
 				$this->setDbClipLength($value);
 				break;
-			case 7:
+			case 5:
 				$this->setDbFadeIn($value);
 				break;
-			case 8:
+			case 6:
 				$this->setDbFadeOut($value);
 				break;
-			case 9:
+			case 7:
 				$this->setDbCueIn($value);
 				break;
-			case 10:
+			case 8:
 				$this->setDbCueOut($value);
 				break;
-			case 11:
-				$this->setDbScheduleGroupPlayed($value);
-				break;
-			case 12:
+			case 9:
 				$this->setDbMediaItemPlayed($value);
 				break;
-			case 13:
+			case 10:
 				$this->setDbInstanceId($value);
 				break;
 		} // switch()
@@ -1580,19 +1442,16 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 		$keys = CcSchedulePeer::getFieldNames($keyType);
 
 		if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
-		if (array_key_exists($keys[1], $arr)) $this->setDbPlaylistId($arr[$keys[1]]);
-		if (array_key_exists($keys[2], $arr)) $this->setDbStarts($arr[$keys[2]]);
-		if (array_key_exists($keys[3], $arr)) $this->setDbEnds($arr[$keys[3]]);
-		if (array_key_exists($keys[4], $arr)) $this->setDbGroupId($arr[$keys[4]]);
-		if (array_key_exists($keys[5], $arr)) $this->setDbFileId($arr[$keys[5]]);
-		if (array_key_exists($keys[6], $arr)) $this->setDbClipLength($arr[$keys[6]]);
-		if (array_key_exists($keys[7], $arr)) $this->setDbFadeIn($arr[$keys[7]]);
-		if (array_key_exists($keys[8], $arr)) $this->setDbFadeOut($arr[$keys[8]]);
-		if (array_key_exists($keys[9], $arr)) $this->setDbCueIn($arr[$keys[9]]);
-		if (array_key_exists($keys[10], $arr)) $this->setDbCueOut($arr[$keys[10]]);
-		if (array_key_exists($keys[11], $arr)) $this->setDbScheduleGroupPlayed($arr[$keys[11]]);
-		if (array_key_exists($keys[12], $arr)) $this->setDbMediaItemPlayed($arr[$keys[12]]);
-		if (array_key_exists($keys[13], $arr)) $this->setDbInstanceId($arr[$keys[13]]);
+		if (array_key_exists($keys[1], $arr)) $this->setDbStarts($arr[$keys[1]]);
+		if (array_key_exists($keys[2], $arr)) $this->setDbEnds($arr[$keys[2]]);
+		if (array_key_exists($keys[3], $arr)) $this->setDbFileId($arr[$keys[3]]);
+		if (array_key_exists($keys[4], $arr)) $this->setDbClipLength($arr[$keys[4]]);
+		if (array_key_exists($keys[5], $arr)) $this->setDbFadeIn($arr[$keys[5]]);
+		if (array_key_exists($keys[6], $arr)) $this->setDbFadeOut($arr[$keys[6]]);
+		if (array_key_exists($keys[7], $arr)) $this->setDbCueIn($arr[$keys[7]]);
+		if (array_key_exists($keys[8], $arr)) $this->setDbCueOut($arr[$keys[8]]);
+		if (array_key_exists($keys[9], $arr)) $this->setDbMediaItemPlayed($arr[$keys[9]]);
+		if (array_key_exists($keys[10], $arr)) $this->setDbInstanceId($arr[$keys[10]]);
 	}
 
 	/**
@@ -1605,17 +1464,14 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 		$criteria = new Criteria(CcSchedulePeer::DATABASE_NAME);
 
 		if ($this->isColumnModified(CcSchedulePeer::ID)) $criteria->add(CcSchedulePeer::ID, $this->id);
-		if ($this->isColumnModified(CcSchedulePeer::PLAYLIST_ID)) $criteria->add(CcSchedulePeer::PLAYLIST_ID, $this->playlist_id);
 		if ($this->isColumnModified(CcSchedulePeer::STARTS)) $criteria->add(CcSchedulePeer::STARTS, $this->starts);
 		if ($this->isColumnModified(CcSchedulePeer::ENDS)) $criteria->add(CcSchedulePeer::ENDS, $this->ends);
-		if ($this->isColumnModified(CcSchedulePeer::GROUP_ID)) $criteria->add(CcSchedulePeer::GROUP_ID, $this->group_id);
 		if ($this->isColumnModified(CcSchedulePeer::FILE_ID)) $criteria->add(CcSchedulePeer::FILE_ID, $this->file_id);
 		if ($this->isColumnModified(CcSchedulePeer::CLIP_LENGTH)) $criteria->add(CcSchedulePeer::CLIP_LENGTH, $this->clip_length);
 		if ($this->isColumnModified(CcSchedulePeer::FADE_IN)) $criteria->add(CcSchedulePeer::FADE_IN, $this->fade_in);
 		if ($this->isColumnModified(CcSchedulePeer::FADE_OUT)) $criteria->add(CcSchedulePeer::FADE_OUT, $this->fade_out);
 		if ($this->isColumnModified(CcSchedulePeer::CUE_IN)) $criteria->add(CcSchedulePeer::CUE_IN, $this->cue_in);
 		if ($this->isColumnModified(CcSchedulePeer::CUE_OUT)) $criteria->add(CcSchedulePeer::CUE_OUT, $this->cue_out);
-		if ($this->isColumnModified(CcSchedulePeer::SCHEDULE_GROUP_PLAYED)) $criteria->add(CcSchedulePeer::SCHEDULE_GROUP_PLAYED, $this->schedule_group_played);
 		if ($this->isColumnModified(CcSchedulePeer::MEDIA_ITEM_PLAYED)) $criteria->add(CcSchedulePeer::MEDIA_ITEM_PLAYED, $this->media_item_played);
 		if ($this->isColumnModified(CcSchedulePeer::INSTANCE_ID)) $criteria->add(CcSchedulePeer::INSTANCE_ID, $this->instance_id);
 
@@ -1679,17 +1535,14 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 	 */
 	public function copyInto($copyObj, $deepCopy = false)
 	{
-		$copyObj->setDbPlaylistId($this->playlist_id);
 		$copyObj->setDbStarts($this->starts);
 		$copyObj->setDbEnds($this->ends);
-		$copyObj->setDbGroupId($this->group_id);
 		$copyObj->setDbFileId($this->file_id);
 		$copyObj->setDbClipLength($this->clip_length);
 		$copyObj->setDbFadeIn($this->fade_in);
 		$copyObj->setDbFadeOut($this->fade_out);
 		$copyObj->setDbCueIn($this->cue_in);
 		$copyObj->setDbCueOut($this->cue_out);
-		$copyObj->setDbScheduleGroupPlayed($this->schedule_group_played);
 		$copyObj->setDbMediaItemPlayed($this->media_item_played);
 		$copyObj->setDbInstanceId($this->instance_id);
 
@@ -1843,17 +1696,14 @@ abstract class BaseCcSchedule extends BaseObject  implements Persistent
 	public function clear()
 	{
 		$this->id = null;
-		$this->playlist_id = null;
 		$this->starts = null;
 		$this->ends = null;
-		$this->group_id = null;
 		$this->file_id = null;
 		$this->clip_length = null;
 		$this->fade_in = null;
 		$this->fade_out = null;
 		$this->cue_in = null;
 		$this->cue_out = null;
-		$this->schedule_group_played = null;
 		$this->media_item_played = null;
 		$this->instance_id = null;
 		$this->alreadyInSave = false;
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php b/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php
index b21b26990..e11d284a7 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php
@@ -26,7 +26,7 @@ abstract class BaseCcSchedulePeer {
 	const TM_CLASS = 'CcScheduleTableMap';
 	
 	/** The total number of columns. */
-	const NUM_COLUMNS = 14;
+	const NUM_COLUMNS = 11;
 
 	/** The number of lazy-loaded columns. */
 	const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -34,18 +34,12 @@ abstract class BaseCcSchedulePeer {
 	/** the column name for the ID field */
 	const ID = 'cc_schedule.ID';
 
-	/** the column name for the PLAYLIST_ID field */
-	const PLAYLIST_ID = 'cc_schedule.PLAYLIST_ID';
-
 	/** the column name for the STARTS field */
 	const STARTS = 'cc_schedule.STARTS';
 
 	/** the column name for the ENDS field */
 	const ENDS = 'cc_schedule.ENDS';
 
-	/** the column name for the GROUP_ID field */
-	const GROUP_ID = 'cc_schedule.GROUP_ID';
-
 	/** the column name for the FILE_ID field */
 	const FILE_ID = 'cc_schedule.FILE_ID';
 
@@ -64,9 +58,6 @@ abstract class BaseCcSchedulePeer {
 	/** the column name for the CUE_OUT field */
 	const CUE_OUT = 'cc_schedule.CUE_OUT';
 
-	/** the column name for the SCHEDULE_GROUP_PLAYED field */
-	const SCHEDULE_GROUP_PLAYED = 'cc_schedule.SCHEDULE_GROUP_PLAYED';
-
 	/** the column name for the MEDIA_ITEM_PLAYED field */
 	const MEDIA_ITEM_PLAYED = 'cc_schedule.MEDIA_ITEM_PLAYED';
 
@@ -89,12 +80,12 @@ abstract class BaseCcSchedulePeer {
 	 * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
 	 */
 	private static $fieldNames = array (
-		BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbStarts', 'DbEnds', 'DbGroupId', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbScheduleGroupPlayed', 'DbMediaItemPlayed', 'DbInstanceId', ),
-		BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbStarts', 'dbEnds', 'dbGroupId', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbScheduleGroupPlayed', 'dbMediaItemPlayed', 'dbInstanceId', ),
-		BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::STARTS, self::ENDS, self::GROUP_ID, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::SCHEDULE_GROUP_PLAYED, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, ),
-		BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'STARTS', 'ENDS', 'GROUP_ID', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'SCHEDULE_GROUP_PLAYED', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', ),
-		BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'starts', 'ends', 'group_id', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'schedule_group_played', 'media_item_played', 'instance_id', ),
-		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
+		BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', ),
+		BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', ),
+		BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, ),
+		BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', ),
+		BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', ),
+		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
 	);
 
 	/**
@@ -104,12 +95,12 @@ abstract class BaseCcSchedulePeer {
 	 * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
 	 */
 	private static $fieldKeys = array (
-		BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbStarts' => 2, 'DbEnds' => 3, 'DbGroupId' => 4, 'DbFileId' => 5, 'DbClipLength' => 6, 'DbFadeIn' => 7, 'DbFadeOut' => 8, 'DbCueIn' => 9, 'DbCueOut' => 10, 'DbScheduleGroupPlayed' => 11, 'DbMediaItemPlayed' => 12, 'DbInstanceId' => 13, ),
-		BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbStarts' => 2, 'dbEnds' => 3, 'dbGroupId' => 4, 'dbFileId' => 5, 'dbClipLength' => 6, 'dbFadeIn' => 7, 'dbFadeOut' => 8, 'dbCueIn' => 9, 'dbCueOut' => 10, 'dbScheduleGroupPlayed' => 11, 'dbMediaItemPlayed' => 12, 'dbInstanceId' => 13, ),
-		BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::STARTS => 2, self::ENDS => 3, self::GROUP_ID => 4, self::FILE_ID => 5, self::CLIP_LENGTH => 6, self::FADE_IN => 7, self::FADE_OUT => 8, self::CUE_IN => 9, self::CUE_OUT => 10, self::SCHEDULE_GROUP_PLAYED => 11, self::MEDIA_ITEM_PLAYED => 12, self::INSTANCE_ID => 13, ),
-		BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, 'GROUP_ID' => 4, 'FILE_ID' => 5, 'CLIP_LENGTH' => 6, 'FADE_IN' => 7, 'FADE_OUT' => 8, 'CUE_IN' => 9, 'CUE_OUT' => 10, 'SCHEDULE_GROUP_PLAYED' => 11, 'MEDIA_ITEM_PLAYED' => 12, 'INSTANCE_ID' => 13, ),
-		BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'starts' => 2, 'ends' => 3, 'group_id' => 4, 'file_id' => 5, 'clip_length' => 6, 'fade_in' => 7, 'fade_out' => 8, 'cue_in' => 9, 'cue_out' => 10, 'schedule_group_played' => 11, 'media_item_played' => 12, 'instance_id' => 13, ),
-		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
+		BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbClipLength' => 4, 'DbFadeIn' => 5, 'DbFadeOut' => 6, 'DbCueIn' => 7, 'DbCueOut' => 8, 'DbMediaItemPlayed' => 9, 'DbInstanceId' => 10, ),
+		BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbClipLength' => 4, 'dbFadeIn' => 5, 'dbFadeOut' => 6, 'dbCueIn' => 7, 'dbCueOut' => 8, 'dbMediaItemPlayed' => 9, 'dbInstanceId' => 10, ),
+		BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::CLIP_LENGTH => 4, self::FADE_IN => 5, self::FADE_OUT => 6, self::CUE_IN => 7, self::CUE_OUT => 8, self::MEDIA_ITEM_PLAYED => 9, self::INSTANCE_ID => 10, ),
+		BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'CLIP_LENGTH' => 4, 'FADE_IN' => 5, 'FADE_OUT' => 6, 'CUE_IN' => 7, 'CUE_OUT' => 8, 'MEDIA_ITEM_PLAYED' => 9, 'INSTANCE_ID' => 10, ),
+		BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'clip_length' => 4, 'fade_in' => 5, 'fade_out' => 6, 'cue_in' => 7, 'cue_out' => 8, 'media_item_played' => 9, 'instance_id' => 10, ),
+		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
 	);
 
 	/**
@@ -182,32 +173,26 @@ abstract class BaseCcSchedulePeer {
 	{
 		if (null === $alias) {
 			$criteria->addSelectColumn(CcSchedulePeer::ID);
-			$criteria->addSelectColumn(CcSchedulePeer::PLAYLIST_ID);
 			$criteria->addSelectColumn(CcSchedulePeer::STARTS);
 			$criteria->addSelectColumn(CcSchedulePeer::ENDS);
-			$criteria->addSelectColumn(CcSchedulePeer::GROUP_ID);
 			$criteria->addSelectColumn(CcSchedulePeer::FILE_ID);
 			$criteria->addSelectColumn(CcSchedulePeer::CLIP_LENGTH);
 			$criteria->addSelectColumn(CcSchedulePeer::FADE_IN);
 			$criteria->addSelectColumn(CcSchedulePeer::FADE_OUT);
 			$criteria->addSelectColumn(CcSchedulePeer::CUE_IN);
 			$criteria->addSelectColumn(CcSchedulePeer::CUE_OUT);
-			$criteria->addSelectColumn(CcSchedulePeer::SCHEDULE_GROUP_PLAYED);
 			$criteria->addSelectColumn(CcSchedulePeer::MEDIA_ITEM_PLAYED);
 			$criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID);
 		} else {
 			$criteria->addSelectColumn($alias . '.ID');
-			$criteria->addSelectColumn($alias . '.PLAYLIST_ID');
 			$criteria->addSelectColumn($alias . '.STARTS');
 			$criteria->addSelectColumn($alias . '.ENDS');
-			$criteria->addSelectColumn($alias . '.GROUP_ID');
 			$criteria->addSelectColumn($alias . '.FILE_ID');
 			$criteria->addSelectColumn($alias . '.CLIP_LENGTH');
 			$criteria->addSelectColumn($alias . '.FADE_IN');
 			$criteria->addSelectColumn($alias . '.FADE_OUT');
 			$criteria->addSelectColumn($alias . '.CUE_IN');
 			$criteria->addSelectColumn($alias . '.CUE_OUT');
-			$criteria->addSelectColumn($alias . '.SCHEDULE_GROUP_PLAYED');
 			$criteria->addSelectColumn($alias . '.MEDIA_ITEM_PLAYED');
 			$criteria->addSelectColumn($alias . '.INSTANCE_ID');
 		}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php
index 11a030d84..4c661ad56 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php
@@ -7,32 +7,26 @@
  * 
  *
  * @method     CcScheduleQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method     CcScheduleQuery orderByDbPlaylistId($order = Criteria::ASC) Order by the playlist_id column
  * @method     CcScheduleQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column
  * @method     CcScheduleQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column
- * @method     CcScheduleQuery orderByDbGroupId($order = Criteria::ASC) Order by the group_id column
  * @method     CcScheduleQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
  * @method     CcScheduleQuery orderByDbClipLength($order = Criteria::ASC) Order by the clip_length column
  * @method     CcScheduleQuery orderByDbFadeIn($order = Criteria::ASC) Order by the fade_in column
  * @method     CcScheduleQuery orderByDbFadeOut($order = Criteria::ASC) Order by the fade_out column
  * @method     CcScheduleQuery orderByDbCueIn($order = Criteria::ASC) Order by the cue_in column
  * @method     CcScheduleQuery orderByDbCueOut($order = Criteria::ASC) Order by the cue_out column
- * @method     CcScheduleQuery orderByDbScheduleGroupPlayed($order = Criteria::ASC) Order by the schedule_group_played column
  * @method     CcScheduleQuery orderByDbMediaItemPlayed($order = Criteria::ASC) Order by the media_item_played column
  * @method     CcScheduleQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
  *
  * @method     CcScheduleQuery groupByDbId() Group by the id column
- * @method     CcScheduleQuery groupByDbPlaylistId() Group by the playlist_id column
  * @method     CcScheduleQuery groupByDbStarts() Group by the starts column
  * @method     CcScheduleQuery groupByDbEnds() Group by the ends column
- * @method     CcScheduleQuery groupByDbGroupId() Group by the group_id column
  * @method     CcScheduleQuery groupByDbFileId() Group by the file_id column
  * @method     CcScheduleQuery groupByDbClipLength() Group by the clip_length column
  * @method     CcScheduleQuery groupByDbFadeIn() Group by the fade_in column
  * @method     CcScheduleQuery groupByDbFadeOut() Group by the fade_out column
  * @method     CcScheduleQuery groupByDbCueIn() Group by the cue_in column
  * @method     CcScheduleQuery groupByDbCueOut() Group by the cue_out column
- * @method     CcScheduleQuery groupByDbScheduleGroupPlayed() Group by the schedule_group_played column
  * @method     CcScheduleQuery groupByDbMediaItemPlayed() Group by the media_item_played column
  * @method     CcScheduleQuery groupByDbInstanceId() Group by the instance_id column
  *
@@ -52,32 +46,26 @@
  * @method     CcSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcSchedule matching the query, or a new CcSchedule object populated from the query conditions when no match is found
  *
  * @method     CcSchedule findOneByDbId(int $id) Return the first CcSchedule filtered by the id column
- * @method     CcSchedule findOneByDbPlaylistId(int $playlist_id) Return the first CcSchedule filtered by the playlist_id column
  * @method     CcSchedule findOneByDbStarts(string $starts) Return the first CcSchedule filtered by the starts column
  * @method     CcSchedule findOneByDbEnds(string $ends) Return the first CcSchedule filtered by the ends column
- * @method     CcSchedule findOneByDbGroupId(int $group_id) Return the first CcSchedule filtered by the group_id column
  * @method     CcSchedule findOneByDbFileId(int $file_id) Return the first CcSchedule filtered by the file_id column
  * @method     CcSchedule findOneByDbClipLength(string $clip_length) Return the first CcSchedule filtered by the clip_length column
  * @method     CcSchedule findOneByDbFadeIn(string $fade_in) Return the first CcSchedule filtered by the fade_in column
  * @method     CcSchedule findOneByDbFadeOut(string $fade_out) Return the first CcSchedule filtered by the fade_out column
  * @method     CcSchedule findOneByDbCueIn(string $cue_in) Return the first CcSchedule filtered by the cue_in column
  * @method     CcSchedule findOneByDbCueOut(string $cue_out) Return the first CcSchedule filtered by the cue_out column
- * @method     CcSchedule findOneByDbScheduleGroupPlayed(boolean $schedule_group_played) Return the first CcSchedule filtered by the schedule_group_played column
  * @method     CcSchedule findOneByDbMediaItemPlayed(boolean $media_item_played) Return the first CcSchedule filtered by the media_item_played column
  * @method     CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column
  *
  * @method     array findByDbId(int $id) Return CcSchedule objects filtered by the id column
- * @method     array findByDbPlaylistId(int $playlist_id) Return CcSchedule objects filtered by the playlist_id column
  * @method     array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column
  * @method     array findByDbEnds(string $ends) Return CcSchedule objects filtered by the ends column
- * @method     array findByDbGroupId(int $group_id) Return CcSchedule objects filtered by the group_id column
  * @method     array findByDbFileId(int $file_id) Return CcSchedule objects filtered by the file_id column
  * @method     array findByDbClipLength(string $clip_length) Return CcSchedule objects filtered by the clip_length column
  * @method     array findByDbFadeIn(string $fade_in) Return CcSchedule objects filtered by the fade_in column
  * @method     array findByDbFadeOut(string $fade_out) Return CcSchedule objects filtered by the fade_out column
  * @method     array findByDbCueIn(string $cue_in) Return CcSchedule objects filtered by the cue_in column
  * @method     array findByDbCueOut(string $cue_out) Return CcSchedule objects filtered by the cue_out column
- * @method     array findByDbScheduleGroupPlayed(boolean $schedule_group_played) Return CcSchedule objects filtered by the schedule_group_played column
  * @method     array findByDbMediaItemPlayed(boolean $media_item_played) Return CcSchedule objects filtered by the media_item_played column
  * @method     array findByDbInstanceId(int $instance_id) Return CcSchedule objects filtered by the instance_id column
  *
@@ -206,37 +194,6 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
 		return $this->addUsingAlias(CcSchedulePeer::ID, $dbId, $comparison);
 	}
 
-	/**
-	 * Filter the query on the playlist_id column
-	 * 
-	 * @param     int|array $dbPlaylistId The value to use as filter.
-	 *            Accepts an associative array('min' => $minValue, 'max' => $maxValue)
-	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
-	 *
-	 * @return    CcScheduleQuery The current query, for fluid interface
-	 */
-	public function filterByDbPlaylistId($dbPlaylistId = null, $comparison = null)
-	{
-		if (is_array($dbPlaylistId)) {
-			$useMinMax = false;
-			if (isset($dbPlaylistId['min'])) {
-				$this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId['min'], Criteria::GREATER_EQUAL);
-				$useMinMax = true;
-			}
-			if (isset($dbPlaylistId['max'])) {
-				$this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId['max'], Criteria::LESS_EQUAL);
-				$useMinMax = true;
-			}
-			if ($useMinMax) {
-				return $this;
-			}
-			if (null === $comparison) {
-				$comparison = Criteria::IN;
-			}
-		}
-		return $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId, $comparison);
-	}
-
 	/**
 	 * Filter the query on the starts column
 	 * 
@@ -299,37 +256,6 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
 		return $this->addUsingAlias(CcSchedulePeer::ENDS, $dbEnds, $comparison);
 	}
 
-	/**
-	 * Filter the query on the group_id column
-	 * 
-	 * @param     int|array $dbGroupId The value to use as filter.
-	 *            Accepts an associative array('min' => $minValue, 'max' => $maxValue)
-	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
-	 *
-	 * @return    CcScheduleQuery The current query, for fluid interface
-	 */
-	public function filterByDbGroupId($dbGroupId = null, $comparison = null)
-	{
-		if (is_array($dbGroupId)) {
-			$useMinMax = false;
-			if (isset($dbGroupId['min'])) {
-				$this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId['min'], Criteria::GREATER_EQUAL);
-				$useMinMax = true;
-			}
-			if (isset($dbGroupId['max'])) {
-				$this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId['max'], Criteria::LESS_EQUAL);
-				$useMinMax = true;
-			}
-			if ($useMinMax) {
-				return $this;
-			}
-			if (null === $comparison) {
-				$comparison = Criteria::IN;
-			}
-		}
-		return $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId, $comparison);
-	}
-
 	/**
 	 * Filter the query on the file_id column
 	 * 
@@ -516,23 +442,6 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
 		return $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut, $comparison);
 	}
 
-	/**
-	 * Filter the query on the schedule_group_played column
-	 * 
-	 * @param     boolean|string $dbScheduleGroupPlayed The value to use as filter.
-	 *            Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true)
-	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
-	 *
-	 * @return    CcScheduleQuery The current query, for fluid interface
-	 */
-	public function filterByDbScheduleGroupPlayed($dbScheduleGroupPlayed = null, $comparison = null)
-	{
-		if (is_string($dbScheduleGroupPlayed)) {
-			$schedule_group_played = in_array(strtolower($dbScheduleGroupPlayed), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
-		}
-		return $this->addUsingAlias(CcSchedulePeer::SCHEDULE_GROUP_PLAYED, $dbScheduleGroupPlayed, $comparison);
-	}
-
 	/**
 	 * Filter the query on the media_item_played column
 	 * 
diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml
index edc6b2b86..9c726d804 100644
--- a/airtime_mvc/build/schema.xml
+++ b/airtime_mvc/build/schema.xml
@@ -54,7 +54,7 @@
     <column name="bit_rate" phpName="DbBitRate" type="VARCHAR" size="32" required="false"/>
     <column name="sample_rate" phpName="DbSampleRate" type="VARCHAR" size="32" required="false"/>
     <column name="format" phpName="DbFormat" type="VARCHAR" size="128" required="false"/>
-    <column name="length" phpName="DbLength" type="TIME" required="false"/>
+    <column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" defaultValue="00:00:00" required="false"/>
     <column name="album_title" phpName="DbAlbumTitle" type="VARCHAR" size="512" required="false"/>
     <column name="genre" phpName="DbGenre" type="VARCHAR" size="64" required="false"/>
     <column name="comments" phpName="DbComments" type="LONGVARCHAR" required="false"/>
@@ -270,17 +270,14 @@
   </table>
   <table name="cc_schedule" phpName="CcSchedule">
     <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
-    <column name="playlist_id" phpName="DbPlaylistId" type="INTEGER" required="false"/>
     <column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true"/>
     <column name="ends" phpName="DbEnds" type="TIMESTAMP" required="true"/>
-    <column name="group_id" phpName="DbGroupId" type="INTEGER" required="false"/>
     <column name="file_id" phpName="DbFileId" type="INTEGER" required="false"/>
     <column name="clip_length" phpName="DbClipLength" type="TIME" required="false" defaultValue="00:00:00"/>
     <column name="fade_in" phpName="DbFadeIn" type="TIME" required="false" defaultValue="00:00:00"/>
     <column name="fade_out" phpName="DbFadeOut" type="TIME" required="false" defaultValue="00:00:00"/>
     <column name="cue_in" phpName="DbCueIn" type="TIME" required="false" defaultValue="00:00:00"/>
     <column name="cue_out" phpName="DbCueOut" type="TIME" required="false" defaultValue="00:00:00"/>
-    <column name="schedule_group_played" phpName="DbScheduleGroupPlayed" type="BOOLEAN" required="false" defaultValue="0"/>
     <column name="media_item_played" phpName="DbMediaItemPlayed" type="BOOLEAN" required="false" defaultValue="0"/>
     <column name="instance_id" phpName="DbInstanceId" type="INTEGER" required="true"/>
     <!-- This foreign key is still useful even though it may seem we don't ever delete cc_show_instances anymore.
diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql
index e27b978ed..794a4aee9 100644
--- a/airtime_mvc/build/sql/schema.sql
+++ b/airtime_mvc/build/sql/schema.sql
@@ -80,7 +80,7 @@ CREATE TABLE "cc_files"
 	"bit_rate" VARCHAR(32),
 	"sample_rate" VARCHAR(32),
 	"format" VARCHAR(128),
-	"length" TIME,
+	"length" interval default '00:00:00',
 	"album_title" VARCHAR(512),
 	"genre" VARCHAR(64),
 	"comments" TEXT,
@@ -361,17 +361,14 @@ DROP TABLE "cc_schedule" CASCADE;
 CREATE TABLE "cc_schedule"
 (
 	"id" serial  NOT NULL,
-	"playlist_id" INTEGER,
 	"starts" TIMESTAMP  NOT NULL,
 	"ends" TIMESTAMP  NOT NULL,
-	"group_id" INTEGER,
 	"file_id" INTEGER,
 	"clip_length" TIME default '00:00:00',
 	"fade_in" TIME default '00:00:00',
 	"fade_out" TIME default '00:00:00',
 	"cue_in" TIME default '00:00:00',
 	"cue_out" TIME default '00:00:00',
-	"schedule_group_played" BOOLEAN default 'f',
 	"media_item_played" BOOLEAN default 'f',
 	"instance_id" INTEGER  NOT NULL,
 	PRIMARY KEY ("id")
diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js
index 7e607e45a..b003f7ae6 100644
--- a/airtime_mvc/public/js/airtime/showbuilder/builder.js
+++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js
@@ -198,7 +198,7 @@ $(document).ready(function() {
 	    /* checkbox */ {"mDataProp": "allowed", "sTitle": "<input type='checkbox' name='sb_cb_all'>", "sWidth": "15px"},
         /* starts */{"mDataProp": "starts", "sTitle": "Start"},
         /* ends */{"mDataProp": "ends", "sTitle": "End"},
-        /* runtime */{"mDataProp": "runtime", "sTitle": "Duration"},
+        /* runtime */{"mDataProp": "runtime", "sTitle": "Duration", "sClass": "library_length"},
         /* title */{"mDataProp": "title", "sTitle": "Title"},
         /* creator */{"mDataProp": "creator", "sTitle": "Creator"},
         /* album */{"mDataProp": "album", "sTitle": "Album"}