From 0db557a570289b34cc7f6c9df0cd5c67b3319df9 Mon Sep 17 00:00:00 2001 From: Naomi Date: Tue, 30 Apr 2013 15:32:43 -0400 Subject: [PATCH] CC-2301 : fades editor saving offset to database for playlists and smart blocks. --- .../controllers/PlaylistController.php | 13 +-- airtime_mvc/application/models/Block.php | 31 +++++- airtime_mvc/application/models/Playlist.php | 16 +-- .../airtime/map/CcBlockcontentsTableMap.php | 1 + .../map/CcPlaylistcontentsTableMap.php | 2 +- .../models/airtime/om/BaseCcBlockcontents.php | 102 +++++++++++++----- .../airtime/om/BaseCcBlockcontentsPeer.php | 31 +++--- .../airtime/om/BaseCcBlockcontentsQuery.php | 35 ++++++ .../airtime/om/BaseCcPlaylistcontents.php | 42 ++++---- .../airtime/om/BaseCcPlaylistcontentsPeer.php | 28 ++--- .../om/BaseCcPlaylistcontentsQuery.php | 26 ++--- .../views/scripts/playlist/set-fade.phtml | 4 +- airtime_mvc/build/schema.xml | 3 +- airtime_mvc/build/sql/schema.sql | 3 +- airtime_mvc/public/js/airtime/library/spl.js | 66 +++++++++++- 15 files changed, 295 insertions(+), 108 deletions(-) diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index a52c7ea15..1134499ce 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -10,6 +10,7 @@ class PlaylistController extends Zend_Controller_Action ->addActionContext('move-items', 'json') ->addActionContext('delete-items', 'json') ->addActionContext('set-fade', 'json') + ->addActionContext('set-crossfade', 'json') ->addActionContext('set-cue', 'json') ->addActionContext('new', 'json') ->addActionContext('edit', 'json') @@ -418,23 +419,23 @@ class PlaylistController extends Zend_Controller_Action } } - public function setCrossFadeAction() + public function setCrossfadeAction() { - $id = $this->_getParam('id'); + $id1 = $this->_getParam('id1'); + $id2 = $this->_getParam('id2'); + $type = $this->_getParam('type'); $fadeIn = $this->_getParam('fadeIn', 0); $fadeOut = $this->_getParam('fadeOut', 0); - $type = $this->_getParam('type'); $offset = $this->_getParam('offset', 0); try { $obj = $this->getPlaylist($type); - $response = $obj->changeFadeInfo($id, $fadeIn, $fadeOut); + $response = $obj->createCrossfade($id1, $fadeOut, $id2, $fadeIn, $offset); if (!isset($response["error"])) { $this->createUpdateResponse($obj); - $this->view->response = $response; } else { - $this->view->fade_error = $response["error"]; + $this->view->error = $response["error"]; } } catch (PlaylistOutDatedException $e) { $this->playlistOutdated($e); diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index b15f0d633..83a22947e 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -669,6 +669,29 @@ SQL; return array($fadeIn, $fadeOut); } + + /* + * create a crossfade from item in cc_playlist_contents with $id1 to item $id2. + * + * $fadeOut length of fade out in seconds if $id1 + * $fadeIn length of fade in in seconds of $id2 + * $offset time in seconds from end of $id1 that $id2 will begin to play. + */ + public function createCrossfade($id1, $fadeOut, $id2, $fadeIn, $offset) + { + $this->con->beginTransaction(); + + try { + $this->changeFadeInfo($id1, null, $fadeOut); + $this->changeFadeInfo($id2, $fadeIn, null, $offset); + + $this->con->commit(); + + } catch (Exception $e) { + $this->con->rollback(); + throw $e; + } + } /** * Change fadeIn and fadeOut values for block Element @@ -681,7 +704,7 @@ SQL; * new value in ss.ssssss or extent format * @return boolean */ - public function changeFadeInfo($id, $fadeIn, $fadeOut) + public function changeFadeInfo($id, $fadeIn, $fadeOut, $offset=null) { //See issue CC-2065, pad the fadeIn and fadeOut so that it is TIME compatable with the DB schema //For the top level PlayList either fadeIn or fadeOut will sometimes be Null so need a gaurd against @@ -715,6 +738,12 @@ SQL; } $row->setDbFadein($fadeIn); + if (!is_null($offset)) { + $row->setDbTrackOffset($offset); + Logging::info("Setting offset {$offset} on item {$id}"); + $row->save($this->con); + } + } if (!is_null($fadeOut)) { diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php index 388af70fc..ad734df3f 100644 --- a/airtime_mvc/application/models/Playlist.php +++ b/airtime_mvc/application/models/Playlist.php @@ -653,17 +653,13 @@ SQL; * $fadeIn length of fade in in seconds of $id2 * $offset time in seconds from end of $id1 that $id2 will begin to play. */ - public function createCrossfade($id1, $id2, $fadeIn, $fadeOut, $offset) + public function createCrossfade($id1, $fadeOut, $id2, $fadeIn, $offset) { $this->con->beginTransaction(); try { $this->changeFadeInfo($id1, null, $fadeOut); - $this->changeFadeInfo($id2, $fadeIn, null); - - $item = CcPlaylistcontentsQuery::create()->findPK($id2); - $item->setDbOffset($offset); - $item->save($this->con); + $this->changeFadeInfo($id2, $fadeIn, null, $offset); $this->con->commit(); @@ -684,7 +680,7 @@ SQL; * new value in ss.ssssss or extent format * @return boolean */ - public function changeFadeInfo($id, $fadeIn, $fadeOut) + public function changeFadeInfo($id, $fadeIn, $fadeOut, $offset=null) { //See issue CC-2065, pad the fadeIn and fadeOut so that it is TIME compatable with the DB schema //For the top level PlayList either fadeIn or fadeOut will sometimes be Null so need a gaurd against @@ -710,6 +706,12 @@ SQL; $fadeIn = $clipLength; } $row->setDbFadein($fadeIn); + + if (!is_null($offset)) { + $row->setDbTrackOffset($offset); + Logging::info("Setting offset {$offset} on item {$id}"); + $row->save($this->con); + } } if (!is_null($fadeOut)) { diff --git a/airtime_mvc/application/models/airtime/map/CcBlockcontentsTableMap.php b/airtime_mvc/application/models/airtime/map/CcBlockcontentsTableMap.php index b366a1adf..ec74e8b7e 100644 --- a/airtime_mvc/application/models/airtime/map/CcBlockcontentsTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcBlockcontentsTableMap.php @@ -42,6 +42,7 @@ class CcBlockcontentsTableMap extends TableMap { $this->addForeignKey('BLOCK_ID', 'DbBlockId', 'INTEGER', 'cc_block', 'ID', false, null, null); $this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null); $this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null); + $this->addColumn('TRACKOFFSET', 'DbTrackOffset', 'REAL', true, null, 0); $this->addColumn('CLIPLENGTH', 'DbCliplength', 'VARCHAR', false, null, '00:00:00'); $this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00'); $this->addColumn('CUEOUT', 'DbCueout', 'VARCHAR', false, null, '00:00:00'); diff --git a/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php index af6eddd10..3122f64d5 100644 --- a/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php @@ -45,7 +45,7 @@ class CcPlaylistcontentsTableMap extends TableMap { $this->addColumn('STREAM_ID', 'DbStreamId', 'INTEGER', false, null, null); $this->addColumn('TYPE', 'DbType', 'SMALLINT', true, null, 0); $this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null); - $this->addColumn('OFFSET', 'DbOffset', 'REAL', true, null, 0); + $this->addColumn('TRACKOFFSET', 'DbTrackOffset', 'REAL', true, null, 0); $this->addColumn('CLIPLENGTH', 'DbCliplength', 'VARCHAR', false, null, '00:00:00'); $this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00'); $this->addColumn('CUEOUT', 'DbCueout', 'VARCHAR', false, null, '00:00:00'); diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php index d6beab8b4..f2e6fb6d1 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php @@ -48,6 +48,13 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent */ protected $position; + /** + * The value for the trackoffset field. + * Note: this column has a database default value of: 0 + * @var double + */ + protected $trackoffset; + /** * The value for the cliplength field. * Note: this column has a database default value of: '00:00:00' @@ -118,6 +125,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent */ public function applyDefaultValues() { + $this->trackoffset = 0; $this->cliplength = '00:00:00'; $this->cuein = '00:00:00'; $this->cueout = '00:00:00'; @@ -175,6 +183,16 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent return $this->position; } + /** + * Get the [trackoffset] column value. + * + * @return double + */ + public function getDbTrackOffset() + { + return $this->trackoffset; + } + /** * Get the [cliplength] column value. * @@ -359,6 +377,26 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent return $this; } // setDbPosition() + /** + * Set the value of [trackoffset] column. + * + * @param double $v new value + * @return CcBlockcontents The current object (for fluent API support) + */ + public function setDbTrackOffset($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->trackoffset !== $v || $this->isNew()) { + $this->trackoffset = $v; + $this->modifiedColumns[] = CcBlockcontentsPeer::TRACKOFFSET; + } + + return $this; + } // setDbTrackOffset() + /** * Set the value of [cliplength] column. * @@ -529,6 +567,10 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent */ public function hasOnlyDefaultValues() { + if ($this->trackoffset !== 0) { + return false; + } + if ($this->cliplength !== '00:00:00') { return false; } @@ -575,11 +617,12 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent $this->block_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; $this->file_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; $this->position = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; - $this->cliplength = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->cuein = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->cueout = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->fadein = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->fadeout = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->trackoffset = ($row[$startcol + 4] !== null) ? (double) $row[$startcol + 4] : null; + $this->cliplength = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->cuein = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->cueout = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->fadein = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->fadeout = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; $this->resetModified(); $this->setNew(false); @@ -588,7 +631,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent $this->ensureConsistency(); } - return $startcol + 9; // 9 = CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 10; // 10 = CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating CcBlockcontents object", $e); @@ -947,18 +990,21 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent return $this->getDbPosition(); break; case 4: - return $this->getDbCliplength(); + return $this->getDbTrackOffset(); break; case 5: - return $this->getDbCuein(); + return $this->getDbCliplength(); break; case 6: - return $this->getDbCueout(); + return $this->getDbCuein(); break; case 7: - return $this->getDbFadein(); + return $this->getDbCueout(); break; case 8: + return $this->getDbFadein(); + break; + case 9: return $this->getDbFadeout(); break; default: @@ -989,11 +1035,12 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent $keys[1] => $this->getDbBlockId(), $keys[2] => $this->getDbFileId(), $keys[3] => $this->getDbPosition(), - $keys[4] => $this->getDbCliplength(), - $keys[5] => $this->getDbCuein(), - $keys[6] => $this->getDbCueout(), - $keys[7] => $this->getDbFadein(), - $keys[8] => $this->getDbFadeout(), + $keys[4] => $this->getDbTrackOffset(), + $keys[5] => $this->getDbCliplength(), + $keys[6] => $this->getDbCuein(), + $keys[7] => $this->getDbCueout(), + $keys[8] => $this->getDbFadein(), + $keys[9] => $this->getDbFadeout(), ); if ($includeForeignObjects) { if (null !== $this->aCcFiles) { @@ -1046,18 +1093,21 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent $this->setDbPosition($value); break; case 4: - $this->setDbCliplength($value); + $this->setDbTrackOffset($value); break; case 5: - $this->setDbCuein($value); + $this->setDbCliplength($value); break; case 6: - $this->setDbCueout($value); + $this->setDbCuein($value); break; case 7: - $this->setDbFadein($value); + $this->setDbCueout($value); break; case 8: + $this->setDbFadein($value); + break; + case 9: $this->setDbFadeout($value); break; } // switch() @@ -1088,11 +1138,12 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent if (array_key_exists($keys[1], $arr)) $this->setDbBlockId($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setDbFileId($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setDbPosition($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDbCliplength($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setDbCuein($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setDbCueout($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[4], $arr)) $this->setDbTrackOffset($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDbCliplength($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbCuein($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDbCueout($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setDbFadein($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setDbFadeout($arr[$keys[9]]); } /** @@ -1108,6 +1159,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent if ($this->isColumnModified(CcBlockcontentsPeer::BLOCK_ID)) $criteria->add(CcBlockcontentsPeer::BLOCK_ID, $this->block_id); if ($this->isColumnModified(CcBlockcontentsPeer::FILE_ID)) $criteria->add(CcBlockcontentsPeer::FILE_ID, $this->file_id); if ($this->isColumnModified(CcBlockcontentsPeer::POSITION)) $criteria->add(CcBlockcontentsPeer::POSITION, $this->position); + if ($this->isColumnModified(CcBlockcontentsPeer::TRACKOFFSET)) $criteria->add(CcBlockcontentsPeer::TRACKOFFSET, $this->trackoffset); if ($this->isColumnModified(CcBlockcontentsPeer::CLIPLENGTH)) $criteria->add(CcBlockcontentsPeer::CLIPLENGTH, $this->cliplength); if ($this->isColumnModified(CcBlockcontentsPeer::CUEIN)) $criteria->add(CcBlockcontentsPeer::CUEIN, $this->cuein); if ($this->isColumnModified(CcBlockcontentsPeer::CUEOUT)) $criteria->add(CcBlockcontentsPeer::CUEOUT, $this->cueout); @@ -1177,6 +1229,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent $copyObj->setDbBlockId($this->block_id); $copyObj->setDbFileId($this->file_id); $copyObj->setDbPosition($this->position); + $copyObj->setDbTrackOffset($this->trackoffset); $copyObj->setDbCliplength($this->cliplength); $copyObj->setDbCuein($this->cuein); $copyObj->setDbCueout($this->cueout); @@ -1336,6 +1389,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent $this->block_id = null; $this->file_id = null; $this->position = null; + $this->trackoffset = null; $this->cliplength = null; $this->cuein = null; $this->cueout = null; diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsPeer.php index 7bee15279..6cdb1e265 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsPeer.php @@ -26,7 +26,7 @@ abstract class BaseCcBlockcontentsPeer { const TM_CLASS = 'CcBlockcontentsTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 9; + const NUM_COLUMNS = 10; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -43,6 +43,9 @@ abstract class BaseCcBlockcontentsPeer { /** the column name for the POSITION field */ const POSITION = 'cc_blockcontents.POSITION'; + /** the column name for the TRACKOFFSET field */ + const TRACKOFFSET = 'cc_blockcontents.TRACKOFFSET'; + /** the column name for the CLIPLENGTH field */ const CLIPLENGTH = 'cc_blockcontents.CLIPLENGTH'; @@ -74,12 +77,12 @@ abstract class BaseCcBlockcontentsPeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbBlockId', 'DbFileId', 'DbPosition', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbBlockId', 'dbFileId', 'dbPosition', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::BLOCK_ID, self::FILE_ID, self::POSITION, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'BLOCK_ID', 'FILE_ID', 'POSITION', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'block_id', 'file_id', 'position', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbBlockId', 'DbFileId', 'DbPosition', 'DbTrackOffset', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbBlockId', 'dbFileId', 'dbPosition', 'dbTrackOffset', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::BLOCK_ID, self::FILE_ID, self::POSITION, self::TRACKOFFSET, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'BLOCK_ID', 'FILE_ID', 'POSITION', 'TRACKOFFSET', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'block_id', 'file_id', 'position', 'trackoffset', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) ); /** @@ -89,12 +92,12 @@ abstract class BaseCcBlockcontentsPeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbBlockId' => 1, 'DbFileId' => 2, 'DbPosition' => 3, 'DbCliplength' => 4, 'DbCuein' => 5, 'DbCueout' => 6, 'DbFadein' => 7, 'DbFadeout' => 8, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbBlockId' => 1, 'dbFileId' => 2, 'dbPosition' => 3, 'dbCliplength' => 4, 'dbCuein' => 5, 'dbCueout' => 6, 'dbFadein' => 7, 'dbFadeout' => 8, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::BLOCK_ID => 1, self::FILE_ID => 2, self::POSITION => 3, self::CLIPLENGTH => 4, self::CUEIN => 5, self::CUEOUT => 6, self::FADEIN => 7, self::FADEOUT => 8, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'BLOCK_ID' => 1, 'FILE_ID' => 2, 'POSITION' => 3, 'CLIPLENGTH' => 4, 'CUEIN' => 5, 'CUEOUT' => 6, 'FADEIN' => 7, 'FADEOUT' => 8, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'block_id' => 1, 'file_id' => 2, 'position' => 3, 'cliplength' => 4, 'cuein' => 5, 'cueout' => 6, 'fadein' => 7, 'fadeout' => 8, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbBlockId' => 1, 'DbFileId' => 2, 'DbPosition' => 3, 'DbTrackOffset' => 4, 'DbCliplength' => 5, 'DbCuein' => 6, 'DbCueout' => 7, 'DbFadein' => 8, 'DbFadeout' => 9, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbBlockId' => 1, 'dbFileId' => 2, 'dbPosition' => 3, 'dbTrackOffset' => 4, 'dbCliplength' => 5, 'dbCuein' => 6, 'dbCueout' => 7, 'dbFadein' => 8, 'dbFadeout' => 9, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::BLOCK_ID => 1, self::FILE_ID => 2, self::POSITION => 3, self::TRACKOFFSET => 4, self::CLIPLENGTH => 5, self::CUEIN => 6, self::CUEOUT => 7, self::FADEIN => 8, self::FADEOUT => 9, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'BLOCK_ID' => 1, 'FILE_ID' => 2, 'POSITION' => 3, 'TRACKOFFSET' => 4, 'CLIPLENGTH' => 5, 'CUEIN' => 6, 'CUEOUT' => 7, 'FADEIN' => 8, 'FADEOUT' => 9, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'block_id' => 1, 'file_id' => 2, 'position' => 3, 'trackoffset' => 4, 'cliplength' => 5, 'cuein' => 6, 'cueout' => 7, 'fadein' => 8, 'fadeout' => 9, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) ); /** @@ -170,6 +173,7 @@ abstract class BaseCcBlockcontentsPeer { $criteria->addSelectColumn(CcBlockcontentsPeer::BLOCK_ID); $criteria->addSelectColumn(CcBlockcontentsPeer::FILE_ID); $criteria->addSelectColumn(CcBlockcontentsPeer::POSITION); + $criteria->addSelectColumn(CcBlockcontentsPeer::TRACKOFFSET); $criteria->addSelectColumn(CcBlockcontentsPeer::CLIPLENGTH); $criteria->addSelectColumn(CcBlockcontentsPeer::CUEIN); $criteria->addSelectColumn(CcBlockcontentsPeer::CUEOUT); @@ -180,6 +184,7 @@ abstract class BaseCcBlockcontentsPeer { $criteria->addSelectColumn($alias . '.BLOCK_ID'); $criteria->addSelectColumn($alias . '.FILE_ID'); $criteria->addSelectColumn($alias . '.POSITION'); + $criteria->addSelectColumn($alias . '.TRACKOFFSET'); $criteria->addSelectColumn($alias . '.CLIPLENGTH'); $criteria->addSelectColumn($alias . '.CUEIN'); $criteria->addSelectColumn($alias . '.CUEOUT'); diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsQuery.php index 6cc00d53c..f648e3640 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsQuery.php @@ -10,6 +10,7 @@ * @method CcBlockcontentsQuery orderByDbBlockId($order = Criteria::ASC) Order by the block_id column * @method CcBlockcontentsQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column * @method CcBlockcontentsQuery orderByDbPosition($order = Criteria::ASC) Order by the position column + * @method CcBlockcontentsQuery orderByDbTrackOffset($order = Criteria::ASC) Order by the trackoffset column * @method CcBlockcontentsQuery orderByDbCliplength($order = Criteria::ASC) Order by the cliplength column * @method CcBlockcontentsQuery orderByDbCuein($order = Criteria::ASC) Order by the cuein column * @method CcBlockcontentsQuery orderByDbCueout($order = Criteria::ASC) Order by the cueout column @@ -20,6 +21,7 @@ * @method CcBlockcontentsQuery groupByDbBlockId() Group by the block_id column * @method CcBlockcontentsQuery groupByDbFileId() Group by the file_id column * @method CcBlockcontentsQuery groupByDbPosition() Group by the position column + * @method CcBlockcontentsQuery groupByDbTrackOffset() Group by the trackoffset column * @method CcBlockcontentsQuery groupByDbCliplength() Group by the cliplength column * @method CcBlockcontentsQuery groupByDbCuein() Group by the cuein column * @method CcBlockcontentsQuery groupByDbCueout() Group by the cueout column @@ -45,6 +47,7 @@ * @method CcBlockcontents findOneByDbBlockId(int $block_id) Return the first CcBlockcontents filtered by the block_id column * @method CcBlockcontents findOneByDbFileId(int $file_id) Return the first CcBlockcontents filtered by the file_id column * @method CcBlockcontents findOneByDbPosition(int $position) Return the first CcBlockcontents filtered by the position column + * @method CcBlockcontents findOneByDbTrackOffset(double $trackoffset) Return the first CcBlockcontents filtered by the trackoffset column * @method CcBlockcontents findOneByDbCliplength(string $cliplength) Return the first CcBlockcontents filtered by the cliplength column * @method CcBlockcontents findOneByDbCuein(string $cuein) Return the first CcBlockcontents filtered by the cuein column * @method CcBlockcontents findOneByDbCueout(string $cueout) Return the first CcBlockcontents filtered by the cueout column @@ -55,6 +58,7 @@ * @method array findByDbBlockId(int $block_id) Return CcBlockcontents objects filtered by the block_id column * @method array findByDbFileId(int $file_id) Return CcBlockcontents objects filtered by the file_id column * @method array findByDbPosition(int $position) Return CcBlockcontents objects filtered by the position column + * @method array findByDbTrackOffset(double $trackoffset) Return CcBlockcontents objects filtered by the trackoffset column * @method array findByDbCliplength(string $cliplength) Return CcBlockcontents objects filtered by the cliplength column * @method array findByDbCuein(string $cuein) Return CcBlockcontents objects filtered by the cuein column * @method array findByDbCueout(string $cueout) Return CcBlockcontents objects filtered by the cueout column @@ -279,6 +283,37 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria return $this->addUsingAlias(CcBlockcontentsPeer::POSITION, $dbPosition, $comparison); } + /** + * Filter the query on the trackoffset column + * + * @param double|array $dbTrackOffset 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 CcBlockcontentsQuery The current query, for fluid interface + */ + public function filterByDbTrackOffset($dbTrackOffset = null, $comparison = null) + { + if (is_array($dbTrackOffset)) { + $useMinMax = false; + if (isset($dbTrackOffset['min'])) { + $this->addUsingAlias(CcBlockcontentsPeer::TRACKOFFSET, $dbTrackOffset['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbTrackOffset['max'])) { + $this->addUsingAlias(CcBlockcontentsPeer::TRACKOFFSET, $dbTrackOffset['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcBlockcontentsPeer::TRACKOFFSET, $dbTrackOffset, $comparison); + } + /** * Filter the query on the cliplength column * diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php index f7d66a9c6..cf6e53a98 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php @@ -68,11 +68,11 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent protected $position; /** - * The value for the offset field. + * The value for the trackoffset field. * Note: this column has a database default value of: 0 * @var double */ - protected $offset; + protected $trackoffset; /** * The value for the cliplength field. @@ -150,7 +150,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent public function applyDefaultValues() { $this->type = 0; - $this->offset = 0; + $this->trackoffset = 0; $this->cliplength = '00:00:00'; $this->cuein = '00:00:00'; $this->cueout = '00:00:00'; @@ -239,13 +239,13 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent } /** - * Get the [offset] column value. + * Get the [trackoffset] column value. * * @return double */ - public function getDbOffset() + public function getDbTrackOffset() { - return $this->offset; + return $this->trackoffset; } /** @@ -497,24 +497,24 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent } // setDbPosition() /** - * Set the value of [offset] column. + * Set the value of [trackoffset] column. * * @param double $v new value * @return CcPlaylistcontents The current object (for fluent API support) */ - public function setDbOffset($v) + public function setDbTrackOffset($v) { if ($v !== null) { $v = (double) $v; } - if ($this->offset !== $v || $this->isNew()) { - $this->offset = $v; - $this->modifiedColumns[] = CcPlaylistcontentsPeer::OFFSET; + if ($this->trackoffset !== $v || $this->isNew()) { + $this->trackoffset = $v; + $this->modifiedColumns[] = CcPlaylistcontentsPeer::TRACKOFFSET; } return $this; - } // setDbOffset() + } // setDbTrackOffset() /** * Set the value of [cliplength] column. @@ -690,7 +690,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent return false; } - if ($this->offset !== 0) { + if ($this->trackoffset !== 0) { return false; } @@ -743,7 +743,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $this->stream_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; $this->type = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; $this->position = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; - $this->offset = ($row[$startcol + 7] !== null) ? (double) $row[$startcol + 7] : null; + $this->trackoffset = ($row[$startcol + 7] !== null) ? (double) $row[$startcol + 7] : null; $this->cliplength = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; $this->cuein = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; $this->cueout = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; @@ -1142,7 +1142,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent return $this->getDbPosition(); break; case 7: - return $this->getDbOffset(); + return $this->getDbTrackOffset(); break; case 8: return $this->getDbCliplength(); @@ -1190,7 +1190,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $keys[4] => $this->getDbStreamId(), $keys[5] => $this->getDbType(), $keys[6] => $this->getDbPosition(), - $keys[7] => $this->getDbOffset(), + $keys[7] => $this->getDbTrackOffset(), $keys[8] => $this->getDbCliplength(), $keys[9] => $this->getDbCuein(), $keys[10] => $this->getDbCueout(), @@ -1260,7 +1260,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $this->setDbPosition($value); break; case 7: - $this->setDbOffset($value); + $this->setDbTrackOffset($value); break; case 8: $this->setDbCliplength($value); @@ -1308,7 +1308,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent if (array_key_exists($keys[4], $arr)) $this->setDbStreamId($arr[$keys[4]]); if (array_key_exists($keys[5], $arr)) $this->setDbType($arr[$keys[5]]); if (array_key_exists($keys[6], $arr)) $this->setDbPosition($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setDbOffset($arr[$keys[7]]); + if (array_key_exists($keys[7], $arr)) $this->setDbTrackOffset($arr[$keys[7]]); if (array_key_exists($keys[8], $arr)) $this->setDbCliplength($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]]); @@ -1332,7 +1332,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent if ($this->isColumnModified(CcPlaylistcontentsPeer::STREAM_ID)) $criteria->add(CcPlaylistcontentsPeer::STREAM_ID, $this->stream_id); if ($this->isColumnModified(CcPlaylistcontentsPeer::TYPE)) $criteria->add(CcPlaylistcontentsPeer::TYPE, $this->type); if ($this->isColumnModified(CcPlaylistcontentsPeer::POSITION)) $criteria->add(CcPlaylistcontentsPeer::POSITION, $this->position); - if ($this->isColumnModified(CcPlaylistcontentsPeer::OFFSET)) $criteria->add(CcPlaylistcontentsPeer::OFFSET, $this->offset); + if ($this->isColumnModified(CcPlaylistcontentsPeer::TRACKOFFSET)) $criteria->add(CcPlaylistcontentsPeer::TRACKOFFSET, $this->trackoffset); if ($this->isColumnModified(CcPlaylistcontentsPeer::CLIPLENGTH)) $criteria->add(CcPlaylistcontentsPeer::CLIPLENGTH, $this->cliplength); if ($this->isColumnModified(CcPlaylistcontentsPeer::CUEIN)) $criteria->add(CcPlaylistcontentsPeer::CUEIN, $this->cuein); if ($this->isColumnModified(CcPlaylistcontentsPeer::CUEOUT)) $criteria->add(CcPlaylistcontentsPeer::CUEOUT, $this->cueout); @@ -1405,7 +1405,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $copyObj->setDbStreamId($this->stream_id); $copyObj->setDbType($this->type); $copyObj->setDbPosition($this->position); - $copyObj->setDbOffset($this->offset); + $copyObj->setDbTrackOffset($this->trackoffset); $copyObj->setDbCliplength($this->cliplength); $copyObj->setDbCuein($this->cuein); $copyObj->setDbCueout($this->cueout); @@ -1617,7 +1617,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $this->stream_id = null; $this->type = null; $this->position = null; - $this->offset = null; + $this->trackoffset = null; $this->cliplength = null; $this->cuein = null; $this->cueout = null; diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php index 6645977ea..0e23f44c3 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php @@ -52,8 +52,8 @@ abstract class BaseCcPlaylistcontentsPeer { /** the column name for the POSITION field */ const POSITION = 'cc_playlistcontents.POSITION'; - /** the column name for the OFFSET field */ - const OFFSET = 'cc_playlistcontents.OFFSET'; + /** the column name for the TRACKOFFSET field */ + const TRACKOFFSET = 'cc_playlistcontents.TRACKOFFSET'; /** the column name for the CLIPLENGTH field */ const CLIPLENGTH = 'cc_playlistcontents.CLIPLENGTH'; @@ -86,11 +86,11 @@ abstract class BaseCcPlaylistcontentsPeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbFileId', 'DbBlockId', 'DbStreamId', 'DbType', 'DbPosition', 'DbOffset', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbFileId', 'dbBlockId', 'dbStreamId', 'dbType', 'dbPosition', 'dbOffset', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::FILE_ID, self::BLOCK_ID, self::STREAM_ID, self::TYPE, self::POSITION, self::OFFSET, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'FILE_ID', 'BLOCK_ID', 'STREAM_ID', 'TYPE', 'POSITION', 'OFFSET', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'file_id', 'block_id', 'stream_id', 'type', 'position', 'offset', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ), + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbFileId', 'DbBlockId', 'DbStreamId', 'DbType', 'DbPosition', 'DbTrackOffset', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbFileId', 'dbBlockId', 'dbStreamId', 'dbType', 'dbPosition', 'dbTrackOffset', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::FILE_ID, self::BLOCK_ID, self::STREAM_ID, self::TYPE, self::POSITION, self::TRACKOFFSET, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'FILE_ID', 'BLOCK_ID', 'STREAM_ID', 'TYPE', 'POSITION', 'TRACKOFFSET', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'file_id', 'block_id', 'stream_id', 'type', 'position', 'trackoffset', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ), BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) ); @@ -101,11 +101,11 @@ abstract class BaseCcPlaylistcontentsPeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbFileId' => 2, 'DbBlockId' => 3, 'DbStreamId' => 4, 'DbType' => 5, 'DbPosition' => 6, 'DbOffset' => 7, 'DbCliplength' => 8, 'DbCuein' => 9, 'DbCueout' => 10, 'DbFadein' => 11, 'DbFadeout' => 12, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbFileId' => 2, 'dbBlockId' => 3, 'dbStreamId' => 4, 'dbType' => 5, 'dbPosition' => 6, 'dbOffset' => 7, 'dbCliplength' => 8, 'dbCuein' => 9, 'dbCueout' => 10, 'dbFadein' => 11, 'dbFadeout' => 12, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::FILE_ID => 2, self::BLOCK_ID => 3, self::STREAM_ID => 4, self::TYPE => 5, self::POSITION => 6, self::OFFSET => 7, self::CLIPLENGTH => 8, self::CUEIN => 9, self::CUEOUT => 10, self::FADEIN => 11, self::FADEOUT => 12, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'FILE_ID' => 2, 'BLOCK_ID' => 3, 'STREAM_ID' => 4, 'TYPE' => 5, 'POSITION' => 6, 'OFFSET' => 7, 'CLIPLENGTH' => 8, 'CUEIN' => 9, 'CUEOUT' => 10, 'FADEIN' => 11, 'FADEOUT' => 12, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'file_id' => 2, 'block_id' => 3, 'stream_id' => 4, 'type' => 5, 'position' => 6, 'offset' => 7, 'cliplength' => 8, 'cuein' => 9, 'cueout' => 10, 'fadein' => 11, 'fadeout' => 12, ), + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbFileId' => 2, 'DbBlockId' => 3, 'DbStreamId' => 4, 'DbType' => 5, 'DbPosition' => 6, 'DbTrackOffset' => 7, 'DbCliplength' => 8, 'DbCuein' => 9, 'DbCueout' => 10, 'DbFadein' => 11, 'DbFadeout' => 12, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbFileId' => 2, 'dbBlockId' => 3, 'dbStreamId' => 4, 'dbType' => 5, 'dbPosition' => 6, 'dbTrackOffset' => 7, 'dbCliplength' => 8, 'dbCuein' => 9, 'dbCueout' => 10, 'dbFadein' => 11, 'dbFadeout' => 12, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::FILE_ID => 2, self::BLOCK_ID => 3, self::STREAM_ID => 4, self::TYPE => 5, self::POSITION => 6, self::TRACKOFFSET => 7, self::CLIPLENGTH => 8, self::CUEIN => 9, self::CUEOUT => 10, self::FADEIN => 11, self::FADEOUT => 12, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'FILE_ID' => 2, 'BLOCK_ID' => 3, 'STREAM_ID' => 4, 'TYPE' => 5, 'POSITION' => 6, 'TRACKOFFSET' => 7, 'CLIPLENGTH' => 8, 'CUEIN' => 9, 'CUEOUT' => 10, 'FADEIN' => 11, 'FADEOUT' => 12, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'file_id' => 2, 'block_id' => 3, 'stream_id' => 4, 'type' => 5, 'position' => 6, 'trackoffset' => 7, 'cliplength' => 8, 'cuein' => 9, 'cueout' => 10, 'fadein' => 11, 'fadeout' => 12, ), BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) ); @@ -185,7 +185,7 @@ abstract class BaseCcPlaylistcontentsPeer { $criteria->addSelectColumn(CcPlaylistcontentsPeer::STREAM_ID); $criteria->addSelectColumn(CcPlaylistcontentsPeer::TYPE); $criteria->addSelectColumn(CcPlaylistcontentsPeer::POSITION); - $criteria->addSelectColumn(CcPlaylistcontentsPeer::OFFSET); + $criteria->addSelectColumn(CcPlaylistcontentsPeer::TRACKOFFSET); $criteria->addSelectColumn(CcPlaylistcontentsPeer::CLIPLENGTH); $criteria->addSelectColumn(CcPlaylistcontentsPeer::CUEIN); $criteria->addSelectColumn(CcPlaylistcontentsPeer::CUEOUT); @@ -199,7 +199,7 @@ abstract class BaseCcPlaylistcontentsPeer { $criteria->addSelectColumn($alias . '.STREAM_ID'); $criteria->addSelectColumn($alias . '.TYPE'); $criteria->addSelectColumn($alias . '.POSITION'); - $criteria->addSelectColumn($alias . '.OFFSET'); + $criteria->addSelectColumn($alias . '.TRACKOFFSET'); $criteria->addSelectColumn($alias . '.CLIPLENGTH'); $criteria->addSelectColumn($alias . '.CUEIN'); $criteria->addSelectColumn($alias . '.CUEOUT'); diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php index d70d1dd17..ef3d3877a 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php @@ -13,7 +13,7 @@ * @method CcPlaylistcontentsQuery orderByDbStreamId($order = Criteria::ASC) Order by the stream_id column * @method CcPlaylistcontentsQuery orderByDbType($order = Criteria::ASC) Order by the type column * @method CcPlaylistcontentsQuery orderByDbPosition($order = Criteria::ASC) Order by the position column - * @method CcPlaylistcontentsQuery orderByDbOffset($order = Criteria::ASC) Order by the offset column + * @method CcPlaylistcontentsQuery orderByDbTrackOffset($order = Criteria::ASC) Order by the trackoffset column * @method CcPlaylistcontentsQuery orderByDbCliplength($order = Criteria::ASC) Order by the cliplength column * @method CcPlaylistcontentsQuery orderByDbCuein($order = Criteria::ASC) Order by the cuein column * @method CcPlaylistcontentsQuery orderByDbCueout($order = Criteria::ASC) Order by the cueout column @@ -27,7 +27,7 @@ * @method CcPlaylistcontentsQuery groupByDbStreamId() Group by the stream_id column * @method CcPlaylistcontentsQuery groupByDbType() Group by the type column * @method CcPlaylistcontentsQuery groupByDbPosition() Group by the position column - * @method CcPlaylistcontentsQuery groupByDbOffset() Group by the offset column + * @method CcPlaylistcontentsQuery groupByDbTrackOffset() Group by the trackoffset column * @method CcPlaylistcontentsQuery groupByDbCliplength() Group by the cliplength column * @method CcPlaylistcontentsQuery groupByDbCuein() Group by the cuein column * @method CcPlaylistcontentsQuery groupByDbCueout() Group by the cueout column @@ -60,7 +60,7 @@ * @method CcPlaylistcontents findOneByDbStreamId(int $stream_id) Return the first CcPlaylistcontents filtered by the stream_id column * @method CcPlaylistcontents findOneByDbType(int $type) Return the first CcPlaylistcontents filtered by the type column * @method CcPlaylistcontents findOneByDbPosition(int $position) Return the first CcPlaylistcontents filtered by the position column - * @method CcPlaylistcontents findOneByDbOffset(double $offset) Return the first CcPlaylistcontents filtered by the offset column + * @method CcPlaylistcontents findOneByDbTrackOffset(double $trackoffset) Return the first CcPlaylistcontents filtered by the trackoffset column * @method CcPlaylistcontents findOneByDbCliplength(string $cliplength) Return the first CcPlaylistcontents filtered by the cliplength column * @method CcPlaylistcontents findOneByDbCuein(string $cuein) Return the first CcPlaylistcontents filtered by the cuein column * @method CcPlaylistcontents findOneByDbCueout(string $cueout) Return the first CcPlaylistcontents filtered by the cueout column @@ -74,7 +74,7 @@ * @method array findByDbStreamId(int $stream_id) Return CcPlaylistcontents objects filtered by the stream_id column * @method array findByDbType(int $type) Return CcPlaylistcontents objects filtered by the type column * @method array findByDbPosition(int $position) Return CcPlaylistcontents objects filtered by the position column - * @method array findByDbOffset(double $offset) Return CcPlaylistcontents objects filtered by the offset column + * @method array findByDbTrackOffset(double $trackoffset) Return CcPlaylistcontents objects filtered by the trackoffset column * @method array findByDbCliplength(string $cliplength) Return CcPlaylistcontents objects filtered by the cliplength column * @method array findByDbCuein(string $cuein) Return CcPlaylistcontents objects filtered by the cuein column * @method array findByDbCueout(string $cueout) Return CcPlaylistcontents objects filtered by the cueout column @@ -393,24 +393,24 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria } /** - * Filter the query on the offset column + * Filter the query on the trackoffset column * - * @param double|array $dbOffset The value to use as filter. + * @param double|array $dbTrackOffset 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 CcPlaylistcontentsQuery The current query, for fluid interface */ - public function filterByDbOffset($dbOffset = null, $comparison = null) + public function filterByDbTrackOffset($dbTrackOffset = null, $comparison = null) { - if (is_array($dbOffset)) { + if (is_array($dbTrackOffset)) { $useMinMax = false; - if (isset($dbOffset['min'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::OFFSET, $dbOffset['min'], Criteria::GREATER_EQUAL); + if (isset($dbTrackOffset['min'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::TRACKOFFSET, $dbTrackOffset['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($dbOffset['max'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::OFFSET, $dbOffset['max'], Criteria::LESS_EQUAL); + if (isset($dbTrackOffset['max'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::TRACKOFFSET, $dbTrackOffset['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -420,7 +420,7 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria $comparison = Criteria::IN; } } - return $this->addUsingAlias(CcPlaylistcontentsPeer::OFFSET, $dbOffset, $comparison); + return $this->addUsingAlias(CcPlaylistcontentsPeer::TRACKOFFSET, $dbTrackOffset, $comparison); } /** diff --git a/airtime_mvc/application/views/scripts/playlist/set-fade.phtml b/airtime_mvc/application/views/scripts/playlist/set-fade.phtml index 4c6f745af..510ed441e 100644 --- a/airtime_mvc/application/views/scripts/playlist/set-fade.phtml +++ b/airtime_mvc/application/views/scripts/playlist/set-fade.phtml @@ -6,7 +6,7 @@
+ data-type="logarithmic" data-item="item1; ?>"> fadeOut; ?>
@@ -15,7 +15,7 @@
+ data-type="logarithmic" data-item="item2; ?>"> fadeIn; ?>
diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index d8bb3c4b1..80384eb3a 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -227,7 +227,7 @@ --> - + @@ -266,6 +266,7 @@ + diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index 1ed734aa1..b980dc829 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -296,7 +296,7 @@ CREATE TABLE "cc_playlistcontents" "stream_id" INTEGER, "type" INT2 default 0 NOT NULL, "position" INTEGER, - "offset" FLOAT default 0 NOT NULL, + "trackoffset" FLOAT default 0 NOT NULL, "cliplength" interval default '00:00:00', "cuein" interval default '00:00:00', "cueout" interval default '00:00:00', @@ -346,6 +346,7 @@ CREATE TABLE "cc_blockcontents" "block_id" INTEGER, "file_id" INTEGER, "position" INTEGER, + "trackoffset" FLOAT default 0 NOT NULL, "cliplength" interval default '00:00:00', "cuein" interval default '00:00:00', "cueout" interval default '00:00:00', diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index f3a7fc8c5..1d13a525c 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -166,7 +166,7 @@ var AIRTIME = (function(AIRTIME){ {format: "json", cueIn: cueIn, cueOut: cueOut, id: id, modified: lastMod, type: type}, function(json){ - $el.dialog('close'); + $el.dialog('destroy'); if (json.error !== undefined){ playlistError(json); @@ -185,6 +185,34 @@ var AIRTIME = (function(AIRTIME){ highlightActive(li.find('.spl_cue')); }); } + + /* used from waveform pop-up */ + function changeCrossfade($el, id1, id2, fadeIn, fadeOut, offset) { + + var url = baseUrl+"Playlist/set-crossfade", + lastMod = getModified(), + type = $('#obj_type').val(), + li, id; + + $.post(url, + {format: "json", fadeIn: fadeIn, fadeOut: fadeOut, id1: id1, id2: id2, offset: offset, modified: lastMod, type: type}, + function(json){ + + $el.dialog('destroy'); + + if (json.error !== undefined){ + playlistError(json); + return; + } + + setPlaylistContent(json); + + id = id1 === undefined ? id2 : id1; + li = $('#side_playlist li[unqid='+id+']'); + li.find('.crossfade').toggle(); + highlightActive(li.find('.spl_fade_control')); + }); + } function changeFadeIn(event) { event.preventDefault(); @@ -1117,7 +1145,8 @@ var AIRTIME = (function(AIRTIME){ $html = $($("#tmpl-pl-fades").html()), tracks = [], dim = AIRTIME.utilities.findViewportDimensions(), - playlistEditor; + playlistEditor, + id1, id2; if ($fadeOut.length > 0) { @@ -1135,6 +1164,8 @@ var AIRTIME = (function(AIRTIME){ 'fadein': false } }); + + id1 = $fadeOut.data("item"); } if ($fadeIn.length > 0) { @@ -1154,6 +1185,8 @@ var AIRTIME = (function(AIRTIME){ 'fadeout': false } }); + + id2 = $fadeIn.data("item"); } //set the first track to not be moveable (might only be one track depending on what follows) @@ -1171,9 +1204,34 @@ var AIRTIME = (function(AIRTIME){ $(this).dialog("destroy"); }}, {text: "Save", click: function() { - var json = playlistEditor.getJson(); + var json = playlistEditor.getJson(), + offset, + fadeIn, fadeOut, + fade; - var x; + if (json.length === 1) { + + fade = json[0]["fades"][0]; + + if (fade["type"] === "FadeOut") { + fadeOut = fade["end"] - fade["start"]; + } + else { + fadeIn = fade["end"] - fade["start"]; + } + } + else { + + offset = json[0]["end"] - json[1]["start"]; + + fade = json[0]["fades"][0]; + fadeOut = fade["end"] - fade["start"]; + + fade = json[1]["fades"][0]; + fadeIn = fade["end"] - fade["start"]; + } + + changeCrossfade($html, id1, id2, fadeIn.toFixed(1), fadeOut.toFixed(1), offset); }} ], open: function (event, ui) {