Merge pull request #135 from Robbt/feature/repeat-autoplaylist-until-show-is-full

Feature/repeat autoplaylist until show is full
This commit is contained in:
Lucas Bickel 2017-04-01 10:15:44 +02:00 committed by GitHub
commit e0f88ba808
42 changed files with 250 additions and 23 deletions

View File

@ -31,8 +31,27 @@ class AutoPlaylistManager {
$playlistid = $si->GetAutoPlaylistId();
Logging::info("Scheduling $playlistid");
// call the addPlaylist to show function and don't check for user permission to avoid call to non-existant user object
$si->addPlaylistToShow($playlistid, false);
$sid = $si->getShowId();
$playlistrepeat = new Application_Model_Show($sid);
if ($playlistrepeat->getAutoPlaylistRepeat()) {
$full = false;
while(!$full) {
$si = new Application_Model_ShowInstance($autoplaylist->getDbId());
$si->addPlaylistToShow($playlistid, false);
$ps = $si->getPercentScheduled();
//Logging::info("The total percent scheduled is % $ps");
if ($ps > 100) {
$full = true;
}
}
}
else {
$si->addPlaylistToShow($playlistid, false);
}
$si->setAutoPlaylistBuilt(true);
}
Application_Model_Preference::setAutoPlaylistPollLock(microtime(true));
}

View File

@ -1,3 +1,5 @@
ALTER TABLE imported_podcast DROP COLUMN IF EXISTS album_override;
ALTER TABLE third_party_track_references ALTER COLUMN file_id DROP DEFAULT;
ALTER TABLE third_party_track_references ALTER COLUMN file_id SET NOT NULL;
ALTER TABLE cc_show DROP COLUMN IF EXISTS autoplaylist_repeat;

View File

@ -1,3 +1,4 @@
ALTER TABLE imported_podcast ADD COLUMN album_override boolean default 'f' NOT NULL;
ALTER TABLE third_party_track_references ALTER COLUMN file_id SET DEFAULT 0;
ALTER TABLE third_party_track_references ALTER COLUMN file_id DROP NOT NULL;
ALTER TABLE cc_show ADD COLUMN autoplaylist_repeat boolean default 'f' NOT NULL;

View File

@ -27,6 +27,13 @@ class Application_Form_AddShowAutoPlaylist extends Zend_Form_SubForm
$autoPlaylistSelect->setValue(null);
$autoPlaylistSelect->setDecorators(array('ViewHelper'));
$this->addElement($autoPlaylistSelect);
// Add autoplaylist checkbox element
$this->addElement('checkbox', 'add_show_autoplaylist_repeat', array(
'label' => _('Repeat AutoPlaylist Until Show is Full ?'),
'required' => false,
'class' => 'input_text',
'decorators' => array('ViewHelper')
));
}
public function disable()

View File

@ -135,6 +135,18 @@ class Application_Model_Show
$hasAutoPlaylist = $show->getDbHasAutoPlaylist();
return $hasAutoPlaylist;
}
public function getAutoPlaylistRepeat() {
$show = CcShowQuery::create()->findPK($this->_showId);
$AutoPlaylistRepeat = $show->getDbAutoPlaylistRepeat();
return $AutoPlaylistRepeat;
}
public function setAutoPlaylistRepeat($value)
{
$show = CcShowQuery::create()->findPK($this->_showId);
$show->setDbAutoPlaylistRepeat($value);
}
public function setHasAutoPlaylist($value)
{

View File

@ -96,7 +96,15 @@ SQL;
return $show->getDbAutoPlaylistId();
}
public function getAutoPlaylistRepeat()
{
$show = CcShowQuery::create()->findPK($this->getShowId());
return $show->getDbAutoPlaylistRepeat();
}
/**
* Return the start time of the Show (UTC time)
* @return string in format DEFAULT_TIMESTAMP_FORMAT (PHP time notation)
@ -228,14 +236,19 @@ SQL;
{
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
$id = $this->_showInstance->getDbId();
$lastid = $this->getLastAudioItemId();
// Logging::info("The last id is $lastid");
$scheduler = new Application_Model_Scheduler($checkUserPerm);
$scheduler->scheduleAfter(
array(array("id" => 0, "instance" => $id, "timestamp" => $ts)),
array(array("id" => $lastid, "instance" => $id, "timestamp" => $ts)),
array(array("id" => $pl_id, "type" => "playlist"))
);
}
/**
* Add a media file as the last item in the show.
*
@ -641,12 +654,28 @@ SQL;
return $results;
}
public function getLastAudioItemId()
{
$con = Propel::getConnection();
$sql = "SELECT id FROM cc_schedule "
."WHERE instance_id = :instanceId "
."ORDER BY ends DESC "
."LIMIT 1";
$query = Application_Common_Database::prepareAndExecute( $sql,
array(':instanceId' => $this->_instanceId), 'column');
return ($query !== false) ? $query : null;
}
public function getLastAudioItemEnd()
{
$con = Propel::getConnection();
$sql = "SELECT ends FROM cc_schedule "
."WHERE instance_id = :instanceId"
."WHERE instance_id = :instanceId "
."ORDER BY ends DESC "
."LIMIT 1";

View File

@ -321,6 +321,7 @@ class CcShow extends BaseCcShow {
$info['linked'] = $this->getDbLinked();
$info['has_autoplaylist'] = $this->getDbHasAutoPlaylist();
$info['autoplaylist_id'] = $this->getDbAutoPlaylistId();
$info['autoplaylist_repeat'] = $this->getDbAutoPlaylistRepeat();
return $info;
}

View File

@ -55,6 +55,7 @@ class CcShowTableMap extends TableMap
$this->addColumn('image_path', 'DbImagePath', 'VARCHAR', false, 255, '');
$this->addColumn('has_autoplaylist', 'DbHasAutoPlaylist', 'BOOLEAN', true, null, false);
$this->addForeignKey('autoplaylist_id', 'DbAutoPlaylistId', 'INTEGER', 'cc_playlist', 'id', false, null, null);
$this->addColumn('autoplaylist_repeat', 'DbAutoPlaylistRepeat', 'BOOLEAN', true, null, false);
// validators
} // initialize()

View File

@ -134,6 +134,13 @@ abstract class BaseCcShow extends BaseObject implements Persistent
*/
protected $autoplaylist_id;
/**
* The value for the autoplaylist_repeat field.
* Note: this column has a database default value of: false
* @var boolean
*/
protected $autoplaylist_repeat;
/**
* @var CcPlaylist
*/
@ -224,6 +231,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->is_linkable = true;
$this->image_path = '';
$this->has_autoplaylist = false;
$this->autoplaylist_repeat = false;
}
/**
@ -412,6 +420,17 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return $this->autoplaylist_id;
}
/**
* Get the [autoplaylist_repeat] column value.
*
* @return boolean
*/
public function getDbAutoPlaylistRepeat()
{
return $this->autoplaylist_repeat;
}
/**
* Set the value of [id] column.
*
@ -792,6 +811,35 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return $this;
} // setDbAutoPlaylistId()
/**
* Sets the value of the [autoplaylist_repeat] column.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
*
* @param boolean|integer|string $v The new value
* @return CcShow The current object (for fluent API support)
*/
public function setDbAutoPlaylistRepeat($v)
{
if ($v !== null) {
if (is_string($v)) {
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
} else {
$v = (boolean) $v;
}
}
if ($this->autoplaylist_repeat !== $v) {
$this->autoplaylist_repeat = $v;
$this->modifiedColumns[] = CcShowPeer::AUTOPLAYLIST_REPEAT;
}
return $this;
} // setDbAutoPlaylistRepeat()
/**
* Indicates whether the columns in this object are only set to default values.
*
@ -838,6 +886,10 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return false;
}
if ($this->autoplaylist_repeat !== false) {
return false;
}
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
@ -876,6 +928,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->image_path = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
$this->has_autoplaylist = ($row[$startcol + 14] !== null) ? (boolean) $row[$startcol + 14] : null;
$this->autoplaylist_id = ($row[$startcol + 15] !== null) ? (int) $row[$startcol + 15] : null;
$this->autoplaylist_repeat = ($row[$startcol + 16] !== null) ? (boolean) $row[$startcol + 16] : null;
$this->resetModified();
$this->setNew(false);
@ -885,7 +938,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 16; // 16 = CcShowPeer::NUM_HYDRATE_COLUMNS.
return $startcol + 17; // 17 = CcShowPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating CcShow object", $e);
@ -1247,6 +1300,9 @@ abstract class BaseCcShow extends BaseObject implements Persistent
if ($this->isColumnModified(CcShowPeer::AUTOPLAYLIST_ID)) {
$modifiedColumns[':p' . $index++] = '"autoplaylist_id"';
}
if ($this->isColumnModified(CcShowPeer::AUTOPLAYLIST_REPEAT)) {
$modifiedColumns[':p' . $index++] = '"autoplaylist_repeat"';
}
$sql = sprintf(
'INSERT INTO "cc_show" (%s) VALUES (%s)',
@ -1306,6 +1362,9 @@ abstract class BaseCcShow extends BaseObject implements Persistent
case '"autoplaylist_id"':
$stmt->bindValue($identifier, $this->autoplaylist_id, PDO::PARAM_INT);
break;
case '"autoplaylist_repeat"':
$stmt->bindValue($identifier, $this->autoplaylist_repeat, PDO::PARAM_BOOL);
break;
}
}
$stmt->execute();
@ -1525,6 +1584,9 @@ abstract class BaseCcShow extends BaseObject implements Persistent
case 15:
return $this->getDbAutoPlaylistId();
break;
case 16:
return $this->getDbAutoPlaylistRepeat();
break;
default:
return null;
break;
@ -1570,6 +1632,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$keys[13] => $this->getDbImagePath(),
$keys[14] => $this->getDbHasAutoPlaylist(),
$keys[15] => $this->getDbAutoPlaylistId(),
$keys[16] => $this->getDbAutoPlaylistRepeat(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@ -1674,6 +1737,9 @@ abstract class BaseCcShow extends BaseObject implements Persistent
case 15:
$this->setDbAutoPlaylistId($value);
break;
case 16:
$this->setDbAutoPlaylistRepeat($value);
break;
} // switch()
}
@ -1714,6 +1780,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
if (array_key_exists($keys[13], $arr)) $this->setDbImagePath($arr[$keys[13]]);
if (array_key_exists($keys[14], $arr)) $this->setDbHasAutoPlaylist($arr[$keys[14]]);
if (array_key_exists($keys[15], $arr)) $this->setDbAutoPlaylistId($arr[$keys[15]]);
if (array_key_exists($keys[16], $arr)) $this->setDbAutoPlaylistRepeat($arr[$keys[16]]);
}
/**
@ -1741,6 +1808,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
if ($this->isColumnModified(CcShowPeer::IMAGE_PATH)) $criteria->add(CcShowPeer::IMAGE_PATH, $this->image_path);
if ($this->isColumnModified(CcShowPeer::HAS_AUTOPLAYLIST)) $criteria->add(CcShowPeer::HAS_AUTOPLAYLIST, $this->has_autoplaylist);
if ($this->isColumnModified(CcShowPeer::AUTOPLAYLIST_ID)) $criteria->add(CcShowPeer::AUTOPLAYLIST_ID, $this->autoplaylist_id);
if ($this->isColumnModified(CcShowPeer::AUTOPLAYLIST_REPEAT)) $criteria->add(CcShowPeer::AUTOPLAYLIST_REPEAT, $this->autoplaylist_repeat);
return $criteria;
}
@ -1819,6 +1887,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$copyObj->setDbImagePath($this->getDbImagePath());
$copyObj->setDbHasAutoPlaylist($this->getDbHasAutoPlaylist());
$copyObj->setDbAutoPlaylistId($this->getDbAutoPlaylistId());
$copyObj->setDbAutoPlaylistRepeat($this->getDbAutoPlaylistRepeat());
if ($deepCopy && !$this->startCopy) {
// important: temporarily setNew(false) because this affects the behavior of
@ -2974,6 +3043,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->image_path = null;
$this->has_autoplaylist = null;
$this->autoplaylist_id = null;
$this->autoplaylist_repeat = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;

View File

@ -24,13 +24,13 @@ abstract class BaseCcShowPeer
const TM_CLASS = 'CcShowTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 16;
const NUM_COLUMNS = 17;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 16;
const NUM_HYDRATE_COLUMNS = 17;
/** the column name for the id field */
const ID = 'cc_show.id';
@ -80,6 +80,9 @@ abstract class BaseCcShowPeer
/** the column name for the autoplaylist_id field */
const AUTOPLAYLIST_ID = 'cc_show.autoplaylist_id';
/** the column name for the autoplaylist_repeat field */
const AUTOPLAYLIST_REPEAT = 'cc_show.autoplaylist_repeat';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
@ -99,12 +102,12 @@ abstract class BaseCcShowPeer
* e.g. CcShowPeer::$fieldNames[CcShowPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', 'DbLiveStreamUsingAirtimeAuth', 'DbLiveStreamUsingCustomAuth', 'DbLiveStreamUser', 'DbLiveStreamPass', 'DbLinked', 'DbIsLinkable', 'DbImagePath', 'DbHasAutoPlaylist', 'DbAutoPlaylistId', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbGenre', 'dbDescription', 'dbColor', 'dbBackgroundColor', 'dbLiveStreamUsingAirtimeAuth', 'dbLiveStreamUsingCustomAuth', 'dbLiveStreamUser', 'dbLiveStreamPass', 'dbLinked', 'dbIsLinkable', 'dbImagePath', 'dbHasAutoPlaylist', 'dbAutoPlaylistId', ),
BasePeer::TYPE_COLNAME => array (CcShowPeer::ID, CcShowPeer::NAME, CcShowPeer::URL, CcShowPeer::GENRE, CcShowPeer::DESCRIPTION, CcShowPeer::COLOR, CcShowPeer::BACKGROUND_COLOR, CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH, CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH, CcShowPeer::LIVE_STREAM_USER, CcShowPeer::LIVE_STREAM_PASS, CcShowPeer::LINKED, CcShowPeer::IS_LINKABLE, CcShowPeer::IMAGE_PATH, CcShowPeer::HAS_AUTOPLAYLIST, CcShowPeer::AUTOPLAYLIST_ID, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'GENRE', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', 'LIVE_STREAM_USING_AIRTIME_AUTH', 'LIVE_STREAM_USING_CUSTOM_AUTH', 'LIVE_STREAM_USER', 'LIVE_STREAM_PASS', 'LINKED', 'IS_LINKABLE', 'IMAGE_PATH', 'HAS_AUTOPLAYLIST', 'AUTOPLAYLIST_ID', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'genre', 'description', 'color', 'background_color', 'live_stream_using_airtime_auth', 'live_stream_using_custom_auth', 'live_stream_user', 'live_stream_pass', 'linked', 'is_linkable', 'image_path', 'has_autoplaylist', 'autoplaylist_id', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', 'DbLiveStreamUsingAirtimeAuth', 'DbLiveStreamUsingCustomAuth', 'DbLiveStreamUser', 'DbLiveStreamPass', 'DbLinked', 'DbIsLinkable', 'DbImagePath', 'DbHasAutoPlaylist', 'DbAutoPlaylistId', 'DbAutoPlaylistRepeat', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbGenre', 'dbDescription', 'dbColor', 'dbBackgroundColor', 'dbLiveStreamUsingAirtimeAuth', 'dbLiveStreamUsingCustomAuth', 'dbLiveStreamUser', 'dbLiveStreamPass', 'dbLinked', 'dbIsLinkable', 'dbImagePath', 'dbHasAutoPlaylist', 'dbAutoPlaylistId', 'dbAutoPlaylistRepeat', ),
BasePeer::TYPE_COLNAME => array (CcShowPeer::ID, CcShowPeer::NAME, CcShowPeer::URL, CcShowPeer::GENRE, CcShowPeer::DESCRIPTION, CcShowPeer::COLOR, CcShowPeer::BACKGROUND_COLOR, CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH, CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH, CcShowPeer::LIVE_STREAM_USER, CcShowPeer::LIVE_STREAM_PASS, CcShowPeer::LINKED, CcShowPeer::IS_LINKABLE, CcShowPeer::IMAGE_PATH, CcShowPeer::HAS_AUTOPLAYLIST, CcShowPeer::AUTOPLAYLIST_ID, CcShowPeer::AUTOPLAYLIST_REPEAT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'GENRE', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', 'LIVE_STREAM_USING_AIRTIME_AUTH', 'LIVE_STREAM_USING_CUSTOM_AUTH', 'LIVE_STREAM_USER', 'LIVE_STREAM_PASS', 'LINKED', 'IS_LINKABLE', 'IMAGE_PATH', 'HAS_AUTOPLAYLIST', 'AUTOPLAYLIST_ID', 'AUTOPLAYLIST_REPEAT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'genre', 'description', 'color', 'background_color', 'live_stream_using_airtime_auth', 'live_stream_using_custom_auth', 'live_stream_user', 'live_stream_pass', 'linked', 'is_linkable', 'image_path', 'has_autoplaylist', 'autoplaylist_id', 'autoplaylist_repeat', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
);
/**
@ -114,12 +117,12 @@ abstract class BaseCcShowPeer
* e.g. CcShowPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbUrl' => 2, 'DbGenre' => 3, 'DbDescription' => 4, 'DbColor' => 5, 'DbBackgroundColor' => 6, 'DbLiveStreamUsingAirtimeAuth' => 7, 'DbLiveStreamUsingCustomAuth' => 8, 'DbLiveStreamUser' => 9, 'DbLiveStreamPass' => 10, 'DbLinked' => 11, 'DbIsLinkable' => 12, 'DbImagePath' => 13, 'DbHasAutoPlaylist' => 14, 'DbAutoPlaylistId' => 15, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbGenre' => 3, 'dbDescription' => 4, 'dbColor' => 5, 'dbBackgroundColor' => 6, 'dbLiveStreamUsingAirtimeAuth' => 7, 'dbLiveStreamUsingCustomAuth' => 8, 'dbLiveStreamUser' => 9, 'dbLiveStreamPass' => 10, 'dbLinked' => 11, 'dbIsLinkable' => 12, 'dbImagePath' => 13, 'dbHasAutoPlaylist' => 14, 'dbAutoPlaylistId' => 15, ),
BasePeer::TYPE_COLNAME => array (CcShowPeer::ID => 0, CcShowPeer::NAME => 1, CcShowPeer::URL => 2, CcShowPeer::GENRE => 3, CcShowPeer::DESCRIPTION => 4, CcShowPeer::COLOR => 5, CcShowPeer::BACKGROUND_COLOR => 6, CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH => 7, CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH => 8, CcShowPeer::LIVE_STREAM_USER => 9, CcShowPeer::LIVE_STREAM_PASS => 10, CcShowPeer::LINKED => 11, CcShowPeer::IS_LINKABLE => 12, CcShowPeer::IMAGE_PATH => 13, CcShowPeer::HAS_AUTOPLAYLIST => 14, CcShowPeer::AUTOPLAYLIST_ID => 15, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'GENRE' => 3, 'DESCRIPTION' => 4, 'COLOR' => 5, 'BACKGROUND_COLOR' => 6, 'LIVE_STREAM_USING_AIRTIME_AUTH' => 7, 'LIVE_STREAM_USING_CUSTOM_AUTH' => 8, 'LIVE_STREAM_USER' => 9, 'LIVE_STREAM_PASS' => 10, 'LINKED' => 11, 'IS_LINKABLE' => 12, 'IMAGE_PATH' => 13, 'HAS_AUTOPLAYLIST' => 14, 'AUTOPLAYLIST_ID' => 15, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'genre' => 3, 'description' => 4, 'color' => 5, 'background_color' => 6, 'live_stream_using_airtime_auth' => 7, 'live_stream_using_custom_auth' => 8, 'live_stream_user' => 9, 'live_stream_pass' => 10, 'linked' => 11, 'is_linkable' => 12, 'image_path' => 13, 'has_autoplaylist' => 14, 'autoplaylist_id' => 15, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbUrl' => 2, 'DbGenre' => 3, 'DbDescription' => 4, 'DbColor' => 5, 'DbBackgroundColor' => 6, 'DbLiveStreamUsingAirtimeAuth' => 7, 'DbLiveStreamUsingCustomAuth' => 8, 'DbLiveStreamUser' => 9, 'DbLiveStreamPass' => 10, 'DbLinked' => 11, 'DbIsLinkable' => 12, 'DbImagePath' => 13, 'DbHasAutoPlaylist' => 14, 'DbAutoPlaylistId' => 15, 'DbAutoPlaylistRepeat' => 16, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbGenre' => 3, 'dbDescription' => 4, 'dbColor' => 5, 'dbBackgroundColor' => 6, 'dbLiveStreamUsingAirtimeAuth' => 7, 'dbLiveStreamUsingCustomAuth' => 8, 'dbLiveStreamUser' => 9, 'dbLiveStreamPass' => 10, 'dbLinked' => 11, 'dbIsLinkable' => 12, 'dbImagePath' => 13, 'dbHasAutoPlaylist' => 14, 'dbAutoPlaylistId' => 15, 'dbAutoPlaylistRepeat' => 16, ),
BasePeer::TYPE_COLNAME => array (CcShowPeer::ID => 0, CcShowPeer::NAME => 1, CcShowPeer::URL => 2, CcShowPeer::GENRE => 3, CcShowPeer::DESCRIPTION => 4, CcShowPeer::COLOR => 5, CcShowPeer::BACKGROUND_COLOR => 6, CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH => 7, CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH => 8, CcShowPeer::LIVE_STREAM_USER => 9, CcShowPeer::LIVE_STREAM_PASS => 10, CcShowPeer::LINKED => 11, CcShowPeer::IS_LINKABLE => 12, CcShowPeer::IMAGE_PATH => 13, CcShowPeer::HAS_AUTOPLAYLIST => 14, CcShowPeer::AUTOPLAYLIST_ID => 15, CcShowPeer::AUTOPLAYLIST_REPEAT => 16, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'GENRE' => 3, 'DESCRIPTION' => 4, 'COLOR' => 5, 'BACKGROUND_COLOR' => 6, 'LIVE_STREAM_USING_AIRTIME_AUTH' => 7, 'LIVE_STREAM_USING_CUSTOM_AUTH' => 8, 'LIVE_STREAM_USER' => 9, 'LIVE_STREAM_PASS' => 10, 'LINKED' => 11, 'IS_LINKABLE' => 12, 'IMAGE_PATH' => 13, 'HAS_AUTOPLAYLIST' => 14, 'AUTOPLAYLIST_ID' => 15, 'AUTOPLAYLIST_REPEAT' => 16, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'genre' => 3, 'description' => 4, 'color' => 5, 'background_color' => 6, 'live_stream_using_airtime_auth' => 7, 'live_stream_using_custom_auth' => 8, 'live_stream_user' => 9, 'live_stream_pass' => 10, 'linked' => 11, 'is_linkable' => 12, 'image_path' => 13, 'has_autoplaylist' => 14, 'autoplaylist_id' => 15, 'autoplaylist_repeat' => 16, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
);
/**
@ -209,6 +212,7 @@ abstract class BaseCcShowPeer
$criteria->addSelectColumn(CcShowPeer::IMAGE_PATH);
$criteria->addSelectColumn(CcShowPeer::HAS_AUTOPLAYLIST);
$criteria->addSelectColumn(CcShowPeer::AUTOPLAYLIST_ID);
$criteria->addSelectColumn(CcShowPeer::AUTOPLAYLIST_REPEAT);
} else {
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.name');
@ -226,6 +230,7 @@ abstract class BaseCcShowPeer
$criteria->addSelectColumn($alias . '.image_path');
$criteria->addSelectColumn($alias . '.has_autoplaylist');
$criteria->addSelectColumn($alias . '.autoplaylist_id');
$criteria->addSelectColumn($alias . '.autoplaylist_repeat');
}
}

View File

@ -22,6 +22,7 @@
* @method CcShowQuery orderByDbImagePath($order = Criteria::ASC) Order by the image_path column
* @method CcShowQuery orderByDbHasAutoPlaylist($order = Criteria::ASC) Order by the has_autoplaylist column
* @method CcShowQuery orderByDbAutoPlaylistId($order = Criteria::ASC) Order by the autoplaylist_id column
* @method CcShowQuery orderByDbAutoPlaylistRepeat($order = Criteria::ASC) Order by the autoplaylist_repeat column
*
* @method CcShowQuery groupByDbId() Group by the id column
* @method CcShowQuery groupByDbName() Group by the name column
@ -39,6 +40,7 @@
* @method CcShowQuery groupByDbImagePath() Group by the image_path column
* @method CcShowQuery groupByDbHasAutoPlaylist() Group by the has_autoplaylist column
* @method CcShowQuery groupByDbAutoPlaylistId() Group by the autoplaylist_id column
* @method CcShowQuery groupByDbAutoPlaylistRepeat() Group by the autoplaylist_repeat column
*
* @method CcShowQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcShowQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@ -82,6 +84,7 @@
* @method CcShow findOneByDbImagePath(string $image_path) Return the first CcShow filtered by the image_path column
* @method CcShow findOneByDbHasAutoPlaylist(boolean $has_autoplaylist) Return the first CcShow filtered by the has_autoplaylist column
* @method CcShow findOneByDbAutoPlaylistId(int $autoplaylist_id) Return the first CcShow filtered by the autoplaylist_id column
* @method CcShow findOneByDbAutoPlaylistRepeat(boolean $autoplaylist_repeat) Return the first CcShow filtered by the autoplaylist_repeat column
*
* @method array findByDbId(int $id) Return CcShow objects filtered by the id column
* @method array findByDbName(string $name) Return CcShow objects filtered by the name column
@ -99,6 +102,7 @@
* @method array findByDbImagePath(string $image_path) Return CcShow objects filtered by the image_path column
* @method array findByDbHasAutoPlaylist(boolean $has_autoplaylist) Return CcShow objects filtered by the has_autoplaylist column
* @method array findByDbAutoPlaylistId(int $autoplaylist_id) Return CcShow objects filtered by the autoplaylist_id column
* @method array findByDbAutoPlaylistRepeat(boolean $autoplaylist_repeat) Return CcShow objects filtered by the autoplaylist_repeat column
*
* @package propel.generator.airtime.om
*/
@ -206,7 +210,7 @@ abstract class BaseCcShowQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "name", "url", "genre", "description", "color", "background_color", "live_stream_using_airtime_auth", "live_stream_using_custom_auth", "live_stream_user", "live_stream_pass", "linked", "is_linkable", "image_path", "has_autoplaylist", "autoplaylist_id" FROM "cc_show" WHERE "id" = :p0';
$sql = 'SELECT "id", "name", "url", "genre", "description", "color", "background_color", "live_stream_using_airtime_auth", "live_stream_using_custom_auth", "live_stream_user", "live_stream_pass", "linked", "is_linkable", "image_path", "has_autoplaylist", "autoplaylist_id", "autoplaylist_repeat" FROM "cc_show" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@ -777,6 +781,33 @@ abstract class BaseCcShowQuery extends ModelCriteria
return $this->addUsingAlias(CcShowPeer::AUTOPLAYLIST_ID, $dbAutoPlaylistId, $comparison);
}
/**
* Filter the query on the autoplaylist_repeat column
*
* Example usage:
* <code>
* $query->filterByDbAutoPlaylistRepeat(true); // WHERE autoplaylist_repeat = true
* $query->filterByDbAutoPlaylistRepeat('yes'); // WHERE autoplaylist_repeat = true
* </code>
*
* @param boolean|string $dbAutoPlaylistRepeat The value to use as filter.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowQuery The current query, for fluid interface
*/
public function filterByDbAutoPlaylistRepeat($dbAutoPlaylistRepeat = null, $comparison = null)
{
if (is_string($dbAutoPlaylistRepeat)) {
$dbAutoPlaylistRepeat = in_array(strtolower($dbAutoPlaylistRepeat), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(CcShowPeer::AUTOPLAYLIST_REPEAT, $dbAutoPlaylistRepeat, $comparison);
}
/**
* Filter the query by a related CcPlaylist object
*

View File

@ -153,7 +153,8 @@ class Application_Service_ShowFormService
$form->populate(
array(
'add_show_has_autoplaylist' => $this->ccShow->getDbHasAutoPlaylist() ? 1 : 0,
'add_show_autoplaylist_id' => $this->ccShow->getDbAutoPlaylistId()
'add_show_autoplaylist_id' => $this->ccShow->getDbAutoPlaylistId(),
'add_show_autoplaylist_repeat' => $this->ccShow->getDbAutoPlaylistRepeat()
));
}

View File

@ -1541,6 +1541,7 @@ SQL;
$ccShow->setDbLiveStreamUser($showData['custom_username']);
$ccShow->setDbLiveStreamPass($showData['custom_password']);
$ccShow->setDbHasAutoPlaylist($showData['add_show_has_autoplaylist'] == 1);
$ccShow->setDbAutoPlaylistRepeat($showData['add_show_autoplaylist_repeat'] == 1);
// added to prevent errors with insert due to a lack of data
if ($showData['add_show_autoplaylist_id'] != '') {
$ccShow->setDbAutoPlaylistId($showData['add_show_autoplaylist_id']);

View File

@ -518,4 +518,4 @@ class AirtimeUpgrader300alpha1 extends AirtimeUpgrader
public function getNewVersion() {
return '3.0.0-alpha.1';
}
}
}

View File

@ -18,5 +18,17 @@
<dd>
<?php echo $this->element->getElement('add_show_autoplaylist_id') ?>
</div>
<div id="add_show_autoplaylist_repeat">
<dt id="add_show_autoplaylist_repeat_label">
<label for="add_show_autoplaylist_repeat_label">
<?php echo $this->element->getElement('add_show_autoplaylist_repeat')->getLabel()?>
</label>
</dt>
<dd>
<?php echo $this->element->getElement('add_show_autoplaylist_repeat') ?>
</dd>
</div>
</dl>
</fieldset>

View File

@ -156,6 +156,7 @@
Default is /path/to/stor/dir/:ownerId/show-images/:showId/imageName -->
<column name="has_autoplaylist" phpName="DbHasAutoPlaylist" type="BOOLEAN" required="true" defaultValue="false"/>
<column name="autoplaylist_id" phpName="DbAutoPlaylistId" type="INTEGER" required="false"/>
<column name="autoplaylist_repeat" phpName="DbAutoPlaylistRepeat" type="BOOLEAN" required="true" defaultValue="false"/>
<foreign-key foreignTable="cc_playlist" name="cc_playlist_autoplaylist_fkey" onDelete="SETNULL">
<reference local="autoplaylist_id" foreign="id"/>
</foreign-key>

View File

@ -162,6 +162,7 @@ CREATE TABLE "cc_show"
"image_path" VARCHAR(255) DEFAULT '',
"has_autoplaylist" BOOLEAN DEFAULT 'f' NOT NULL,
"autoplaylist_id" INTEGER,
"autoplaylist_repeat" BOOLEAN DEFAULT 'f' NOT NULL,
PRIMARY KEY ("id")
);

View File

@ -269,6 +269,7 @@ function setAddShowEvents(form) {
if(!form.find("#add_show_has_autoplaylist").attr('checked')) {
form.find("#add_show_playlist_dropdown").hide();
form.find("#add_show_autoplaylist_repeat").hide();
}
else {
$("#add_show_playlist_dropdown").show();
@ -300,12 +301,14 @@ function setAddShowEvents(form) {
form.find("#add_show_has_autoplaylist").click(function(){
$(this).blur();
form.find("#add_show_playlist_dropdown").toggle();
form.find("#add_show_autoplaylist_repeat").toggle();
var checkBoxSelected = false;
//must switch rebroadcast displays
if(form.find("#add_show_has_autoplaylist").attr('checked')) {
form.find("#add_show_playlist_dropdown").show();
form.find("#add_show_autoplaylist_repeat").show();
}
else {
form.find("#add_show_playlist_downdown").hide();

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -68,7 +68,8 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
"custom_password" => null,
"add_show_linked" => false,
"add_show_has_autoplaylist" => 0,
"add_show_autoplaylist_id" => null
"add_show_autoplaylist_id" => null,
"add_show_autoplaylist_repeat" => 0
);
$showService->setCcShow($data);

View File

@ -16,3 +16,4 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '2'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '2'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '2'

View File

@ -16,6 +16,7 @@ cc_show:
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '2'

View File

@ -18,6 +18,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 0,
"add_show_linked" => 0,
@ -95,6 +96,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 1,
"add_show_linked" => 0,
@ -172,6 +174,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 1,
"add_show_linked" => 0,
@ -260,6 +263,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 0,
"add_show_linked" => 0,
@ -288,6 +292,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 1,
"add_show_linked" => 0,
@ -366,6 +371,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 0,
"add_show_linked" => 0,
@ -443,6 +449,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 1,
"add_show_linked" => 0,