From 410d298272b4a8158627e2c1824ec740dab2c60b Mon Sep 17 00:00:00 2001 From: Naomi Date: Mon, 29 Apr 2013 16:55:08 -0400 Subject: [PATCH] CC-2301 : creating an offset column to help create crossfades in the playlist. changing default fade to be a separate default fade in/out --- .../controllers/PreferenceController.php | 3 +- .../application/forms/GeneralPreferences.php | 35 ++++-- airtime_mvc/application/models/Block.php | 15 +-- airtime_mvc/application/models/Playlist.php | 9 +- airtime_mvc/application/models/Preference.php | 34 ++++++ .../map/CcPlaylistcontentsTableMap.php | 1 + .../airtime/om/BaseCcPlaylistcontents.php | 102 +++++++++++++----- .../airtime/om/BaseCcPlaylistcontentsPeer.php | 31 +++--- .../om/BaseCcPlaylistcontentsQuery.php | 35 ++++++ .../scripts/form/preferences_general.phtml | 25 +++-- .../views/scripts/playlist/set-fade.phtml | 2 +- airtime_mvc/build/schema.xml | 2 +- airtime_mvc/build/sql/schema.sql | 1 + airtime_mvc/public/js/airtime/library/spl.js | 85 ++++++++------- 14 files changed, 273 insertions(+), 107 deletions(-) diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 77f615528..fba359458 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -43,7 +43,8 @@ class PreferenceController extends Zend_Controller_Action if ($form->isValid($values)) { Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view); - Application_Model_Preference::SetDefaultFade($values["stationDefaultFade"]); + Application_Model_Preference::SetDefaultFadeIn($values["stationDefaultFadeIn"]); + Application_Model_Preference::SetDefaultFadeOut($values["stationDefaultFadeOut"]); Application_Model_Preference::SetAllow3rdPartyApi($values["thirdPartyApi"]); Application_Model_Preference::SetDefaultLocale($values["locale"]); Application_Model_Preference::SetDefaultTimezone($values["timezone"]); diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index 3d249ce47..6e02a3200 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -12,11 +12,9 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm array('ViewScript', array('viewScript' => 'form/preferences_general.phtml')) )); - $defaultFade = Application_Model_Preference::GetDefaultFade(); - if ($defaultFade == "") { - $defaultFade = '0.5'; - } - + $defaultFadeIn = Application_Model_Preference::GetDefaultFadeIn(); + $defaultFadeOut = Application_Model_Preference::GetDefaultFadeOut(); + //Station name $this->addElement('text', 'stationName', array( 'class' => 'input_text', @@ -29,10 +27,10 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm ) )); - //Default station fade - $this->addElement('text', 'stationDefaultFade', array( + //Default station fade in + $this->addElement('text', 'stationDefaultFadeIn', array( 'class' => 'input_text', - 'label' => _('Default Fade (s):'), + 'label' => _('Default Fade In (s):'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array( @@ -42,11 +40,30 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm 'regex', false, array('/^[0-9]{1,2}(\.\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')) ) ), - 'value' => $defaultFade, + 'value' => $defaultFadeIn, 'decorators' => array( 'ViewHelper' ) )); + + //Default station fade out + $this->addElement('text', 'stationDefaultFadeOut', array( + 'class' => 'input_text', + 'label' => _('Default Fade Out (s):'), + 'required' => true, + 'filters' => array('StringTrim'), + 'validators' => array( + array( + $rangeValidator, + $notEmptyValidator, + 'regex', false, array('/^[0-9]{1,2}(\.\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')) + ) + ), + 'value' => $defaultFadeOut, + 'decorators' => array( + 'ViewHelper' + ) + )); $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi'); $third_party_api->setLabel( diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index b364e5eb5..e8db4ee12 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -99,13 +99,8 @@ class Application_Model_Block implements Application_Model_LibraryEditable $this->block->save(); } - $defaultFade = Application_Model_Preference::GetDefaultFade(); - if ($defaultFade !== "") { - //fade is in format SS.uuuuuu - - $this->blockItem["fadein"] = $defaultFade; - $this->blockItem["fadeout"] = $defaultFade; - } + $this->blockItem["fadein"] = Application_Model_Preference::GetDefaultFadeIn(); + $this->blockItem["fadeout"] = Application_Model_Preference::GetDefaultFadeOut(); $this->con = isset($con) ? $con : Propel::getConnection(CcBlockPeer::DATABASE_NAME); $this->id = $this->block->getDbId(); @@ -234,6 +229,12 @@ SQL; foreach ($rows as &$row) { $clipSec = Application_Common_DateHelper::playlistTimeToSeconds($row['length']); + + $row['trackSec'] = $clipSec; + + $row['cueInSec'] = Application_Common_DateHelper::playlistTimeToSeconds($row['cuein']); + $row['cueOutSec'] = Application_Common_DateHelper::playlistTimeToSeconds($row['cueout']); + $offset += $clipSec; $offset_cliplength = Application_Common_DateHelper::secondsToPlaylistTime($offset); diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php index 0e2e9b4fe..764a8695c 100644 --- a/airtime_mvc/application/models/Playlist.php +++ b/airtime_mvc/application/models/Playlist.php @@ -60,13 +60,8 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable $this->pl->save(); } - $defaultFade = Application_Model_Preference::GetDefaultFade(); - if ($defaultFade !== "") { - //fade is in format SS.uuuuuu - - $this->plItem["fadein"] = $defaultFade; - $this->plItem["fadeout"] = $defaultFade; - } + $this->plItem["fadein"] = Application_Model_Preference::GetDefaultFadeIn(); + $this->plItem["fadeout"] = Application_Model_Preference::GetDefaultFadeOut(); $this->con = isset($con) ? $con : Propel::getConnection(CcPlaylistPeer::DATABASE_NAME); $this->id = $this->pl->getDbId(); diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 2af97d193..dbb3146dd 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -194,6 +194,40 @@ class Application_Model_Preference return new DateTime($date, new DateTimeZone("UTC")); } } + + public static function SetDefaultFadeIn($fade) + { + self::setValue("default_fade_in", $fade); + } + + public static function GetDefaultFadeIn() + { + $fade = self::getValue("default_fade_in"); + + if ($fade === "") { + // the default value of the fade is 00.5 + return "00.5"; + } + + return $fade; + } + + public static function SetDefaultFadeOut($fade) + { + self::setValue("default_fade_out", $fade); + } + + public static function GetDefaultFadeOut() + { + $fade = self::getValue("default_fade_out"); + + if ($fade === "") { + // the default value of the fade is 00.5 + return "00.5"; + } + + return $fade; + } public static function SetDefaultFade($fade) { diff --git a/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php index 68fde5847..af6eddd10 100644 --- a/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php @@ -45,6 +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('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/BaseCcPlaylistcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php index f8630b15b..f7d66a9c6 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php @@ -67,6 +67,13 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent */ protected $position; + /** + * The value for the offset field. + * Note: this column has a database default value of: 0 + * @var double + */ + protected $offset; + /** * The value for the cliplength field. * Note: this column has a database default value of: '00:00:00' @@ -143,6 +150,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent public function applyDefaultValues() { $this->type = 0; + $this->offset = 0; $this->cliplength = '00:00:00'; $this->cuein = '00:00:00'; $this->cueout = '00:00:00'; @@ -230,6 +238,16 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent return $this->position; } + /** + * Get the [offset] column value. + * + * @return double + */ + public function getDbOffset() + { + return $this->offset; + } + /** * Get the [cliplength] column value. * @@ -478,6 +496,26 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent return $this; } // setDbPosition() + /** + * Set the value of [offset] column. + * + * @param double $v new value + * @return CcPlaylistcontents The current object (for fluent API support) + */ + public function setDbOffset($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->offset !== $v || $this->isNew()) { + $this->offset = $v; + $this->modifiedColumns[] = CcPlaylistcontentsPeer::OFFSET; + } + + return $this; + } // setDbOffset() + /** * Set the value of [cliplength] column. * @@ -652,6 +690,10 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent return false; } + if ($this->offset !== 0) { + return false; + } + if ($this->cliplength !== '00:00:00') { return false; } @@ -701,11 +743,12 @@ 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->cliplength = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->cuein = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->cueout = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; - $this->fadein = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; - $this->fadeout = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; + $this->offset = ($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; + $this->fadein = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; + $this->fadeout = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; $this->resetModified(); $this->setNew(false); @@ -714,7 +757,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $this->ensureConsistency(); } - return $startcol + 12; // 12 = CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 13; // 13 = CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating CcPlaylistcontents object", $e); @@ -1099,18 +1142,21 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent return $this->getDbPosition(); break; case 7: - return $this->getDbCliplength(); + return $this->getDbOffset(); break; case 8: - return $this->getDbCuein(); + return $this->getDbCliplength(); break; case 9: - return $this->getDbCueout(); + return $this->getDbCuein(); break; case 10: - return $this->getDbFadein(); + return $this->getDbCueout(); break; case 11: + return $this->getDbFadein(); + break; + case 12: return $this->getDbFadeout(); break; default: @@ -1144,11 +1190,12 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $keys[4] => $this->getDbStreamId(), $keys[5] => $this->getDbType(), $keys[6] => $this->getDbPosition(), - $keys[7] => $this->getDbCliplength(), - $keys[8] => $this->getDbCuein(), - $keys[9] => $this->getDbCueout(), - $keys[10] => $this->getDbFadein(), - $keys[11] => $this->getDbFadeout(), + $keys[7] => $this->getDbOffset(), + $keys[8] => $this->getDbCliplength(), + $keys[9] => $this->getDbCuein(), + $keys[10] => $this->getDbCueout(), + $keys[11] => $this->getDbFadein(), + $keys[12] => $this->getDbFadeout(), ); if ($includeForeignObjects) { if (null !== $this->aCcFiles) { @@ -1213,18 +1260,21 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $this->setDbPosition($value); break; case 7: - $this->setDbCliplength($value); + $this->setDbOffset($value); break; case 8: - $this->setDbCuein($value); + $this->setDbCliplength($value); break; case 9: - $this->setDbCueout($value); + $this->setDbCuein($value); break; case 10: - $this->setDbFadein($value); + $this->setDbCueout($value); break; case 11: + $this->setDbFadein($value); + break; + case 12: $this->setDbFadeout($value); break; } // switch() @@ -1258,11 +1308,12 @@ 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->setDbCliplength($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setDbCuein($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setDbCueout($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setDbFadein($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setDbFadeout($arr[$keys[11]]); + if (array_key_exists($keys[7], $arr)) $this->setDbOffset($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]]); + if (array_key_exists($keys[11], $arr)) $this->setDbFadein($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setDbFadeout($arr[$keys[12]]); } /** @@ -1281,6 +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::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); @@ -1353,6 +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->setDbCliplength($this->cliplength); $copyObj->setDbCuein($this->cuein); $copyObj->setDbCueout($this->cueout); @@ -1564,6 +1617,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $this->stream_id = null; $this->type = null; $this->position = null; + $this->offset = 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 d90906568..6645977ea 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php @@ -26,7 +26,7 @@ abstract class BaseCcPlaylistcontentsPeer { const TM_CLASS = 'CcPlaylistcontentsTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 12; + const NUM_COLUMNS = 13; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -52,6 +52,9 @@ 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 CLIPLENGTH field */ const CLIPLENGTH = 'cc_playlistcontents.CLIPLENGTH'; @@ -83,12 +86,12 @@ 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', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbFileId', 'dbBlockId', 'dbStreamId', 'dbType', 'dbPosition', '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::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', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'file_id', 'block_id', 'stream_id', 'type', 'position', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) + 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_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) ); /** @@ -98,12 +101,12 @@ 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, 'DbCliplength' => 7, 'DbCuein' => 8, 'DbCueout' => 9, 'DbFadein' => 10, 'DbFadeout' => 11, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbFileId' => 2, 'dbBlockId' => 3, 'dbStreamId' => 4, 'dbType' => 5, 'dbPosition' => 6, 'dbCliplength' => 7, 'dbCuein' => 8, 'dbCueout' => 9, 'dbFadein' => 10, 'dbFadeout' => 11, ), - 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::CLIPLENGTH => 7, self::CUEIN => 8, self::CUEOUT => 9, self::FADEIN => 10, self::FADEOUT => 11, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'FILE_ID' => 2, 'BLOCK_ID' => 3, 'STREAM_ID' => 4, 'TYPE' => 5, 'POSITION' => 6, 'CLIPLENGTH' => 7, 'CUEIN' => 8, 'CUEOUT' => 9, 'FADEIN' => 10, 'FADEOUT' => 11, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'file_id' => 2, 'block_id' => 3, 'stream_id' => 4, 'type' => 5, 'position' => 6, 'cliplength' => 7, 'cuein' => 8, 'cueout' => 9, 'fadein' => 10, 'fadeout' => 11, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) + 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_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) ); /** @@ -182,6 +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::CLIPLENGTH); $criteria->addSelectColumn(CcPlaylistcontentsPeer::CUEIN); $criteria->addSelectColumn(CcPlaylistcontentsPeer::CUEOUT); @@ -195,6 +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 . '.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 25ea29378..d70d1dd17 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php @@ -13,6 +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 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 @@ -26,6 +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 groupByDbCliplength() Group by the cliplength column * @method CcPlaylistcontentsQuery groupByDbCuein() Group by the cuein column * @method CcPlaylistcontentsQuery groupByDbCueout() Group by the cueout column @@ -58,6 +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 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 @@ -71,6 +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 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 @@ -388,6 +392,37 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria return $this->addUsingAlias(CcPlaylistcontentsPeer::POSITION, $dbPosition, $comparison); } + /** + * Filter the query on the offset column + * + * @param double|array $dbOffset 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) + { + if (is_array($dbOffset)) { + $useMinMax = false; + if (isset($dbOffset['min'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::OFFSET, $dbOffset['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbOffset['max'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::OFFSET, $dbOffset['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPlaylistcontentsPeer::OFFSET, $dbOffset, $comparison); + } + /** * Filter the query on the cliplength column * diff --git a/airtime_mvc/application/views/scripts/form/preferences_general.phtml b/airtime_mvc/application/views/scripts/form/preferences_general.phtml index 08db4abc5..85582411c 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_general.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_general.phtml @@ -14,14 +14,27 @@ -
- +
+
-
- element->getElement('stationDefaultFade') ?> - element->getElement('stationDefaultFade')->hasErrors()) : ?> +
+ element->getElement('stationDefaultFadeIn') ?> + element->getElement('stationDefaultFadeIn')->hasErrors()) : ?> + +
+
+ +
+
+ element->getElement('stationDefaultFadeOut') ?> + element->getElement('stationDefaultFadeOut')->hasErrors()) : ?> + diff --git a/airtime_mvc/application/views/scripts/playlist/set-fade.phtml b/airtime_mvc/application/views/scripts/playlist/set-fade.phtml index ed5c94876..4c6f745af 100644 --- a/airtime_mvc/application/views/scripts/playlist/set-fade.phtml +++ b/airtime_mvc/application/views/scripts/playlist/set-fade.phtml @@ -13,7 +13,7 @@ item2Type == 0) {?>
-
fadeIn; ?> diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 6ecde0276..d8bb3c4b1 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -227,7 +227,7 @@ --> - + diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index cf73470b9..1ed734aa1 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -296,6 +296,7 @@ CREATE TABLE "cc_playlistcontents" "stream_id" INTEGER, "type" INT2 default 0 NOT NULL, "position" INTEGER, + "offset" 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 9c8f38b22..f3a7fc8c5 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -1115,41 +1115,50 @@ var AIRTIME = (function(AIRTIME){ $fadeOut = $parent.find(".spl_fade_out"), $fadeIn = $parent.find(".spl_fade_in"), $html = $($("#tmpl-pl-fades").html()), - tracks = [ - { - src: $fadeOut.data("fadeout"), - cuein: $fadeOut.data("cuein"), - cueout: $fadeOut.data("cueout"), - moveable: false, - fades: [{ - shape: $fadeOut.data("type"), - type: "FadeOut", - end: $fadeOut.data("cueout") - $fadeOut.data("cuein"), - start: $fadeOut.data("cueout") - $fadeOut.data("cuein") - $fadeOut.data("length") - }], - states: { - 'fadein': false - } - }, - { - src: $fadeIn.data("fadein"), - start: $fadeIn.data("offset"), - cuein: $fadeIn.data("cuein"), - cueout: $fadeIn.data("cueout"), - fades: [{ - shape: $fadeIn.data("type"), - type: "FadeIn", - end: $fadeIn.data("length"), - start: 0 - }], - states: { - 'fadeout': false - } - } - ], + tracks = [], dim = AIRTIME.utilities.findViewportDimensions(), playlistEditor; + if ($fadeOut.length > 0) { + + tracks.push({ + src: $fadeOut.data("fadeout"), + cuein: $fadeOut.data("cuein"), + cueout: $fadeOut.data("cueout"), + fades: [{ + shape: $fadeOut.data("type"), + type: "FadeOut", + end: $fadeOut.data("cueout") - $fadeOut.data("cuein"), + start: $fadeOut.data("cueout") - $fadeOut.data("cuein") - $fadeOut.data("length") + }], + states: { + 'fadein': false + } + }); + } + + if ($fadeIn.length > 0) { + + tracks.push({ + src: $fadeIn.data("fadein"), + start: $fadeIn.data("offset"), + cuein: $fadeIn.data("cuein"), + cueout: $fadeIn.data("cueout"), + fades: [{ + shape: $fadeIn.data("type"), + type: "FadeIn", + end: $fadeIn.data("length"), + start: 0 + }], + states: { + 'fadeout': false + } + }); + } + + //set the first track to not be moveable (might only be one track depending on what follows) + tracks[0].states["shift"] = false; + $html.dialog({ modal: true, title: "Fade Editor", @@ -1158,13 +1167,13 @@ var AIRTIME = (function(AIRTIME){ width: dim.width - 100, height: dim.height - 100, buttons: [ + {text: "Cancel", click: function() { + $(this).dialog("destroy"); + }}, {text: "Save", click: function() { var json = playlistEditor.getJson(); var x; - }}, - {text: "Cancel", click: function() { - $(this).dialog("destroy"); }} ], open: function (event, ui) { @@ -1223,14 +1232,14 @@ var AIRTIME = (function(AIRTIME){ width: dim.width - 100, height: dim.height - 100, buttons: [ + {text: "Cancel", click: function() { + $(this).dialog("destroy"); + }}, {text: "Save", click: function() { var cueIn = $html.find('.editor-cue-in').val(), cueOut = $html.find('.editor-cue-out').val(); changeCues($html, id, cueIn, cueOut); - }}, - {text: "Cancel", click: function() { - $(this).dialog("destroy"); }} ], open: function (event, ui) {