Merge pull request #55 from radiorabe/feature/autodj

Robbs AutoDJ
This commit is contained in:
Robb 2017-03-11 18:41:08 -05:00 committed by GitHub
commit 2be8ef0f2b
65 changed files with 1611 additions and 126 deletions

View file

@ -0,0 +1,92 @@
<?php
class AutoPlaylistManager {
/**
* @var int how often, in seconds, to check for and ingest new podcast episodes
*/
private static $_AUTOPLAYLIST_POLL_INTERVAL_SECONDS = 60; // 10 minutes
/**
* Check whether $_AUTOPLAYLIST_POLL_INTERVAL_SECONDS have passed since the last call to
* buildAutoPlaylist
*
* @return bool true if $_AUTOPLAYLIST_POLL_INTERVAL_SECONDS has passed since the last check
*/
public static function hasAutoPlaylistPollIntervalPassed() {
Logging::info("Checking autoplaylist poll");
$lastPolled = Application_Model_Preference::getAutoPlaylistPollLock();
return empty($lastPolled) || (microtime(true) > $lastPolled + self::$_AUTOPLAYLIST_POLL_INTERVAL_SECONDS);
}
/*
* This function is copied from the TestUser class and is used to instantiate a user so that
* the Scheduler model can be utilized by buildAutoPlaylist.
* Not sure if this is the best strategy but it works.
*/
public static function loginUser()
{
$authAdapter = Application_Model_Auth::getAuthAdapter();
//pass to the adapter the submitted username and password
$authAdapter->setIdentity('admin')
->setCredential('admin');
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($authAdapter);
if ($result->isValid()) {
//all info about this user from the login table omit only the password
$userInfo = $authAdapter->getResultRowObject(null, 'password');
//the default storage is a session with namespace Zend_Auth
$authStorage = $auth->getStorage();
$authStorage->write($userInfo);
}
}
/**
* Find all shows with autoplaylists who have yet to have their playlists built and added to the schedule
*
*/
public static function buildAutoPlaylist() {
// Starting a session so that the User can be created
Zend_Session::start();
static::loginUser();
Logging::info("Checking to run Auto Playlist");
$autoPlaylists = static::_upcomingAutoPlaylistShows();
foreach ($autoPlaylists as $autoplaylist) {
// creates a ShowInstance object to build the playlist in from the ShowInstancesQuery Object
$si = new Application_Model_ShowInstance($autoplaylist->getDbId());
$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);
$si->setAutoPlaylistBuilt(true);
}
Application_Model_Preference::setAutoPlaylistPollLock(microtime(true));
Zend_Session::stop();
}
/**
* Find all show instances starting in the next hour with autoplaylists not yet added to the schedule
*
* @return PropelObjectCollection collection of ShowInstance objects
* that have unbuilt autoplaylists
*/
protected static function _upcomingAutoPlaylistShows() {
//setting now so that past shows aren't referenced
$now = new DateTime("now", new DateTimeZone("UTC"));
// only build playlists for shows that start up to an hour from now
$future = clone $now;
$future->add(new DateInterval('PT1H'));
return CcShowInstancesQuery::create()
->filterByDbStarts($now,Criteria::GREATER_THAN)
->filterByDbStarts($future,Criteria::LESS_THAN)
->useCcShowQuery('a', 'left join')
->filterByDbHasAutoPlaylist(true)
->endUse()
->filterByDbAutoPlaylistBuilt(false)
->find();
}
}

View file

@ -222,6 +222,33 @@ class CeleryTask implements AirtimeTask {
} }
/**
* Class AutoPlaylistTask
*
* Checks for shows with an autoplaylist that needs to be filled in
*
*/
class AutoPlaylistTask implements AirtimeTask
{
/**
* Checks whether or not the autoplaylist polling interval has passed
*
* @return bool true if the autoplaylist polling interval has passed
*/
public function shouldBeRun()
{
return AutoPlaylistManager::hasAutoPlaylistPollIntervalPassed();
}
/**
* Schedule the autoplaylist for the shows
*/
public function run()
{
AutoPlaylistManager::buildAutoPlaylist();
}
}
/** /**
* Class PodcastTask * Class PodcastTask
* *
@ -350,7 +377,7 @@ class TaskFactory {
* @return bool true if the class $c implements AirtimeTask * @return bool true if the class $c implements AirtimeTask
*/ */
private static function _isTask($c) { private static function _isTask($c) {
return is_a('AirtimeTask', $c, true); return array_key_exists('AirtimeTask', class_implements($c));
} }
/** /**

View file

@ -1,6 +1,6 @@
<?php <?php
// This file generated by Propel 1.7.0 convert-conf target // This file generated by Propel 1.7.0 convert-conf target
// from XML runtime conf file /home/sourcefabric/dev/Airtime/airtime_mvc/build/runtime-conf.xml // from XML runtime conf file /vagrant/airtime_mvc/build/runtime-conf.xml
$conf = array ( $conf = array (
'datasources' => 'datasources' =>
array ( array (

View file

@ -622,6 +622,7 @@ class ScheduleController extends Zend_Controller_Action
} }
$this->view->what = $forms["what"]; $this->view->what = $forms["what"];
$this->view->autoplaylist = $forms["autoplaylist"];
$this->view->when = $forms["when"]; $this->view->when = $forms["when"];
$this->view->repeats = $forms["repeats"]; $this->view->repeats = $forms["repeats"];
$this->view->live = $forms["live"]; $this->view->live = $forms["live"];

View file

@ -0,0 +1,3 @@
ALTER TABLE cc_show_instances DROP COLUMN IF EXISTS autoplaylist_built;
ALTER TABLE cc_show DROP COLUMN IF EXISTS has_autoplaylist;
ALTER TABLE cc_show DROP COLUMN IF EXISTS autoplaylist_id;

View file

@ -0,0 +1,3 @@
ALTER TABLE cc_show ADD COLUMN has_autoplaylist boolean default 'f' NOT NULL;
ALTER TABLE cc_show ADD COLUMN autoplaylist_id integer DEFAULT NULL;
ALTER TABLE cc_show_instances ADD COLUMN autoplaylist_built boolean default 'f' NOT NULL;

View file

@ -0,0 +1,51 @@
<?php
class Application_Form_AddShowAutoPlaylist extends Zend_Form_SubForm
{
public function init()
{
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/add-show-autoplaylist.phtml'))
));
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
// retrieves the length limit for each char field
// and store to assoc array
$maxLens = Application_Model_Show::getMaxLengths();
// Add autoplaylist checkbox element
$this->addElement('checkbox', 'add_show_has_autoplaylist', array(
'label' => _('Auto Schedule Playlist ?'),
'required' => false,
'class' => 'input_text',
'decorators' => array('ViewHelper')
));
$autoPlaylistSelect = new Zend_Form_Element_Select("add_show_autoplaylist_id");
$autoPlaylistSelect->setLabel(_("Select Playlist"));
$autoPlaylistSelect->setMultiOptions(Application_Model_Library::getPlaylistNames());
$autoPlaylistSelect->setValue(null);
$autoPlaylistSelect->setDecorators(array('ViewHelper'));
$this->addElement($autoPlaylistSelect);
}
public function disable()
{
$elements = $this->getElements();
foreach ($elements as $element) {
if ($element->getType() != 'Zend_Form_Element_Hidden') {
$element->setAttrib('disabled','disabled');
}
}
}
public function makeReadonly()
{
$elements = $this->getElements();
foreach ($elements as $element) {
if ($element->getType() != 'Zend_Form_Element_Hidden') {
$element->setAttrib('readonly','readonly');
}
}
}
}

View file

@ -27,7 +27,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
'class' => 'input_text', 'class' => 'input_text',
'required' => true, 'required' => true,
'filters' => array('StringTrim'), 'filters' => array('StringTrim'),
'value' => _('Untitled Show'), 'value' => _('New Show'),
'validators' => array($notEmptyValidator, array('StringLength', false, array(0, $maxLens['name']))) 'validators' => array($notEmptyValidator, array('StringLength', false, array(0, $maxLens['name'])))
)); ));

View file

@ -33,4 +33,18 @@ class Application_Model_Library
} }
} }
public static function getPlaylistNames()
{
$playlistNames = array(NULL => _("None"));
$playlists = CcPlaylistQuery::create()
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
->find();
foreach ($playlists as $playlist) {
$playlistNames[$playlist->getDbId()] = $playlist->getDbName();
}
return $playlistNames;
}
} }

View file

@ -1496,6 +1496,15 @@ class Application_Model_Preference
self::setValue("whats_new_dialog_viewed", $value, true); self::setValue("whats_new_dialog_viewed", $value, true);
} }
public static function getAutoPlaylistPollLock() {
return self::getValue("autoplaylist_poll_lock");
}
public static function setAutoPlaylistPollLock($value)
{
self::setValue("autoplaylist_poll_lock", $value);
}
public static function getPodcastPollLock() { public static function getPodcastPollLock() {
return self::getValue("podcast_poll_lock"); return self::getValue("podcast_poll_lock");
} }

View file

@ -129,6 +129,32 @@ class Application_Model_Show
return $this->_showId; return $this->_showId;
} }
public function getHasAutoPlaylist()
{
$show = CcShowQuery::create()->findPK($this->_showId);
$hasAutoPlaylist = $show->getDbHasAutoPlaylist();
return $hasAutoPlaylist;
}
public function setHasAutoPlaylist($value)
{
$show = CcShowQuery::create()->findPK($this->_showId);
$show->setDbHasAutoPlaylist($value);
}
public function getAutoPlaylistId()
{
$show = CcShowQuery::create()->findPK($this->_showId);
$autoPlaylistId = $show->getDbAutoPlaylistId();
return $autoPlaylistId;
}
public function setAutoPlaylistId($playlistid)
{
$show = CcShowQuery::create()->findPK($this->_showId);
$show->setDbAutoPlaylistId($playlistid);
}
public function getHosts() public function getHosts()
{ {
$sql = <<<SQL $sql = <<<SQL

View file

@ -82,6 +82,21 @@ SQL;
return $show->getDbGenre(); return $show->getDbGenre();
} }
public function hasAutoPlaylist()
{
$show = CcShowQuery::create()->findPK($this->getShowId());
return $show->getDbHasAutoPlaylist();
}
public function getAutoPlaylistId()
{
$show = CcShowQuery::create()->findPK($this->getShowId());
return $show->getDbAutoPlaylistId();
}
/** /**
* Return the start time of the Show (UTC time) * Return the start time of the Show (UTC time)
* @return string in format DEFAULT_TIMESTAMP_FORMAT (PHP time notation) * @return string in format DEFAULT_TIMESTAMP_FORMAT (PHP time notation)
@ -148,6 +163,12 @@ SQL;
Application_Model_RabbitMq::PushSchedule(); Application_Model_RabbitMq::PushSchedule();
} }
public function setAutoPlaylistBuilt($bool)
{
$this->_showInstance->setDbAutoPlaylistBuilt($bool)
->save();
}
public function updateScheduledTime() public function updateScheduledTime()
{ {
$con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME); $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME);
@ -203,7 +224,7 @@ SQL;
* @param int $plId * @param int $plId
* Playlist ID. * Playlist ID.
*/ */
/*public function addPlaylistToShow($pl_id, $checkUserPerm = true) public function addPlaylistToShow($pl_id, $checkUserPerm = true)
{ {
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0; $ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
$id = $this->_showInstance->getDbId(); $id = $this->_showInstance->getDbId();
@ -213,7 +234,7 @@ SQL;
array(array("id" => 0, "instance" => $id, "timestamp" => $ts)), array(array("id" => 0, "instance" => $id, "timestamp" => $ts)),
array(array("id" => $pl_id, "type" => "playlist")) array(array("id" => $pl_id, "type" => "playlist"))
); );
}*/ }
/** /**
* Add a media file as the last item in the show. * Add a media file as the last item in the show.
@ -239,12 +260,12 @@ SQL;
* @param array $plIds * @param array $plIds
* An array of playlist IDs. * An array of playlist IDs.
*/ */
/*public function scheduleShow($plIds) public function scheduleShow($plIds)
{ {
foreach ($plIds as $plId) { foreach ($plIds as $plId) {
$this->addPlaylistToShow($plId); $this->addPlaylistToShow($plId);
} }
}*/ }
public function clearShow() public function clearShow()
{ {

View file

@ -578,7 +578,7 @@ SQL;
* by creating $con outside the function with beingTransaction() */ * by creating $con outside the function with beingTransaction() */
/** /**
* @param int $p_id * @param int $p_id
* @param \Doctrine\DBAL\Driver\PDOConnection $con * @param Propel Connection
* *
* @return Application_Model_StoredFile * @return Application_Model_StoredFile
* @throws Exception * @throws Exception

View file

@ -319,6 +319,8 @@ class CcShow extends BaseCcShow {
$info['color'] = $this->getDbColor(); $info['color'] = $this->getDbColor();
$info['background_color'] = $this->getDbBackgroundColor(); $info['background_color'] = $this->getDbBackgroundColor();
$info['linked'] = $this->getDbLinked(); $info['linked'] = $this->getDbLinked();
$info['has_autoplaylist'] = $this->getDbHasAutoPlaylist();
$info['autoplaylist_id'] = $this->getDbAutoPlaylistId();
return $info; return $info;
} }

View file

@ -55,6 +55,7 @@ class CcPlaylistTableMap extends TableMap
public function buildRelations() public function buildRelations()
{ {
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), 'CASCADE', null); $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcShow', 'CcShow', RelationMap::ONE_TO_MANY, array('id' => 'autoplaylist_id', ), 'SET NULL', null, 'CcShows');
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null, 'CcPlaylistcontentss'); $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null, 'CcPlaylistcontentss');
} // buildRelations() } // buildRelations()

View file

@ -52,6 +52,7 @@ class CcShowInstancesTableMap extends TableMap
$this->addColumn('created', 'DbCreated', 'TIMESTAMP', true, null, null); $this->addColumn('created', 'DbCreated', 'TIMESTAMP', true, null, null);
$this->addColumn('last_scheduled', 'DbLastScheduled', 'TIMESTAMP', false, null, null); $this->addColumn('last_scheduled', 'DbLastScheduled', 'TIMESTAMP', false, null, null);
$this->addColumn('modified_instance', 'DbModifiedInstance', 'BOOLEAN', true, null, false); $this->addColumn('modified_instance', 'DbModifiedInstance', 'BOOLEAN', true, null, false);
$this->addColumn('autoplaylist_built', 'DbAutoPlaylistBuilt', 'BOOLEAN', true, null, false);
// validators // validators
} // initialize() } // initialize()

View file

@ -53,6 +53,8 @@ class CcShowTableMap extends TableMap
$this->addColumn('linked', 'DbLinked', 'BOOLEAN', true, null, false); $this->addColumn('linked', 'DbLinked', 'BOOLEAN', true, null, false);
$this->addColumn('is_linkable', 'DbIsLinkable', 'BOOLEAN', true, null, true); $this->addColumn('is_linkable', 'DbIsLinkable', 'BOOLEAN', true, null, true);
$this->addColumn('image_path', 'DbImagePath', 'VARCHAR', false, 255, ''); $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);
// validators // validators
} // initialize() } // initialize()
@ -61,6 +63,7 @@ class CcShowTableMap extends TableMap
*/ */
public function buildRelations() public function buildRelations()
{ {
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::MANY_TO_ONE, array('autoplaylist_id' => 'id', ), 'SET NULL', null);
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null, 'CcShowInstancess'); $this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null, 'CcShowInstancess');
$this->addRelation('CcShowDays', 'CcShowDays', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null, 'CcShowDayss'); $this->addRelation('CcShowDays', 'CcShowDays', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null, 'CcShowDayss');
$this->addRelation('CcShowRebroadcast', 'CcShowRebroadcast', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null, 'CcShowRebroadcasts'); $this->addRelation('CcShowRebroadcast', 'CcShowRebroadcast', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null, 'CcShowRebroadcasts');

View file

@ -78,6 +78,12 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
*/ */
protected $aCcSubjs; protected $aCcSubjs;
/**
* @var PropelObjectCollection|CcShow[] Collection to store aggregation of CcShow objects.
*/
protected $collCcShows;
protected $collCcShowsPartial;
/** /**
* @var PropelObjectCollection|CcPlaylistcontents[] Collection to store aggregation of CcPlaylistcontents objects. * @var PropelObjectCollection|CcPlaylistcontents[] Collection to store aggregation of CcPlaylistcontents objects.
*/ */
@ -104,6 +110,12 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
*/ */
protected $alreadyInClearAllReferencesDeep = false; protected $alreadyInClearAllReferencesDeep = false;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
protected $ccShowsScheduledForDeletion = null;
/** /**
* An array of objects scheduled for deletion. * An array of objects scheduled for deletion.
* @var PropelObjectCollection * @var PropelObjectCollection
@ -534,6 +546,8 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects? if ($deep) { // also de-associate any related objects?
$this->aCcSubjs = null; $this->aCcSubjs = null;
$this->collCcShows = null;
$this->collCcPlaylistcontentss = null; $this->collCcPlaylistcontentss = null;
} // if (deep) } // if (deep)
@ -680,6 +694,24 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
$this->resetModified(); $this->resetModified();
} }
if ($this->ccShowsScheduledForDeletion !== null) {
if (!$this->ccShowsScheduledForDeletion->isEmpty()) {
foreach ($this->ccShowsScheduledForDeletion as $ccShow) {
// need to save related object because we set the relation to null
$ccShow->save($con);
}
$this->ccShowsScheduledForDeletion = null;
}
}
if ($this->collCcShows !== null) {
foreach ($this->collCcShows as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->ccPlaylistcontentssScheduledForDeletion !== null) { if ($this->ccPlaylistcontentssScheduledForDeletion !== null) {
if (!$this->ccPlaylistcontentssScheduledForDeletion->isEmpty()) { if (!$this->ccPlaylistcontentssScheduledForDeletion->isEmpty()) {
CcPlaylistcontentsQuery::create() CcPlaylistcontentsQuery::create()
@ -890,6 +922,14 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
} }
if ($this->collCcShows !== null) {
foreach ($this->collCcShows as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
if ($this->collCcPlaylistcontentss !== null) { if ($this->collCcPlaylistcontentss !== null) {
foreach ($this->collCcPlaylistcontentss as $referrerFK) { foreach ($this->collCcPlaylistcontentss as $referrerFK) {
if (!$referrerFK->validate($columns)) { if (!$referrerFK->validate($columns)) {
@ -1000,6 +1040,9 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
if (null !== $this->aCcSubjs) { if (null !== $this->aCcSubjs) {
$result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
} }
if (null !== $this->collCcShows) {
$result['CcShows'] = $this->collCcShows->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collCcPlaylistcontentss) { if (null !== $this->collCcPlaylistcontentss) {
$result['CcPlaylistcontentss'] = $this->collCcPlaylistcontentss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['CcPlaylistcontentss'] = $this->collCcPlaylistcontentss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
@ -1184,6 +1227,12 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
// store object hash to prevent cycle // store object hash to prevent cycle
$this->startCopy = true; $this->startCopy = true;
foreach ($this->getCcShows() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcShow($relObj->copy($deepCopy));
}
}
foreach ($this->getCcPlaylistcontentss() as $relObj) { foreach ($this->getCcPlaylistcontentss() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcPlaylistcontents($relObj->copy($deepCopy)); $copyObj->addCcPlaylistcontents($relObj->copy($deepCopy));
@ -1303,11 +1352,239 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
*/ */
public function initRelation($relationName) public function initRelation($relationName)
{ {
if ('CcShow' == $relationName) {
$this->initCcShows();
}
if ('CcPlaylistcontents' == $relationName) { if ('CcPlaylistcontents' == $relationName) {
$this->initCcPlaylistcontentss(); $this->initCcPlaylistcontentss();
} }
} }
/**
* Clears out the collCcShows collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return CcPlaylist The current object (for fluent API support)
* @see addCcShows()
*/
public function clearCcShows()
{
$this->collCcShows = null; // important to set this to null since that means it is uninitialized
$this->collCcShowsPartial = null;
return $this;
}
/**
* reset is the collCcShows collection loaded partially
*
* @return void
*/
public function resetPartialCcShows($v = true)
{
$this->collCcShowsPartial = $v;
}
/**
* Initializes the collCcShows collection.
*
* By default this just sets the collCcShows collection to an empty array (like clearcollCcShows());
* however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database.
*
* @param boolean $overrideExisting If set to true, the method call initializes
* the collection even if it is not empty
*
* @return void
*/
public function initCcShows($overrideExisting = true)
{
if (null !== $this->collCcShows && !$overrideExisting) {
return;
}
$this->collCcShows = new PropelObjectCollection();
$this->collCcShows->setModel('CcShow');
}
/**
* Gets an array of CcShow objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this CcPlaylist is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @return PropelObjectCollection|CcShow[] List of CcShow objects
* @throws PropelException
*/
public function getCcShows($criteria = null, PropelPDO $con = null)
{
$partial = $this->collCcShowsPartial && !$this->isNew();
if (null === $this->collCcShows || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collCcShows) {
// return empty collection
$this->initCcShows();
} else {
$collCcShows = CcShowQuery::create(null, $criteria)
->filterByCcPlaylist($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collCcShowsPartial && count($collCcShows)) {
$this->initCcShows(false);
foreach ($collCcShows as $obj) {
if (false == $this->collCcShows->contains($obj)) {
$this->collCcShows->append($obj);
}
}
$this->collCcShowsPartial = true;
}
$collCcShows->getInternalIterator()->rewind();
return $collCcShows;
}
if ($partial && $this->collCcShows) {
foreach ($this->collCcShows as $obj) {
if ($obj->isNew()) {
$collCcShows[] = $obj;
}
}
}
$this->collCcShows = $collCcShows;
$this->collCcShowsPartial = false;
}
}
return $this->collCcShows;
}
/**
* Sets a collection of CcShow objects related by a one-to-many relationship
* to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
* @param PropelCollection $ccShows A Propel collection.
* @param PropelPDO $con Optional connection object
* @return CcPlaylist The current object (for fluent API support)
*/
public function setCcShows(PropelCollection $ccShows, PropelPDO $con = null)
{
$ccShowsToDelete = $this->getCcShows(new Criteria(), $con)->diff($ccShows);
$this->ccShowsScheduledForDeletion = $ccShowsToDelete;
foreach ($ccShowsToDelete as $ccShowRemoved) {
$ccShowRemoved->setCcPlaylist(null);
}
$this->collCcShows = null;
foreach ($ccShows as $ccShow) {
$this->addCcShow($ccShow);
}
$this->collCcShows = $ccShows;
$this->collCcShowsPartial = false;
return $this;
}
/**
* Returns the number of related CcShow objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related CcShow objects.
* @throws PropelException
*/
public function countCcShows(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
$partial = $this->collCcShowsPartial && !$this->isNew();
if (null === $this->collCcShows || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collCcShows) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getCcShows());
}
$query = CcShowQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByCcPlaylist($this)
->count($con);
}
return count($this->collCcShows);
}
/**
* Method called to associate a CcShow object to this object
* through the CcShow foreign key attribute.
*
* @param CcShow $l CcShow
* @return CcPlaylist The current object (for fluent API support)
*/
public function addCcShow(CcShow $l)
{
if ($this->collCcShows === null) {
$this->initCcShows();
$this->collCcShowsPartial = true;
}
if (!in_array($l, $this->collCcShows->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddCcShow($l);
if ($this->ccShowsScheduledForDeletion and $this->ccShowsScheduledForDeletion->contains($l)) {
$this->ccShowsScheduledForDeletion->remove($this->ccShowsScheduledForDeletion->search($l));
}
}
return $this;
}
/**
* @param CcShow $ccShow The ccShow object to add.
*/
protected function doAddCcShow($ccShow)
{
$this->collCcShows[]= $ccShow;
$ccShow->setCcPlaylist($this);
}
/**
* @param CcShow $ccShow The ccShow object to remove.
* @return CcPlaylist The current object (for fluent API support)
*/
public function removeCcShow($ccShow)
{
if ($this->getCcShows()->contains($ccShow)) {
$this->collCcShows->remove($this->collCcShows->search($ccShow));
if (null === $this->ccShowsScheduledForDeletion) {
$this->ccShowsScheduledForDeletion = clone $this->collCcShows;
$this->ccShowsScheduledForDeletion->clear();
}
$this->ccShowsScheduledForDeletion[]= $ccShow;
$ccShow->setCcPlaylist(null);
}
return $this;
}
/** /**
* Clears out the collCcPlaylistcontentss collection * Clears out the collCcPlaylistcontentss collection
* *
@ -1618,6 +1895,11 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
{ {
if ($deep && !$this->alreadyInClearAllReferencesDeep) { if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true; $this->alreadyInClearAllReferencesDeep = true;
if ($this->collCcShows) {
foreach ($this->collCcShows as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collCcPlaylistcontentss) { if ($this->collCcPlaylistcontentss) {
foreach ($this->collCcPlaylistcontentss as $o) { foreach ($this->collCcPlaylistcontentss as $o) {
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
@ -1630,6 +1912,10 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
$this->alreadyInClearAllReferencesDeep = false; $this->alreadyInClearAllReferencesDeep = false;
} // if ($deep) } // if ($deep)
if ($this->collCcShows instanceof PropelCollection) {
$this->collCcShows->clearIterator();
}
$this->collCcShows = null;
if ($this->collCcPlaylistcontentss instanceof PropelCollection) { if ($this->collCcPlaylistcontentss instanceof PropelCollection) {
$this->collCcPlaylistcontentss->clearIterator(); $this->collCcPlaylistcontentss->clearIterator();
} }

View file

@ -385,6 +385,9 @@ abstract class BaseCcPlaylistPeer
*/ */
public static function clearRelatedInstancePool() public static function clearRelatedInstancePool()
{ {
// Invalidate objects in CcShowPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcShowPeer::clearInstancePool();
// Invalidate objects in CcPlaylistcontentsPeer instance pool, // Invalidate objects in CcPlaylistcontentsPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcPlaylistcontentsPeer::clearInstancePool(); CcPlaylistcontentsPeer::clearInstancePool();

View file

@ -30,6 +30,10 @@
* @method CcPlaylistQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation * @method CcPlaylistQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation
* @method CcPlaylistQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs relation * @method CcPlaylistQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs relation
* *
* @method CcPlaylistQuery leftJoinCcShow($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShow relation
* @method CcPlaylistQuery rightJoinCcShow($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShow relation
* @method CcPlaylistQuery innerJoinCcShow($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShow relation
*
* @method CcPlaylistQuery leftJoinCcPlaylistcontents($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlaylistcontents relation * @method CcPlaylistQuery leftJoinCcPlaylistcontents($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlaylistcontents relation
* @method CcPlaylistQuery rightJoinCcPlaylistcontents($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation * @method CcPlaylistQuery rightJoinCcPlaylistcontents($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
* @method CcPlaylistQuery innerJoinCcPlaylistcontents($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation * @method CcPlaylistQuery innerJoinCcPlaylistcontents($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
@ -582,6 +586,80 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery');
} }
/**
* Filter the query by a related CcShow object
*
* @param CcShow|PropelObjectCollection $ccShow the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcShow($ccShow, $comparison = null)
{
if ($ccShow instanceof CcShow) {
return $this
->addUsingAlias(CcPlaylistPeer::ID, $ccShow->getDbAutoPlaylistId(), $comparison);
} elseif ($ccShow instanceof PropelObjectCollection) {
return $this
->useCcShowQuery()
->filterByPrimaryKeys($ccShow->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCcShow() only accepts arguments of type CcShow or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the CcShow relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcPlaylistQuery The current query, for fluid interface
*/
public function joinCcShow($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcShow');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcShow');
}
return $this;
}
/**
* Use the CcShow relation CcShow object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowQuery A secondary query class using the current class as primary query
*/
public function useCcShowQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcShow($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcShow', 'CcShowQuery');
}
/** /**
* Filter the query by a related CcPlaylistcontents object * Filter the query by a related CcPlaylistcontents object
* *

View file

@ -121,6 +121,24 @@ abstract class BaseCcShow extends BaseObject implements Persistent
*/ */
protected $image_path; protected $image_path;
/**
* The value for the has_autoplaylist field.
* Note: this column has a database default value of: false
* @var boolean
*/
protected $has_autoplaylist;
/**
* The value for the autoplaylist_id field.
* @var int
*/
protected $autoplaylist_id;
/**
* @var CcPlaylist
*/
protected $aCcPlaylist;
/** /**
* @var PropelObjectCollection|CcShowInstances[] Collection to store aggregation of CcShowInstances objects. * @var PropelObjectCollection|CcShowInstances[] Collection to store aggregation of CcShowInstances objects.
*/ */
@ -205,6 +223,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->linked = false; $this->linked = false;
$this->is_linkable = true; $this->is_linkable = true;
$this->image_path = ''; $this->image_path = '';
$this->has_autoplaylist = false;
} }
/** /**
@ -371,6 +390,28 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return $this->image_path; return $this->image_path;
} }
/**
* Get the [has_autoplaylist] column value.
*
* @return boolean
*/
public function getDbHasAutoPlaylist()
{
return $this->has_autoplaylist;
}
/**
* Get the [autoplaylist_id] column value.
*
* @return int
*/
public function getDbAutoPlaylistId()
{
return $this->autoplaylist_id;
}
/** /**
* Set the value of [id] column. * Set the value of [id] column.
* *
@ -697,6 +738,60 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return $this; return $this;
} // setDbImagePath() } // setDbImagePath()
/**
* Sets the value of the [has_autoplaylist] 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 setDbHasAutoPlaylist($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->has_autoplaylist !== $v) {
$this->has_autoplaylist = $v;
$this->modifiedColumns[] = CcShowPeer::HAS_AUTOPLAYLIST;
}
return $this;
} // setDbHasAutoPlaylist()
/**
* Set the value of [autoplaylist_id] column.
*
* @param int $v new value
* @return CcShow The current object (for fluent API support)
*/
public function setDbAutoPlaylistId($v)
{
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
if ($this->autoplaylist_id !== $v) {
$this->autoplaylist_id = $v;
$this->modifiedColumns[] = CcShowPeer::AUTOPLAYLIST_ID;
}
if ($this->aCcPlaylist !== null && $this->aCcPlaylist->getDbId() !== $v) {
$this->aCcPlaylist = null;
}
return $this;
} // setDbAutoPlaylistId()
/** /**
* Indicates whether the columns in this object are only set to default values. * Indicates whether the columns in this object are only set to default values.
* *
@ -739,6 +834,10 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return false; return false;
} }
if ($this->has_autoplaylist !== false) {
return false;
}
// otherwise, everything was equal, so return true // otherwise, everything was equal, so return true
return true; return true;
} // hasOnlyDefaultValues() } // hasOnlyDefaultValues()
@ -775,6 +874,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->linked = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null; $this->linked = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null;
$this->is_linkable = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null; $this->is_linkable = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null;
$this->image_path = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; $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->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
@ -784,7 +885,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
} }
$this->postHydrate($row, $startcol, $rehydrate); $this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 14; // 14 = CcShowPeer::NUM_HYDRATE_COLUMNS. return $startcol + 16; // 16 = CcShowPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating CcShow object", $e); throw new PropelException("Error populating CcShow object", $e);
@ -807,6 +908,9 @@ abstract class BaseCcShow extends BaseObject implements Persistent
public function ensureConsistency() public function ensureConsistency()
{ {
if ($this->aCcPlaylist !== null && $this->autoplaylist_id !== $this->aCcPlaylist->getDbId()) {
$this->aCcPlaylist = null;
}
} // ensureConsistency } // ensureConsistency
/** /**
@ -846,6 +950,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects? if ($deep) { // also de-associate any related objects?
$this->aCcPlaylist = null;
$this->collCcShowInstancess = null; $this->collCcShowInstancess = null;
$this->collCcShowDayss = null; $this->collCcShowDayss = null;
@ -967,6 +1072,18 @@ abstract class BaseCcShow extends BaseObject implements Persistent
if (!$this->alreadyInSave) { if (!$this->alreadyInSave) {
$this->alreadyInSave = true; $this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aCcPlaylist !== null) {
if ($this->aCcPlaylist->isModified() || $this->aCcPlaylist->isNew()) {
$affectedRows += $this->aCcPlaylist->save($con);
}
$this->setCcPlaylist($this->aCcPlaylist);
}
if ($this->isNew() || $this->isModified()) { if ($this->isNew() || $this->isModified()) {
// persist changes // persist changes
if ($this->isNew()) { if ($this->isNew()) {
@ -1124,6 +1241,12 @@ abstract class BaseCcShow extends BaseObject implements Persistent
if ($this->isColumnModified(CcShowPeer::IMAGE_PATH)) { if ($this->isColumnModified(CcShowPeer::IMAGE_PATH)) {
$modifiedColumns[':p' . $index++] = '"image_path"'; $modifiedColumns[':p' . $index++] = '"image_path"';
} }
if ($this->isColumnModified(CcShowPeer::HAS_AUTOPLAYLIST)) {
$modifiedColumns[':p' . $index++] = '"has_autoplaylist"';
}
if ($this->isColumnModified(CcShowPeer::AUTOPLAYLIST_ID)) {
$modifiedColumns[':p' . $index++] = '"autoplaylist_id"';
}
$sql = sprintf( $sql = sprintf(
'INSERT INTO "cc_show" (%s) VALUES (%s)', 'INSERT INTO "cc_show" (%s) VALUES (%s)',
@ -1177,6 +1300,12 @@ abstract class BaseCcShow extends BaseObject implements Persistent
case '"image_path"': case '"image_path"':
$stmt->bindValue($identifier, $this->image_path, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->image_path, PDO::PARAM_STR);
break; break;
case '"has_autoplaylist"':
$stmt->bindValue($identifier, $this->has_autoplaylist, PDO::PARAM_BOOL);
break;
case '"autoplaylist_id"':
$stmt->bindValue($identifier, $this->autoplaylist_id, PDO::PARAM_INT);
break;
} }
} }
$stmt->execute(); $stmt->execute();
@ -1264,6 +1393,18 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$failureMap = array(); $failureMap = array();
// We call the validate method on the following object(s) if they
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aCcPlaylist !== null) {
if (!$this->aCcPlaylist->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aCcPlaylist->getValidationFailures());
}
}
if (($retval = CcShowPeer::doValidate($this, $columns)) !== true) { if (($retval = CcShowPeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval); $failureMap = array_merge($failureMap, $retval);
} }
@ -1378,6 +1519,12 @@ abstract class BaseCcShow extends BaseObject implements Persistent
case 13: case 13:
return $this->getDbImagePath(); return $this->getDbImagePath();
break; break;
case 14:
return $this->getDbHasAutoPlaylist();
break;
case 15:
return $this->getDbAutoPlaylistId();
break;
default: default:
return null; return null;
break; break;
@ -1421,6 +1568,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$keys[11] => $this->getDbLinked(), $keys[11] => $this->getDbLinked(),
$keys[12] => $this->getDbIsLinkable(), $keys[12] => $this->getDbIsLinkable(),
$keys[13] => $this->getDbImagePath(), $keys[13] => $this->getDbImagePath(),
$keys[14] => $this->getDbHasAutoPlaylist(),
$keys[15] => $this->getDbAutoPlaylistId(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@ -1428,6 +1577,9 @@ abstract class BaseCcShow extends BaseObject implements Persistent
} }
if ($includeForeignObjects) { if ($includeForeignObjects) {
if (null !== $this->aCcPlaylist) {
$result['CcPlaylist'] = $this->aCcPlaylist->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
if (null !== $this->collCcShowInstancess) { if (null !== $this->collCcShowInstancess) {
$result['CcShowInstancess'] = $this->collCcShowInstancess->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['CcShowInstancess'] = $this->collCcShowInstancess->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
@ -1516,6 +1668,12 @@ abstract class BaseCcShow extends BaseObject implements Persistent
case 13: case 13:
$this->setDbImagePath($value); $this->setDbImagePath($value);
break; break;
case 14:
$this->setDbHasAutoPlaylist($value);
break;
case 15:
$this->setDbAutoPlaylistId($value);
break;
} // switch() } // switch()
} }
@ -1554,6 +1712,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
if (array_key_exists($keys[11], $arr)) $this->setDbLinked($arr[$keys[11]]); if (array_key_exists($keys[11], $arr)) $this->setDbLinked($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setDbIsLinkable($arr[$keys[12]]); if (array_key_exists($keys[12], $arr)) $this->setDbIsLinkable($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setDbImagePath($arr[$keys[13]]); 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]]);
} }
/** /**
@ -1579,6 +1739,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
if ($this->isColumnModified(CcShowPeer::LINKED)) $criteria->add(CcShowPeer::LINKED, $this->linked); if ($this->isColumnModified(CcShowPeer::LINKED)) $criteria->add(CcShowPeer::LINKED, $this->linked);
if ($this->isColumnModified(CcShowPeer::IS_LINKABLE)) $criteria->add(CcShowPeer::IS_LINKABLE, $this->is_linkable); if ($this->isColumnModified(CcShowPeer::IS_LINKABLE)) $criteria->add(CcShowPeer::IS_LINKABLE, $this->is_linkable);
if ($this->isColumnModified(CcShowPeer::IMAGE_PATH)) $criteria->add(CcShowPeer::IMAGE_PATH, $this->image_path); 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);
return $criteria; return $criteria;
} }
@ -1655,6 +1817,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$copyObj->setDbLinked($this->getDbLinked()); $copyObj->setDbLinked($this->getDbLinked());
$copyObj->setDbIsLinkable($this->getDbIsLinkable()); $copyObj->setDbIsLinkable($this->getDbIsLinkable());
$copyObj->setDbImagePath($this->getDbImagePath()); $copyObj->setDbImagePath($this->getDbImagePath());
$copyObj->setDbHasAutoPlaylist($this->getDbHasAutoPlaylist());
$copyObj->setDbAutoPlaylistId($this->getDbAutoPlaylistId());
if ($deepCopy && !$this->startCopy) { if ($deepCopy && !$this->startCopy) {
// important: temporarily setNew(false) because this affects the behavior of // important: temporarily setNew(false) because this affects the behavior of
@ -1737,6 +1901,58 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return self::$peer; return self::$peer;
} }
/**
* Declares an association between this object and a CcPlaylist object.
*
* @param CcPlaylist $v
* @return CcShow The current object (for fluent API support)
* @throws PropelException
*/
public function setCcPlaylist(CcPlaylist $v = null)
{
if ($v === null) {
$this->setDbAutoPlaylistId(NULL);
} else {
$this->setDbAutoPlaylistId($v->getDbId());
}
$this->aCcPlaylist = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the CcPlaylist object, it will not be re-added.
if ($v !== null) {
$v->addCcShow($this);
}
return $this;
}
/**
* Get the associated CcPlaylist object
*
* @param PropelPDO $con Optional Connection object.
* @param $doQuery Executes a query to get the object if required
* @return CcPlaylist The associated CcPlaylist object.
* @throws PropelException
*/
public function getCcPlaylist(PropelPDO $con = null, $doQuery = true)
{
if ($this->aCcPlaylist === null && ($this->autoplaylist_id !== null) && $doQuery) {
$this->aCcPlaylist = CcPlaylistQuery::create()->findPk($this->autoplaylist_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->aCcPlaylist->addCcShows($this);
*/
}
return $this->aCcPlaylist;
}
/** /**
* Initializes a collection based on the name of a relation. * Initializes a collection based on the name of a relation.
@ -2756,6 +2972,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->linked = null; $this->linked = null;
$this->is_linkable = null; $this->is_linkable = null;
$this->image_path = null; $this->image_path = null;
$this->has_autoplaylist = null;
$this->autoplaylist_id = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->alreadyInValidation = false; $this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false; $this->alreadyInClearAllReferencesDeep = false;
@ -2799,6 +3017,9 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
if ($this->aCcPlaylist instanceof Persistent) {
$this->aCcPlaylist->clearAllReferences($deep);
}
$this->alreadyInClearAllReferencesDeep = false; $this->alreadyInClearAllReferencesDeep = false;
} // if ($deep) } // if ($deep)
@ -2819,6 +3040,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->collCcShowHostss->clearIterator(); $this->collCcShowHostss->clearIterator();
} }
$this->collCcShowHostss = null; $this->collCcShowHostss = null;
$this->aCcPlaylist = null;
} }
/** /**

View file

@ -112,6 +112,13 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
*/ */
protected $modified_instance; protected $modified_instance;
/**
* The value for the autoplaylist_built field.
* Note: this column has a database default value of: false
* @var boolean
*/
protected $autoplaylist_built;
/** /**
* @var CcShow * @var CcShow
*/ */
@ -196,6 +203,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$this->rebroadcast = 0; $this->rebroadcast = 0;
$this->time_filled = '00:00:00'; $this->time_filled = '00:00:00';
$this->modified_instance = false; $this->modified_instance = false;
$this->autoplaylist_built = false;
} }
/** /**
@ -447,6 +455,17 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
return $this->modified_instance; return $this->modified_instance;
} }
/**
* Get the [autoplaylist_built] column value.
*
* @return boolean
*/
public function getDbAutoPlaylistBuilt()
{
return $this->autoplaylist_built;
}
/** /**
* Set the value of [id] column. * Set the value of [id] column.
* *
@ -748,6 +767,35 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
return $this; return $this;
} // setDbModifiedInstance() } // setDbModifiedInstance()
/**
* Sets the value of the [autoplaylist_built] 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 CcShowInstances The current object (for fluent API support)
*/
public function setDbAutoPlaylistBuilt($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_built !== $v) {
$this->autoplaylist_built = $v;
$this->modifiedColumns[] = CcShowInstancesPeer::AUTOPLAYLIST_BUILT;
}
return $this;
} // setDbAutoPlaylistBuilt()
/** /**
* Indicates whether the columns in this object are only set to default values. * Indicates whether the columns in this object are only set to default values.
* *
@ -778,6 +826,10 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
return false; return false;
} }
if ($this->autoplaylist_built !== false) {
return false;
}
// otherwise, everything was equal, so return true // otherwise, everything was equal, so return true
return true; return true;
} // hasOnlyDefaultValues() } // hasOnlyDefaultValues()
@ -813,6 +865,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$this->created = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; $this->created = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
$this->last_scheduled = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; $this->last_scheduled = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
$this->modified_instance = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null; $this->modified_instance = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null;
$this->autoplaylist_built = ($row[$startcol + 13] !== null) ? (boolean) $row[$startcol + 13] : null;
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
@ -822,7 +875,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
} }
$this->postHydrate($row, $startcol, $rehydrate); $this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 13; // 13 = CcShowInstancesPeer::NUM_HYDRATE_COLUMNS. return $startcol + 14; // 14 = CcShowInstancesPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating CcShowInstances object", $e); throw new PropelException("Error populating CcShowInstances object", $e);
@ -1179,6 +1232,9 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
if ($this->isColumnModified(CcShowInstancesPeer::MODIFIED_INSTANCE)) { if ($this->isColumnModified(CcShowInstancesPeer::MODIFIED_INSTANCE)) {
$modifiedColumns[':p' . $index++] = '"modified_instance"'; $modifiedColumns[':p' . $index++] = '"modified_instance"';
} }
if ($this->isColumnModified(CcShowInstancesPeer::AUTOPLAYLIST_BUILT)) {
$modifiedColumns[':p' . $index++] = '"autoplaylist_built"';
}
$sql = sprintf( $sql = sprintf(
'INSERT INTO "cc_show_instances" (%s) VALUES (%s)', 'INSERT INTO "cc_show_instances" (%s) VALUES (%s)',
@ -1229,6 +1285,9 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
case '"modified_instance"': case '"modified_instance"':
$stmt->bindValue($identifier, $this->modified_instance, PDO::PARAM_BOOL); $stmt->bindValue($identifier, $this->modified_instance, PDO::PARAM_BOOL);
break; break;
case '"autoplaylist_built"':
$stmt->bindValue($identifier, $this->autoplaylist_built, PDO::PARAM_BOOL);
break;
} }
} }
$stmt->execute(); $stmt->execute();
@ -1443,6 +1502,9 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
case 12: case 12:
return $this->getDbModifiedInstance(); return $this->getDbModifiedInstance();
break; break;
case 13:
return $this->getDbAutoPlaylistBuilt();
break;
default: default:
return null; return null;
break; break;
@ -1485,6 +1547,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$keys[10] => $this->getDbCreated(), $keys[10] => $this->getDbCreated(),
$keys[11] => $this->getDbLastScheduled(), $keys[11] => $this->getDbLastScheduled(),
$keys[12] => $this->getDbModifiedInstance(), $keys[12] => $this->getDbModifiedInstance(),
$keys[13] => $this->getDbAutoPlaylistBuilt(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@ -1583,6 +1646,9 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
case 12: case 12:
$this->setDbModifiedInstance($value); $this->setDbModifiedInstance($value);
break; break;
case 13:
$this->setDbAutoPlaylistBuilt($value);
break;
} // switch() } // switch()
} }
@ -1620,6 +1686,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
if (array_key_exists($keys[10], $arr)) $this->setDbCreated($arr[$keys[10]]); if (array_key_exists($keys[10], $arr)) $this->setDbCreated($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setDbLastScheduled($arr[$keys[11]]); if (array_key_exists($keys[11], $arr)) $this->setDbLastScheduled($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setDbModifiedInstance($arr[$keys[12]]); if (array_key_exists($keys[12], $arr)) $this->setDbModifiedInstance($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setDbAutoPlaylistBuilt($arr[$keys[13]]);
} }
/** /**
@ -1644,6 +1711,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
if ($this->isColumnModified(CcShowInstancesPeer::CREATED)) $criteria->add(CcShowInstancesPeer::CREATED, $this->created); if ($this->isColumnModified(CcShowInstancesPeer::CREATED)) $criteria->add(CcShowInstancesPeer::CREATED, $this->created);
if ($this->isColumnModified(CcShowInstancesPeer::LAST_SCHEDULED)) $criteria->add(CcShowInstancesPeer::LAST_SCHEDULED, $this->last_scheduled); if ($this->isColumnModified(CcShowInstancesPeer::LAST_SCHEDULED)) $criteria->add(CcShowInstancesPeer::LAST_SCHEDULED, $this->last_scheduled);
if ($this->isColumnModified(CcShowInstancesPeer::MODIFIED_INSTANCE)) $criteria->add(CcShowInstancesPeer::MODIFIED_INSTANCE, $this->modified_instance); if ($this->isColumnModified(CcShowInstancesPeer::MODIFIED_INSTANCE)) $criteria->add(CcShowInstancesPeer::MODIFIED_INSTANCE, $this->modified_instance);
if ($this->isColumnModified(CcShowInstancesPeer::AUTOPLAYLIST_BUILT)) $criteria->add(CcShowInstancesPeer::AUTOPLAYLIST_BUILT, $this->autoplaylist_built);
return $criteria; return $criteria;
} }
@ -1719,6 +1787,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$copyObj->setDbCreated($this->getDbCreated()); $copyObj->setDbCreated($this->getDbCreated());
$copyObj->setDbLastScheduled($this->getDbLastScheduled()); $copyObj->setDbLastScheduled($this->getDbLastScheduled());
$copyObj->setDbModifiedInstance($this->getDbModifiedInstance()); $copyObj->setDbModifiedInstance($this->getDbModifiedInstance());
$copyObj->setDbAutoPlaylistBuilt($this->getDbAutoPlaylistBuilt());
if ($deepCopy && !$this->startCopy) { if ($deepCopy && !$this->startCopy) {
// important: temporarily setNew(false) because this affects the behavior of // important: temporarily setNew(false) because this affects the behavior of
@ -2791,6 +2860,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$this->created = null; $this->created = null;
$this->last_scheduled = null; $this->last_scheduled = null;
$this->modified_instance = null; $this->modified_instance = null;
$this->autoplaylist_built = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->alreadyInValidation = false; $this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false; $this->alreadyInClearAllReferencesDeep = false;

View file

@ -24,13 +24,13 @@ abstract class BaseCcShowInstancesPeer
const TM_CLASS = 'CcShowInstancesTableMap'; const TM_CLASS = 'CcShowInstancesTableMap';
/** The total number of columns. */ /** The total number of columns. */
const NUM_COLUMNS = 13; const NUM_COLUMNS = 14;
/** The number of lazy-loaded columns. */ /** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0; const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 13; const NUM_HYDRATE_COLUMNS = 14;
/** the column name for the id field */ /** the column name for the id field */
const ID = 'cc_show_instances.id'; const ID = 'cc_show_instances.id';
@ -71,6 +71,9 @@ abstract class BaseCcShowInstancesPeer
/** the column name for the modified_instance field */ /** the column name for the modified_instance field */
const MODIFIED_INSTANCE = 'cc_show_instances.modified_instance'; const MODIFIED_INSTANCE = 'cc_show_instances.modified_instance';
/** the column name for the autoplaylist_built field */
const AUTOPLAYLIST_BUILT = 'cc_show_instances.autoplaylist_built';
/** The default string format for model objects of the related table **/ /** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML'; const DEFAULT_STRING_FORMAT = 'YAML';
@ -90,12 +93,12 @@ abstract class BaseCcShowInstancesPeer
* e.g. CcShowInstancesPeer::$fieldNames[CcShowInstancesPeer::TYPE_PHPNAME][0] = 'Id' * e.g. CcShowInstancesPeer::$fieldNames[CcShowInstancesPeer::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbDescription', 'DbStarts', 'DbEnds', 'DbShowId', 'DbRecord', 'DbRebroadcast', 'DbOriginalShow', 'DbRecordedFile', 'DbTimeFilled', 'DbCreated', 'DbLastScheduled', 'DbModifiedInstance', ), BasePeer::TYPE_PHPNAME => array ('DbId', 'DbDescription', 'DbStarts', 'DbEnds', 'DbShowId', 'DbRecord', 'DbRebroadcast', 'DbOriginalShow', 'DbRecordedFile', 'DbTimeFilled', 'DbCreated', 'DbLastScheduled', 'DbModifiedInstance', 'DbAutoPlaylistBuilt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbDescription', 'dbStarts', 'dbEnds', 'dbShowId', 'dbRecord', 'dbRebroadcast', 'dbOriginalShow', 'dbRecordedFile', 'dbTimeFilled', 'dbCreated', 'dbLastScheduled', 'dbModifiedInstance', ), BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbDescription', 'dbStarts', 'dbEnds', 'dbShowId', 'dbRecord', 'dbRebroadcast', 'dbOriginalShow', 'dbRecordedFile', 'dbTimeFilled', 'dbCreated', 'dbLastScheduled', 'dbModifiedInstance', 'dbAutoPlaylistBuilt', ),
BasePeer::TYPE_COLNAME => array (CcShowInstancesPeer::ID, CcShowInstancesPeer::DESCRIPTION, CcShowInstancesPeer::STARTS, CcShowInstancesPeer::ENDS, CcShowInstancesPeer::SHOW_ID, CcShowInstancesPeer::RECORD, CcShowInstancesPeer::REBROADCAST, CcShowInstancesPeer::INSTANCE_ID, CcShowInstancesPeer::FILE_ID, CcShowInstancesPeer::TIME_FILLED, CcShowInstancesPeer::CREATED, CcShowInstancesPeer::LAST_SCHEDULED, CcShowInstancesPeer::MODIFIED_INSTANCE, ), BasePeer::TYPE_COLNAME => array (CcShowInstancesPeer::ID, CcShowInstancesPeer::DESCRIPTION, CcShowInstancesPeer::STARTS, CcShowInstancesPeer::ENDS, CcShowInstancesPeer::SHOW_ID, CcShowInstancesPeer::RECORD, CcShowInstancesPeer::REBROADCAST, CcShowInstancesPeer::INSTANCE_ID, CcShowInstancesPeer::FILE_ID, CcShowInstancesPeer::TIME_FILLED, CcShowInstancesPeer::CREATED, CcShowInstancesPeer::LAST_SCHEDULED, CcShowInstancesPeer::MODIFIED_INSTANCE, CcShowInstancesPeer::AUTOPLAYLIST_BUILT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'DESCRIPTION', 'STARTS', 'ENDS', 'SHOW_ID', 'RECORD', 'REBROADCAST', 'INSTANCE_ID', 'FILE_ID', 'TIME_FILLED', 'CREATED', 'LAST_SCHEDULED', 'MODIFIED_INSTANCE', ), BasePeer::TYPE_RAW_COLNAME => array ('ID', 'DESCRIPTION', 'STARTS', 'ENDS', 'SHOW_ID', 'RECORD', 'REBROADCAST', 'INSTANCE_ID', 'FILE_ID', 'TIME_FILLED', 'CREATED', 'LAST_SCHEDULED', 'MODIFIED_INSTANCE', 'AUTOPLAYLIST_BUILT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'description', 'starts', 'ends', 'show_id', 'record', 'rebroadcast', 'instance_id', 'file_id', 'time_filled', 'created', 'last_scheduled', 'modified_instance', ), BasePeer::TYPE_FIELDNAME => array ('id', 'description', 'starts', 'ends', 'show_id', 'record', 'rebroadcast', 'instance_id', 'file_id', 'time_filled', 'created', 'last_scheduled', 'modified_instance', 'autoplaylist_built', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
); );
/** /**
@ -105,12 +108,12 @@ abstract class BaseCcShowInstancesPeer
* e.g. CcShowInstancesPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 * e.g. CcShowInstancesPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbDescription' => 1, 'DbStarts' => 2, 'DbEnds' => 3, 'DbShowId' => 4, 'DbRecord' => 5, 'DbRebroadcast' => 6, 'DbOriginalShow' => 7, 'DbRecordedFile' => 8, 'DbTimeFilled' => 9, 'DbCreated' => 10, 'DbLastScheduled' => 11, 'DbModifiedInstance' => 12, ), BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbDescription' => 1, 'DbStarts' => 2, 'DbEnds' => 3, 'DbShowId' => 4, 'DbRecord' => 5, 'DbRebroadcast' => 6, 'DbOriginalShow' => 7, 'DbRecordedFile' => 8, 'DbTimeFilled' => 9, 'DbCreated' => 10, 'DbLastScheduled' => 11, 'DbModifiedInstance' => 12, 'DbAutoPlaylistBuilt' => 13, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbDescription' => 1, 'dbStarts' => 2, 'dbEnds' => 3, 'dbShowId' => 4, 'dbRecord' => 5, 'dbRebroadcast' => 6, 'dbOriginalShow' => 7, 'dbRecordedFile' => 8, 'dbTimeFilled' => 9, 'dbCreated' => 10, 'dbLastScheduled' => 11, 'dbModifiedInstance' => 12, ), BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbDescription' => 1, 'dbStarts' => 2, 'dbEnds' => 3, 'dbShowId' => 4, 'dbRecord' => 5, 'dbRebroadcast' => 6, 'dbOriginalShow' => 7, 'dbRecordedFile' => 8, 'dbTimeFilled' => 9, 'dbCreated' => 10, 'dbLastScheduled' => 11, 'dbModifiedInstance' => 12, 'dbAutoPlaylistBuilt' => 13, ),
BasePeer::TYPE_COLNAME => array (CcShowInstancesPeer::ID => 0, CcShowInstancesPeer::DESCRIPTION => 1, CcShowInstancesPeer::STARTS => 2, CcShowInstancesPeer::ENDS => 3, CcShowInstancesPeer::SHOW_ID => 4, CcShowInstancesPeer::RECORD => 5, CcShowInstancesPeer::REBROADCAST => 6, CcShowInstancesPeer::INSTANCE_ID => 7, CcShowInstancesPeer::FILE_ID => 8, CcShowInstancesPeer::TIME_FILLED => 9, CcShowInstancesPeer::CREATED => 10, CcShowInstancesPeer::LAST_SCHEDULED => 11, CcShowInstancesPeer::MODIFIED_INSTANCE => 12, ), BasePeer::TYPE_COLNAME => array (CcShowInstancesPeer::ID => 0, CcShowInstancesPeer::DESCRIPTION => 1, CcShowInstancesPeer::STARTS => 2, CcShowInstancesPeer::ENDS => 3, CcShowInstancesPeer::SHOW_ID => 4, CcShowInstancesPeer::RECORD => 5, CcShowInstancesPeer::REBROADCAST => 6, CcShowInstancesPeer::INSTANCE_ID => 7, CcShowInstancesPeer::FILE_ID => 8, CcShowInstancesPeer::TIME_FILLED => 9, CcShowInstancesPeer::CREATED => 10, CcShowInstancesPeer::LAST_SCHEDULED => 11, CcShowInstancesPeer::MODIFIED_INSTANCE => 12, CcShowInstancesPeer::AUTOPLAYLIST_BUILT => 13, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'DESCRIPTION' => 1, 'STARTS' => 2, 'ENDS' => 3, 'SHOW_ID' => 4, 'RECORD' => 5, 'REBROADCAST' => 6, 'INSTANCE_ID' => 7, 'FILE_ID' => 8, 'TIME_FILLED' => 9, 'CREATED' => 10, 'LAST_SCHEDULED' => 11, 'MODIFIED_INSTANCE' => 12, ), BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'DESCRIPTION' => 1, 'STARTS' => 2, 'ENDS' => 3, 'SHOW_ID' => 4, 'RECORD' => 5, 'REBROADCAST' => 6, 'INSTANCE_ID' => 7, 'FILE_ID' => 8, 'TIME_FILLED' => 9, 'CREATED' => 10, 'LAST_SCHEDULED' => 11, 'MODIFIED_INSTANCE' => 12, 'AUTOPLAYLIST_BUILT' => 13, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'description' => 1, 'starts' => 2, 'ends' => 3, 'show_id' => 4, 'record' => 5, 'rebroadcast' => 6, 'instance_id' => 7, 'file_id' => 8, 'time_filled' => 9, 'created' => 10, 'last_scheduled' => 11, 'modified_instance' => 12, ), BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'description' => 1, 'starts' => 2, 'ends' => 3, 'show_id' => 4, 'record' => 5, 'rebroadcast' => 6, 'instance_id' => 7, 'file_id' => 8, 'time_filled' => 9, 'created' => 10, 'last_scheduled' => 11, 'modified_instance' => 12, 'autoplaylist_built' => 13, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
); );
/** /**
@ -197,6 +200,7 @@ abstract class BaseCcShowInstancesPeer
$criteria->addSelectColumn(CcShowInstancesPeer::CREATED); $criteria->addSelectColumn(CcShowInstancesPeer::CREATED);
$criteria->addSelectColumn(CcShowInstancesPeer::LAST_SCHEDULED); $criteria->addSelectColumn(CcShowInstancesPeer::LAST_SCHEDULED);
$criteria->addSelectColumn(CcShowInstancesPeer::MODIFIED_INSTANCE); $criteria->addSelectColumn(CcShowInstancesPeer::MODIFIED_INSTANCE);
$criteria->addSelectColumn(CcShowInstancesPeer::AUTOPLAYLIST_BUILT);
} else { } else {
$criteria->addSelectColumn($alias . '.id'); $criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.description'); $criteria->addSelectColumn($alias . '.description');
@ -211,6 +215,7 @@ abstract class BaseCcShowInstancesPeer
$criteria->addSelectColumn($alias . '.created'); $criteria->addSelectColumn($alias . '.created');
$criteria->addSelectColumn($alias . '.last_scheduled'); $criteria->addSelectColumn($alias . '.last_scheduled');
$criteria->addSelectColumn($alias . '.modified_instance'); $criteria->addSelectColumn($alias . '.modified_instance');
$criteria->addSelectColumn($alias . '.autoplaylist_built');
} }
} }

View file

@ -19,6 +19,7 @@
* @method CcShowInstancesQuery orderByDbCreated($order = Criteria::ASC) Order by the created column * @method CcShowInstancesQuery orderByDbCreated($order = Criteria::ASC) Order by the created column
* @method CcShowInstancesQuery orderByDbLastScheduled($order = Criteria::ASC) Order by the last_scheduled column * @method CcShowInstancesQuery orderByDbLastScheduled($order = Criteria::ASC) Order by the last_scheduled column
* @method CcShowInstancesQuery orderByDbModifiedInstance($order = Criteria::ASC) Order by the modified_instance column * @method CcShowInstancesQuery orderByDbModifiedInstance($order = Criteria::ASC) Order by the modified_instance column
* @method CcShowInstancesQuery orderByDbAutoPlaylistBuilt($order = Criteria::ASC) Order by the autoplaylist_built column
* *
* @method CcShowInstancesQuery groupByDbId() Group by the id column * @method CcShowInstancesQuery groupByDbId() Group by the id column
* @method CcShowInstancesQuery groupByDbDescription() Group by the description column * @method CcShowInstancesQuery groupByDbDescription() Group by the description column
@ -33,6 +34,7 @@
* @method CcShowInstancesQuery groupByDbCreated() Group by the created column * @method CcShowInstancesQuery groupByDbCreated() Group by the created column
* @method CcShowInstancesQuery groupByDbLastScheduled() Group by the last_scheduled column * @method CcShowInstancesQuery groupByDbLastScheduled() Group by the last_scheduled column
* @method CcShowInstancesQuery groupByDbModifiedInstance() Group by the modified_instance column * @method CcShowInstancesQuery groupByDbModifiedInstance() Group by the modified_instance column
* @method CcShowInstancesQuery groupByDbAutoPlaylistBuilt() Group by the autoplaylist_built column
* *
* @method CcShowInstancesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method CcShowInstancesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcShowInstancesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method CcShowInstancesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@ -77,6 +79,7 @@
* @method CcShowInstances findOneByDbCreated(string $created) Return the first CcShowInstances filtered by the created column * @method CcShowInstances findOneByDbCreated(string $created) Return the first CcShowInstances filtered by the created column
* @method CcShowInstances findOneByDbLastScheduled(string $last_scheduled) Return the first CcShowInstances filtered by the last_scheduled column * @method CcShowInstances findOneByDbLastScheduled(string $last_scheduled) Return the first CcShowInstances filtered by the last_scheduled column
* @method CcShowInstances findOneByDbModifiedInstance(boolean $modified_instance) Return the first CcShowInstances filtered by the modified_instance column * @method CcShowInstances findOneByDbModifiedInstance(boolean $modified_instance) Return the first CcShowInstances filtered by the modified_instance column
* @method CcShowInstances findOneByDbAutoPlaylistBuilt(boolean $autoplaylist_built) Return the first CcShowInstances filtered by the autoplaylist_built column
* *
* @method array findByDbId(int $id) Return CcShowInstances objects filtered by the id column * @method array findByDbId(int $id) Return CcShowInstances objects filtered by the id column
* @method array findByDbDescription(string $description) Return CcShowInstances objects filtered by the description column * @method array findByDbDescription(string $description) Return CcShowInstances objects filtered by the description column
@ -91,6 +94,7 @@
* @method array findByDbCreated(string $created) Return CcShowInstances objects filtered by the created column * @method array findByDbCreated(string $created) Return CcShowInstances objects filtered by the created column
* @method array findByDbLastScheduled(string $last_scheduled) Return CcShowInstances objects filtered by the last_scheduled column * @method array findByDbLastScheduled(string $last_scheduled) Return CcShowInstances objects filtered by the last_scheduled column
* @method array findByDbModifiedInstance(boolean $modified_instance) Return CcShowInstances objects filtered by the modified_instance column * @method array findByDbModifiedInstance(boolean $modified_instance) Return CcShowInstances objects filtered by the modified_instance column
* @method array findByDbAutoPlaylistBuilt(boolean $autoplaylist_built) Return CcShowInstances objects filtered by the autoplaylist_built column
* *
* @package propel.generator.airtime.om * @package propel.generator.airtime.om
*/ */
@ -198,7 +202,7 @@ abstract class BaseCcShowInstancesQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT "id", "description", "starts", "ends", "show_id", "record", "rebroadcast", "instance_id", "file_id", "time_filled", "created", "last_scheduled", "modified_instance" FROM "cc_show_instances" WHERE "id" = :p0'; $sql = 'SELECT "id", "description", "starts", "ends", "show_id", "record", "rebroadcast", "instance_id", "file_id", "time_filled", "created", "last_scheduled", "modified_instance", "autoplaylist_built" FROM "cc_show_instances" WHERE "id" = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@ -802,6 +806,33 @@ abstract class BaseCcShowInstancesQuery extends ModelCriteria
return $this->addUsingAlias(CcShowInstancesPeer::MODIFIED_INSTANCE, $dbModifiedInstance, $comparison); return $this->addUsingAlias(CcShowInstancesPeer::MODIFIED_INSTANCE, $dbModifiedInstance, $comparison);
} }
/**
* Filter the query on the autoplaylist_built column
*
* Example usage:
* <code>
* $query->filterByDbAutoPlaylistBuilt(true); // WHERE autoplaylist_built = true
* $query->filterByDbAutoPlaylistBuilt('yes'); // WHERE autoplaylist_built = true
* </code>
*
* @param boolean|string $dbAutoPlaylistBuilt 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 CcShowInstancesQuery The current query, for fluid interface
*/
public function filterByDbAutoPlaylistBuilt($dbAutoPlaylistBuilt = null, $comparison = null)
{
if (is_string($dbAutoPlaylistBuilt)) {
$dbAutoPlaylistBuilt = in_array(strtolower($dbAutoPlaylistBuilt), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(CcShowInstancesPeer::AUTOPLAYLIST_BUILT, $dbAutoPlaylistBuilt, $comparison);
}
/** /**
* Filter the query by a related CcShow object * Filter the query by a related CcShow object
* *

View file

@ -24,13 +24,13 @@ abstract class BaseCcShowPeer
const TM_CLASS = 'CcShowTableMap'; const TM_CLASS = 'CcShowTableMap';
/** The total number of columns. */ /** The total number of columns. */
const NUM_COLUMNS = 14; const NUM_COLUMNS = 16;
/** The number of lazy-loaded columns. */ /** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0; const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 14; const NUM_HYDRATE_COLUMNS = 16;
/** the column name for the id field */ /** the column name for the id field */
const ID = 'cc_show.id'; const ID = 'cc_show.id';
@ -74,6 +74,12 @@ abstract class BaseCcShowPeer
/** the column name for the image_path field */ /** the column name for the image_path field */
const IMAGE_PATH = 'cc_show.image_path'; const IMAGE_PATH = 'cc_show.image_path';
/** the column name for the has_autoplaylist field */
const HAS_AUTOPLAYLIST = 'cc_show.has_autoplaylist';
/** the column name for the autoplaylist_id field */
const AUTOPLAYLIST_ID = 'cc_show.autoplaylist_id';
/** The default string format for model objects of the related table **/ /** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML'; const DEFAULT_STRING_FORMAT = 'YAML';
@ -93,12 +99,12 @@ abstract class BaseCcShowPeer
* e.g. CcShowPeer::$fieldNames[CcShowPeer::TYPE_PHPNAME][0] = 'Id' * e.g. CcShowPeer::$fieldNames[CcShowPeer::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', 'DbLiveStreamUsingAirtimeAuth', 'DbLiveStreamUsingCustomAuth', 'DbLiveStreamUser', 'DbLiveStreamPass', 'DbLinked', 'DbIsLinkable', 'DbImagePath', ), 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', ), 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, ), 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', ), 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', ), 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, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
); );
/** /**
@ -108,12 +114,12 @@ abstract class BaseCcShowPeer
* e.g. CcShowPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 * e.g. CcShowPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( 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, ), 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, ), 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, ), 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, ), 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, ), 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, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
); );
/** /**
@ -201,6 +207,8 @@ abstract class BaseCcShowPeer
$criteria->addSelectColumn(CcShowPeer::LINKED); $criteria->addSelectColumn(CcShowPeer::LINKED);
$criteria->addSelectColumn(CcShowPeer::IS_LINKABLE); $criteria->addSelectColumn(CcShowPeer::IS_LINKABLE);
$criteria->addSelectColumn(CcShowPeer::IMAGE_PATH); $criteria->addSelectColumn(CcShowPeer::IMAGE_PATH);
$criteria->addSelectColumn(CcShowPeer::HAS_AUTOPLAYLIST);
$criteria->addSelectColumn(CcShowPeer::AUTOPLAYLIST_ID);
} else { } else {
$criteria->addSelectColumn($alias . '.id'); $criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.name'); $criteria->addSelectColumn($alias . '.name');
@ -216,6 +224,8 @@ abstract class BaseCcShowPeer
$criteria->addSelectColumn($alias . '.linked'); $criteria->addSelectColumn($alias . '.linked');
$criteria->addSelectColumn($alias . '.is_linkable'); $criteria->addSelectColumn($alias . '.is_linkable');
$criteria->addSelectColumn($alias . '.image_path'); $criteria->addSelectColumn($alias . '.image_path');
$criteria->addSelectColumn($alias . '.has_autoplaylist');
$criteria->addSelectColumn($alias . '.autoplaylist_id');
} }
} }
@ -528,6 +538,244 @@ abstract class BaseCcShowPeer
return array($obj, $col); return array($obj, $col);
} }
/**
* Returns the number of rows matching criteria, joining the related CcPlaylist table
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows.
*/
public static function doCountJoinCcPlaylist(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CcShowPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcShowPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(CcShowPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcShowPeer::AUTOPLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects a collection of CcShow objects pre-filled with their CcPlaylist objects.
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of CcShow objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinCcPlaylist(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(CcShowPeer::DATABASE_NAME);
}
CcShowPeer::addSelectColumns($criteria);
$startcol = CcShowPeer::NUM_HYDRATE_COLUMNS;
CcPlaylistPeer::addSelectColumns($criteria);
$criteria->addJoin(CcShowPeer::AUTOPLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcShowPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcShowPeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcShowPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
CcShowPeer::addInstanceToPool($obj1, $key1);
} // if $obj1 already loaded
$key2 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol);
if ($key2 !== null) {
$obj2 = CcPlaylistPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcPlaylistPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
CcPlaylistPeer::addInstanceToPool($obj2, $key2);
} // if obj2 already loaded
// Add the $obj1 (CcShow) to $obj2 (CcPlaylist)
$obj2->addCcShow($obj1);
} // if joined row was not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
/**
* Returns the number of rows matching criteria, joining all related tables
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows.
*/
public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CcShowPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcShowPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(CcShowPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcShowPeer::AUTOPLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects a collection of CcShow objects pre-filled with all related objects.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of CcShow objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(CcShowPeer::DATABASE_NAME);
}
CcShowPeer::addSelectColumns($criteria);
$startcol2 = CcShowPeer::NUM_HYDRATE_COLUMNS;
CcPlaylistPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + CcPlaylistPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcShowPeer::AUTOPLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcShowPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcShowPeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcShowPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
CcShowPeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded
// Add objects for joined CcPlaylist rows
$key2 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = CcPlaylistPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcPlaylistPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
CcPlaylistPeer::addInstanceToPool($obj2, $key2);
} // if obj2 loaded
// Add the $obj1 (CcShow) to the collection in $obj2 (CcPlaylist)
$obj2->addCcShow($obj1);
} // if joined row not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
/** /**
* Returns the TableMap related to this peer. * Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need. * This method is not needed for general use but a specific application could have a need.

View file

@ -20,6 +20,8 @@
* @method CcShowQuery orderByDbLinked($order = Criteria::ASC) Order by the linked column * @method CcShowQuery orderByDbLinked($order = Criteria::ASC) Order by the linked column
* @method CcShowQuery orderByDbIsLinkable($order = Criteria::ASC) Order by the is_linkable column * @method CcShowQuery orderByDbIsLinkable($order = Criteria::ASC) Order by the is_linkable column
* @method CcShowQuery orderByDbImagePath($order = Criteria::ASC) Order by the image_path column * @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 groupByDbId() Group by the id column * @method CcShowQuery groupByDbId() Group by the id column
* @method CcShowQuery groupByDbName() Group by the name column * @method CcShowQuery groupByDbName() Group by the name column
@ -35,11 +37,17 @@
* @method CcShowQuery groupByDbLinked() Group by the linked column * @method CcShowQuery groupByDbLinked() Group by the linked column
* @method CcShowQuery groupByDbIsLinkable() Group by the is_linkable column * @method CcShowQuery groupByDbIsLinkable() Group by the is_linkable column
* @method CcShowQuery groupByDbImagePath() Group by the image_path column * @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 leftJoin($relation) Adds a LEFT JOIN clause to the query * @method CcShowQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcShowQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method CcShowQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcShowQuery innerJoin($relation) Adds a INNER JOIN clause to the query * @method CcShowQuery innerJoin($relation) Adds a INNER JOIN clause to the query
* *
* @method CcShowQuery leftJoinCcPlaylist($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlaylist relation
* @method CcShowQuery rightJoinCcPlaylist($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlaylist relation
* @method CcShowQuery innerJoinCcPlaylist($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlaylist relation
*
* @method CcShowQuery leftJoinCcShowInstances($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShowInstances relation * @method CcShowQuery leftJoinCcShowInstances($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShowInstances relation
* @method CcShowQuery rightJoinCcShowInstances($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShowInstances relation * @method CcShowQuery rightJoinCcShowInstances($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
* @method CcShowQuery innerJoinCcShowInstances($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShowInstances relation * @method CcShowQuery innerJoinCcShowInstances($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShowInstances relation
@ -72,6 +80,8 @@
* @method CcShow findOneByDbLinked(boolean $linked) Return the first CcShow filtered by the linked column * @method CcShow findOneByDbLinked(boolean $linked) Return the first CcShow filtered by the linked column
* @method CcShow findOneByDbIsLinkable(boolean $is_linkable) Return the first CcShow filtered by the is_linkable column * @method CcShow findOneByDbIsLinkable(boolean $is_linkable) Return the first CcShow filtered by the is_linkable column
* @method CcShow findOneByDbImagePath(string $image_path) Return the first CcShow filtered by the image_path column * @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 array findByDbId(int $id) Return CcShow objects filtered by the id 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 * @method array findByDbName(string $name) Return CcShow objects filtered by the name column
@ -87,6 +97,8 @@
* @method array findByDbLinked(boolean $linked) Return CcShow objects filtered by the linked column * @method array findByDbLinked(boolean $linked) Return CcShow objects filtered by the linked column
* @method array findByDbIsLinkable(boolean $is_linkable) Return CcShow objects filtered by the is_linkable column * @method array findByDbIsLinkable(boolean $is_linkable) Return CcShow objects filtered by the is_linkable column
* @method array findByDbImagePath(string $image_path) Return CcShow objects filtered by the image_path column * @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
* *
* @package propel.generator.airtime.om * @package propel.generator.airtime.om
*/ */
@ -194,7 +206,7 @@ abstract class BaseCcShowQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) 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" 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" FROM "cc_show" WHERE "id" = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@ -694,6 +706,153 @@ abstract class BaseCcShowQuery extends ModelCriteria
return $this->addUsingAlias(CcShowPeer::IMAGE_PATH, $dbImagePath, $comparison); return $this->addUsingAlias(CcShowPeer::IMAGE_PATH, $dbImagePath, $comparison);
} }
/**
* Filter the query on the has_autoplaylist column
*
* Example usage:
* <code>
* $query->filterByDbHasAutoPlaylist(true); // WHERE has_autoplaylist = true
* $query->filterByDbHasAutoPlaylist('yes'); // WHERE has_autoplaylist = true
* </code>
*
* @param boolean|string $dbHasAutoPlaylist 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 filterByDbHasAutoPlaylist($dbHasAutoPlaylist = null, $comparison = null)
{
if (is_string($dbHasAutoPlaylist)) {
$dbHasAutoPlaylist = in_array(strtolower($dbHasAutoPlaylist), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(CcShowPeer::HAS_AUTOPLAYLIST, $dbHasAutoPlaylist, $comparison);
}
/**
* Filter the query on the autoplaylist_id column
*
* Example usage:
* <code>
* $query->filterByDbAutoPlaylistId(1234); // WHERE autoplaylist_id = 1234
* $query->filterByDbAutoPlaylistId(array(12, 34)); // WHERE autoplaylist_id IN (12, 34)
* $query->filterByDbAutoPlaylistId(array('min' => 12)); // WHERE autoplaylist_id >= 12
* $query->filterByDbAutoPlaylistId(array('max' => 12)); // WHERE autoplaylist_id <= 12
* </code>
*
* @see filterByCcPlaylist()
*
* @param mixed $dbAutoPlaylistId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowQuery The current query, for fluid interface
*/
public function filterByDbAutoPlaylistId($dbAutoPlaylistId = null, $comparison = null)
{
if (is_array($dbAutoPlaylistId)) {
$useMinMax = false;
if (isset($dbAutoPlaylistId['min'])) {
$this->addUsingAlias(CcShowPeer::AUTOPLAYLIST_ID, $dbAutoPlaylistId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbAutoPlaylistId['max'])) {
$this->addUsingAlias(CcShowPeer::AUTOPLAYLIST_ID, $dbAutoPlaylistId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowPeer::AUTOPLAYLIST_ID, $dbAutoPlaylistId, $comparison);
}
/**
* Filter the query by a related CcPlaylist object
*
* @param CcPlaylist|PropelObjectCollection $ccPlaylist The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcPlaylist($ccPlaylist, $comparison = null)
{
if ($ccPlaylist instanceof CcPlaylist) {
return $this
->addUsingAlias(CcShowPeer::AUTOPLAYLIST_ID, $ccPlaylist->getDbId(), $comparison);
} elseif ($ccPlaylist instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcShowPeer::AUTOPLAYLIST_ID, $ccPlaylist->toKeyValue('PrimaryKey', 'DbId'), $comparison);
} else {
throw new PropelException('filterByCcPlaylist() only accepts arguments of type CcPlaylist or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the CcPlaylist relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowQuery The current query, for fluid interface
*/
public function joinCcPlaylist($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcPlaylist');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcPlaylist');
}
return $this;
}
/**
* Use the CcPlaylist relation CcPlaylist object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcPlaylistQuery A secondary query class using the current class as primary query
*/
public function useCcPlaylistQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcPlaylist($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcPlaylist', 'CcPlaylistQuery');
}
/** /**
* Filter the query by a related CcShowInstances object * Filter the query by a related CcShowInstances object
* *

View file

@ -20,6 +20,7 @@ class Application_Service_ShowFormService
public function createShowForms() public function createShowForms()
{ {
$formWhat = new Application_Form_AddShowWhat(); $formWhat = new Application_Form_AddShowWhat();
$formAutoPlaylist = new Application_Form_AddShowAutoPlaylist();
$formWho = new Application_Form_AddShowWho(); $formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen(); $formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats(); $formRepeats = new Application_Form_AddShowRepeats();
@ -30,6 +31,7 @@ class Application_Service_ShowFormService
$formRebroadcast = new Application_Form_AddShowRebroadcastDates(); $formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formWhat->removeDecorator('DtDdWrapper'); $formWhat->removeDecorator('DtDdWrapper');
$formAutoPlaylist->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper'); $formWho->removeDecorator('DtDdWrapper');
$formWhen->removeDecorator('DtDdWrapper'); $formWhen->removeDecorator('DtDdWrapper');
$formRepeats->removeDecorator('DtDdWrapper'); $formRepeats->removeDecorator('DtDdWrapper');
@ -41,6 +43,7 @@ class Application_Service_ShowFormService
$forms = array(); $forms = array();
$forms["what"] = $formWhat; $forms["what"] = $formWhat;
$forms["autoplaylist"] = $formAutoPlaylist;
$forms["who"] = $formWho; $forms["who"] = $formWho;
$forms["when"] = $formWhen; $forms["when"] = $formWhen;
$forms["repeats"] = $formRepeats; $forms["repeats"] = $formRepeats;
@ -55,7 +58,7 @@ class Application_Service_ShowFormService
/** /**
* *
* Popluates the what, when, and repeat forms * Popluates the what, autoplaylist, when, and repeat forms
* with default values * with default values
*/ */
public function populateNewShowForms($formWhat, $formWhen, $formRepeats) public function populateNewShowForms($formWhat, $formWhen, $formRepeats)
@ -93,6 +96,7 @@ class Application_Service_ShowFormService
*/ */
$forms["what"]->makeReadonly(); $forms["what"]->makeReadonly();
$forms["what"]->enableInstanceDesc(); $forms["what"]->enableInstanceDesc();
$forms["autoplaylist"]->disable();
$forms["repeats"]->disable(); $forms["repeats"]->disable();
$forms["who"]->disable(); $forms["who"]->disable();
$forms["style"]->disable(); $forms["style"]->disable();
@ -115,6 +119,7 @@ class Application_Service_ShowFormService
{ {
$this->populateFormWhat($forms["what"]); $this->populateFormWhat($forms["what"]);
//local show start DT //local show start DT
$this->populateFormAutoPlaylist($forms["autoplaylist"]);
$showStart = $this->populateFormWhen($forms["when"]); $showStart = $this->populateFormWhen($forms["when"]);
$this->populateFormRepeats($forms["repeats"], $showStart); $this->populateFormRepeats($forms["repeats"], $showStart);
$this->populateFormWho($forms["who"]); $this->populateFormWho($forms["who"]);
@ -137,9 +142,23 @@ class Application_Service_ShowFormService
'add_show_url' => $this->ccShow->getDbUrl(), 'add_show_url' => $this->ccShow->getDbUrl(),
'add_show_genre' => $this->ccShow->getDbGenre(), 'add_show_genre' => $this->ccShow->getDbGenre(),
'add_show_description' => $this->ccShow->getDbDescription(), 'add_show_description' => $this->ccShow->getDbDescription(),
'add_show_instance_description' => $ccShowInstance->getDbDescription())); 'add_show_instance_description' => $ccShowInstance->getDbDescription(),
));
} }
private function populateFormAutoPlaylist($form)
{
$ccShowInstance = CcShowInstancesQuery::create()->findPk($this->instanceId);
$form->populate(
array(
'add_show_has_autoplaylist' => $this->ccShow->getDbHasAutoPlaylist() ? 1 : 0,
'add_show_autoplaylist_id' => $this->ccShow->getDbAutoPlaylistId()
));
}
private function populateFormWhen($form) private function populateFormWhen($form)
{ {
if ($this->ccShow->isRepeating()) { if ($this->ccShow->isRepeating()) {
@ -503,6 +522,7 @@ class Application_Service_ShowFormService
$originalStartDate=null, $editShow=false, $instanceId=null) $originalStartDate=null, $editShow=false, $instanceId=null)
{ {
$what = $forms["what"]->isValid($formData); $what = $forms["what"]->isValid($formData);
$autoplaylist = $forms["autoplaylist"]->isValid($formData);
$live = $forms["live"]->isValid($formData); $live = $forms["live"]->isValid($formData);
$record = $forms["record"]->isValid($formData); $record = $forms["record"]->isValid($formData);
$who = $forms["who"]->isValid($formData); $who = $forms["who"]->isValid($formData);
@ -556,7 +576,7 @@ class Application_Service_ShowFormService
} }
} }
return ($what && $live && $record && $who && $style && $when && return ($what && $autoplaylist && $live && $record && $who && $style && $when &&
$repeats && $absRebroadcast && $rebroadcast); $repeats && $absRebroadcast && $rebroadcast);
} }

View file

@ -1540,6 +1540,11 @@ SQL;
$ccShow->setDbLiveStreamUsingCustomAuth($showData['cb_custom_auth'] == 1); $ccShow->setDbLiveStreamUsingCustomAuth($showData['cb_custom_auth'] == 1);
$ccShow->setDbLiveStreamUser($showData['custom_username']); $ccShow->setDbLiveStreamUser($showData['custom_username']);
$ccShow->setDbLiveStreamPass($showData['custom_password']); $ccShow->setDbLiveStreamPass($showData['custom_password']);
$ccShow->setDbHasAutoPlaylist($showData['add_show_has_autoplaylist'] == 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']);
}
//Here a user has edited a show and linked it. //Here a user has edited a show and linked it.
//We need to grab the existing show instances ids and fill their content //We need to grab the existing show instances ids and fill their content

View file

@ -38,12 +38,6 @@ class UpgradeManager
$schemaVersion = Application_Model_Preference::GetSchemaVersion(); $schemaVersion = Application_Model_Preference::GetSchemaVersion();
$supportedSchemaVersions = self::getSupportedSchemaVersions(); $supportedSchemaVersions = self::getSupportedSchemaVersions();
return !in_array($schemaVersion, $supportedSchemaVersions); return !in_array($schemaVersion, $supportedSchemaVersions);
// We shouldn't run the upgrade as a side-effect of this function!
/*
if ($upgradeNeeded) {
self::doUpgrade();
}
*/
} }
/** /**
@ -187,8 +181,6 @@ abstract class AirtimeUpgrader
* allowing child classes to overwrite _runUpgrade to reduce duplication * allowing child classes to overwrite _runUpgrade to reduce duplication
*/ */
public function upgrade() { public function upgrade() {
assert($this->checkIfUpgradeSupported());
try { try {
// $this->toggleMaintenanceScreen(true); // $this->toggleMaintenanceScreen(true);
@ -200,6 +192,7 @@ abstract class AirtimeUpgrader
// $this->toggleMaintenanceScreen(false); // $this->toggleMaintenanceScreen(false);
} catch(Exception $e) { } catch(Exception $e) {
// $this->toggleMaintenanceScreen(false); // $this->toggleMaintenanceScreen(false);
Logging::error('Error in upgrade: '. $e->getMessage());
return false; return false;
} }
@ -236,13 +229,12 @@ abstract class AirtimeUpgrader
} }
protected function _getDbValues() { protected function _getDbValues() {
$airtimeConf = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf"; $config = Config::getConfig();
$values = parse_ini_file($airtimeConf, true);
$this->username = $values['database']['dbuser']; $this->username = $config['dsn']['username'];
$this->password = $values['database']['dbpass']; $this->password = $config['dsn']['password'];
$this->host = $values['database']['host']; $this->host = $config['dsn']['hostspec'];
$this->database = $values['database']['dbname']; $this->database = $config['dsn']['database'];
} }
protected function _runUpgrade() { protected function _runUpgrade() {
@ -501,3 +493,16 @@ class AirtimeUpgrader2516 extends AirtimeUpgrader
return '2.5.16'; return '2.5.16';
} }
} }
class AirtimeUpgrader300alpha extends AirtimeUpgrader
{
protected function getSupportedSchemaVersions() {
return array(
'2.5.16'
);
}
public function getNewVersion() {
return '3.0.0-alpha';
}
}

View file

@ -0,0 +1,22 @@
<fieldset>
<dl>
<dt id="add_show_has_autoplaylist_label">
<label for="add_show_has_autoplaylist_label">
<?php echo $this->element->getElement('add_show_has_autoplaylist')->getLabel()?>
</label>
</dt>
<dd>
<?php echo $this->element->getElement('add_show_has_autoplaylist') ?>
</dd>
<div id="add_show_playlist_dropdown">
<dt id="add_show_autoplaylist_id">
<label for="add_show_autoplaylist_id" class="required">
<?php echo $this->element->getElement('add_show_autoplaylist_id')->getLabel()?>
</label>
</dt>
<dd>
<?php echo $this->element->getElement('add_show_autoplaylist_id') ?>
</div>
</dl>
</fieldset>

View file

@ -11,6 +11,10 @@
<div id="schedule-show-what" class="collapsible-content"> <div id="schedule-show-what" class="collapsible-content">
<?php echo $this->what; ?> <?php echo $this->what; ?>
</div> </div>
<h3 class="collapsible-header"><span class="arrow-icon"></span><?php echo _("Automatic Playlist") ?></h3>
<div id="schedule-show-what" class="collapsible-content">
<?php echo $this->autoplaylist; ?>
</div>
<h3 class="collapsible-header"><span class="arrow-icon"></span><?php echo _("When") ?></h3> <h3 class="collapsible-header"><span class="arrow-icon"></span><?php echo _("When") ?></h3>
<div id="schedule-show-when" class="collapsible-content"> <div id="schedule-show-when" class="collapsible-content">
<?php <?php

View file

@ -1,6 +1,6 @@
#Note: project.home is automatically generated by the propel-install script. #Note: project.home is automatically generated by the propel-install script.
#Any manual changes to this value will be overwritten. #Any manual changes to this value will be overwritten.
project.home = /home/sourcefabric/dev/Airtime/airtime_mvc project.home = /vagrant/airtime_mvc
project.build = ${project.home}/build project.build = ${project.home}/build
#Database driver #Database driver

View file

@ -154,6 +154,11 @@
<column name="image_path" phpName="DbImagePath" type="VARCHAR" size="255" required="false" defaultValue=""/> <column name="image_path" phpName="DbImagePath" type="VARCHAR" size="255" required="false" defaultValue=""/>
<!-- Fully qualified path for the image associated with this show. <!-- Fully qualified path for the image associated with this show.
Default is /path/to/stor/dir/:ownerId/show-images/:showId/imageName --> 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"/>
<foreign-key foreignTable="cc_playlist" name="cc_playlist_autoplaylist_fkey" onDelete="SETNULL">
<reference local="autoplaylist_id" foreign="id"/>
</foreign-key>
</table> </table>
<table name="cc_show_instances" phpName="CcShowInstances"> <table name="cc_show_instances" phpName="CcShowInstances">
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/> <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
@ -173,6 +178,7 @@
instances can be regenerated if we edit the show, which is unwanted behaviour. This column serves instances can be regenerated if we edit the show, which is unwanted behaviour. This column serves
to ensure that we don't regenerate the instance. --> to ensure that we don't regenerate the instance. -->
<column name="modified_instance" phpName="DbModifiedInstance" type="BOOLEAN" required="true" defaultValue="false" /> <column name="modified_instance" phpName="DbModifiedInstance" type="BOOLEAN" required="true" defaultValue="false" />
<column name="autoplaylist_built" phpName="DbAutoPlaylistBuilt" type="BOOLEAN" required="true" defaultValue="false"/>
<foreign-key foreignTable="cc_show" name="cc_show_fkey" onDelete="CASCADE"> <foreign-key foreignTable="cc_show" name="cc_show_fkey" onDelete="CASCADE">
<reference local="show_id" foreign="id"/> <reference local="show_id" foreign="id"/>
</foreign-key> </foreign-key>

View file

@ -1,5 +1,5 @@
-- Schema version -- Schema version
INSERT INTO cc_pref("keystr", "valstr") VALUES('schema_version', '2.5.12'); INSERT INTO cc_pref("keystr", "valstr") VALUES('schema_version', '3.0.0-alpha');
INSERT INTO cc_subjs ("login", "type", "pass") VALUES ('admin', 'A', md5('admin')); INSERT INTO cc_subjs ("login", "type", "pass") VALUES ('admin', 'A', md5('admin'));
-- added in 2.3 -- added in 2.3

View file

@ -160,6 +160,8 @@ CREATE TABLE "cc_show"
"linked" BOOLEAN DEFAULT 'f' NOT NULL, "linked" BOOLEAN DEFAULT 'f' NOT NULL,
"is_linkable" BOOLEAN DEFAULT 't' NOT NULL, "is_linkable" BOOLEAN DEFAULT 't' NOT NULL,
"image_path" VARCHAR(255) DEFAULT '', "image_path" VARCHAR(255) DEFAULT '',
"has_autoplaylist" BOOLEAN DEFAULT 'f' NOT NULL,
"autoplaylist_id" INTEGER,
PRIMARY KEY ("id") PRIMARY KEY ("id")
); );
@ -184,6 +186,7 @@ CREATE TABLE "cc_show_instances"
"created" TIMESTAMP NOT NULL, "created" TIMESTAMP NOT NULL,
"last_scheduled" TIMESTAMP, "last_scheduled" TIMESTAMP,
"modified_instance" BOOLEAN DEFAULT 'f' NOT NULL, "modified_instance" BOOLEAN DEFAULT 'f' NOT NULL,
"autoplaylist_built" BOOLEAN DEFAULT 'f' NOT NULL,
PRIMARY KEY ("id") PRIMARY KEY ("id")
); );
@ -800,6 +803,11 @@ ALTER TABLE "cc_perms" ADD CONSTRAINT "cc_perms_subj_fkey"
REFERENCES "cc_subjs" ("id") REFERENCES "cc_subjs" ("id")
ON DELETE CASCADE; ON DELETE CASCADE;
ALTER TABLE "cc_show" ADD CONSTRAINT "cc_playlist_autoplaylist_fkey"
FOREIGN KEY ("autoplaylist_id")
REFERENCES "cc_playlist" ("id")
ON DELETE SET NULL;
ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_show_fkey" ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_show_fkey"
FOREIGN KEY ("show_id") FOREIGN KEY ("show_id")
REFERENCES "cc_show" ("id") REFERENCES "cc_show" ("id")

View file

@ -1,11 +0,0 @@
<?php
$ini = parse_ini_file('/etc/airtime/airtime.conf', true);
return array(
'dbname' => $ini['database']['dbname'],
'user' => $ini['database']['dbuser'],
'password' => $ini['database']['dbpass'],
'host' => 'localhost',
'driver' => 'pdo_pgsql',
);

View file

@ -267,6 +267,12 @@ function setAddShowEvents(form) {
} }
}); });
if(!form.find("#add_show_has_autoplaylist").attr('checked')) {
form.find("#add_show_playlist_dropdown").hide();
}
else {
$("#add_show_playlist_dropdown").show();
}
if(!form.find("#add_show_repeats").attr('checked')) { if(!form.find("#add_show_repeats").attr('checked')) {
form.find("#schedule-show-when > fieldset:last").hide(); form.find("#schedule-show-when > fieldset:last").hide();
@ -291,6 +297,21 @@ function setAddShowEvents(form) {
var submitButton = $(".button-bar.bottom").find(".add-show-submit"); var submitButton = $(".button-bar.bottom").find(".add-show-submit");
$("[id^=add_show_instance_description]").toggle(submitButton.attr("data-action") === "edit-repeating-show-instance"); $("[id^=add_show_instance_description]").toggle(submitButton.attr("data-action") === "edit-repeating-show-instance");
form.find("#add_show_has_autoplaylist").click(function(){
$(this).blur();
form.find("#add_show_playlist_dropdown").toggle();
var checkBoxSelected = false;
//must switch rebroadcast displays
if(form.find("#add_show_has_autoplaylist").attr('checked')) {
form.find("#add_show_playlist_dropdown").show();
}
else {
form.find("#add_show_playlist_downdown").hide();
}
});
form.find("#add_show_repeats").click(function(){ form.find("#add_show_repeats").click(function(){
$(this).blur(); $(this).blur();
form.find("#schedule-show-when > fieldset:last").toggle(); form.find("#schedule-show-when > fieldset:last").toggle();

View file

@ -235,23 +235,8 @@ class AirtimeInstall
} }
AirtimeInstall::$databaseTablesCreated = true; AirtimeInstall::$databaseTablesCreated = true;
} }
public static function BypassMigrations($dir, $version) public final static function UpdateDatabaseTables() {
{ UpgradeManager::doUpgrade();
$appDir = AirtimeInstall::GetAirtimeSrcDir();
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
"--no-interaction --add migrations:version $version";
system($command);
}
public static function MigrateTablesToVersion($dir, $version)
{
$appDir = AirtimeInstall::GetAirtimeSrcDir();
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
"--no-interaction migrations:migrate $version";
system($command);
} }
public static function SetAirtimeVersion($p_version) public static function SetAirtimeVersion($p_version)
{ {

View file

@ -122,7 +122,8 @@ class TestHelper
else else
{ {
//Create all the database tables //Create all the database tables
AirtimeInstall::createDatabaseTables($dbuser, $dbpasswd, $dbname, $dbhost); AirtimeInstall::CreateDatabaseTables($dbuser, $dbpasswd, $dbname, $dbhost);
AirtimeInstall::UpdateDatabaseTables();
} }
} }

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -66,7 +66,9 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
"cb_custom_auth" => false, "cb_custom_auth" => false,
"custom_username" => null, "custom_username" => null,
"custom_password" => null, "custom_password" => null,
"add_show_linked" => false "add_show_linked" => false,
"add_show_has_autoplaylist" => 0,
"add_show_autoplaylist_id" => null
); );
$showService->setCcShow($data); $showService->setCcShow($data);

View file

@ -14,3 +14,5 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null

View file

@ -14,6 +14,8 @@ cc_show:
linked: true linked: true
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '2' id: '2'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: true linked: true
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: true linked: true
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '2' id: '2'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: false is_linkable: false
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '1' id: '1'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '2' id: '2'

View file

@ -14,6 +14,8 @@ cc_show:
linked: false linked: false
is_linkable: true is_linkable: true
image_path: '' image_path: ''
has_autoplaylist: false
autoplaylist_id: null
cc_show_days: cc_show_days:
- -
id: '2' id: '2'

View file

@ -17,6 +17,8 @@ Class ShowServiceData
"add_show_end_time" => "01:00", "add_show_end_time" => "01:00",
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 0, "add_show_repeats" => 0,
"add_show_linked" => 0, "add_show_linked" => 0,
"add_show_repeat_type" => 0, "add_show_repeat_type" => 0,
@ -92,6 +94,8 @@ Class ShowServiceData
"add_show_end_time" => "01:00", "add_show_end_time" => "01:00",
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 1, "add_show_repeats" => 1,
"add_show_linked" => 0, "add_show_linked" => 0,
"add_show_repeat_type" => 0, "add_show_repeat_type" => 0,
@ -167,6 +171,8 @@ Class ShowServiceData
"add_show_end_time" => "01:00", "add_show_end_time" => "01:00",
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 1, "add_show_repeats" => 1,
"add_show_linked" => 0, "add_show_linked" => 0,
"add_show_repeat_type" => 0, "add_show_repeat_type" => 0,
@ -253,6 +259,8 @@ Class ShowServiceData
"add_show_end_time" => "02:00", "add_show_end_time" => "02:00",
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 0, "add_show_repeats" => 0,
"add_show_linked" => 0, "add_show_linked" => 0,
"add_show_no_end" => 0, "add_show_no_end" => 0,
@ -279,6 +287,8 @@ Class ShowServiceData
"add_show_end_time" => "01:00", "add_show_end_time" => "01:00",
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 1, "add_show_repeats" => 1,
"add_show_linked" => 0, "add_show_linked" => 0,
"add_show_repeat_type" => 0, "add_show_repeat_type" => 0,
@ -355,6 +365,8 @@ Class ShowServiceData
"add_show_end_time" => "01:00", "add_show_end_time" => "01:00",
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 0, "add_show_repeats" => 0,
"add_show_linked" => 0, "add_show_linked" => 0,
"add_show_repeat_type" => 0, "add_show_repeat_type" => 0,
@ -430,6 +442,8 @@ Class ShowServiceData
"add_show_end_time" => "01:00", "add_show_end_time" => "01:00",
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 1, "add_show_repeats" => 1,
"add_show_linked" => 0, "add_show_linked" => 0,
"add_show_repeat_type" => 0, "add_show_repeat_type" => 0,

View file

@ -28,27 +28,30 @@ if __name__ == '__main__':
api_key = config.get(GENERAL_CONFIG_SECTION, 'api_key') api_key = config.get(GENERAL_CONFIG_SECTION, 'api_key')
base_url = config.get(GENERAL_CONFIG_SECTION, 'base_url') base_url = config.get(GENERAL_CONFIG_SECTION, 'base_url')
base_dir = config.get(GENERAL_CONFIG_SECTION, 'base_dir') base_dir = config.get(GENERAL_CONFIG_SECTION, 'base_dir')
base_port = config.get(GENERAL_CONFIG_SECTION, 'base_port', 80)
action = "upgrade" action = "upgrade"
airtime_url = "" station_url = ""
default_url = "http://%s:%s%s" % (base_url, base_port, base_dir)
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--downgrade', help='Downgrade the station', action="store_true") parser.add_argument('--downgrade', help='Downgrade the station', action="store_true")
parser.add_argument('station_url', help='station URL', nargs='?', default='') parser.add_argument('station_url', help='station URL', nargs='?', default=default_url)
args = parser.parse_args() args = parser.parse_args()
if args.downgrade: if args.downgrade:
action = "downgrade" action = "downgrade"
if airtime_url == "": if args.station_url:
airtime_url = "http://%s%s" % (base_url, base_dir) station_url = args.station_url
# Add http:// if you were lazy and didn't pass a scheme to this script # Add http:// if you were lazy and didn't pass a scheme to this script
url = urlparse(airtime_url) url = urlparse(station_url)
if not url.scheme: if not url.scheme:
airtime_url = "http://%s" % airtime_url station_url = "http://%s" % station_url
print "Requesting %s..." % action print "Requesting %s..." % action
r = requests.get("%s/%s" % (airtime_url, action), auth=(api_key, '')) r = requests.get("%s/%s" % (station_url, action), auth=(api_key, ''))
print r.text print r.text
r.raise_for_status() r.raise_for_status()