Merge pull request #95 from radiorabe/feature/per-podcast-album-override

per podcast album override
This commit is contained in:
Robb 2017-03-18 14:49:49 -04:00 committed by GitHub
commit 6ad3fd87cc
14 changed files with 229 additions and 40 deletions

View File

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

View File

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

View File

@ -42,6 +42,7 @@ class ImportedPodcastTableMap extends TableMap
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null); $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('auto_ingest', 'DbAutoIngest', 'BOOLEAN', true, null, false); $this->addColumn('auto_ingest', 'DbAutoIngest', 'BOOLEAN', true, null, false);
$this->addColumn('auto_ingest_timestamp', 'DbAutoIngestTimestamp', 'TIMESTAMP', false, null, null); $this->addColumn('auto_ingest_timestamp', 'DbAutoIngestTimestamp', 'TIMESTAMP', false, null, null);
$this->addColumn('album_override', 'DbAlbumOverride', 'BOOLEAN', true, null, false);
$this->addForeignKey('podcast_id', 'DbPodcastId', 'INTEGER', 'podcast', 'id', true, null, null); $this->addForeignKey('podcast_id', 'DbPodcastId', 'INTEGER', 'podcast', 'id', true, null, null);
// validators // validators
} // initialize() } // initialize()

View File

@ -42,7 +42,7 @@ class ThirdPartyTrackReferencesTableMap extends TableMap
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null); $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('service', 'DbService', 'VARCHAR', true, 256, null); $this->addColumn('service', 'DbService', 'VARCHAR', true, 256, null);
$this->addColumn('foreign_id', 'DbForeignId', 'VARCHAR', false, 256, null); $this->addColumn('foreign_id', 'DbForeignId', 'VARCHAR', false, 256, null);
$this->addForeignKey('file_id', 'DbFileId', 'INTEGER', 'cc_files', 'id', true, null, null); $this->addForeignKey('file_id', 'DbFileId', 'INTEGER', 'cc_files', 'id', true, null, 0);
$this->addColumn('upload_time', 'DbUploadTime', 'TIMESTAMP', false, null, null); $this->addColumn('upload_time', 'DbUploadTime', 'TIMESTAMP', false, null, null);
$this->addColumn('status', 'DbStatus', 'VARCHAR', false, 256, null); $this->addColumn('status', 'DbStatus', 'VARCHAR', false, 256, null);
// validators // validators

View File

@ -48,6 +48,13 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
*/ */
protected $auto_ingest_timestamp; protected $auto_ingest_timestamp;
/**
* The value for the album_override field.
* Note: this column has a database default value of: false
* @var boolean
*/
protected $album_override;
/** /**
* The value for the podcast_id field. * The value for the podcast_id field.
* @var int * @var int
@ -88,6 +95,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
public function applyDefaultValues() public function applyDefaultValues()
{ {
$this->auto_ingest = false; $this->auto_ingest = false;
$this->album_override = false;
} }
/** /**
@ -157,6 +165,17 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
} }
/**
* Get the [album_override] column value.
*
* @return boolean
*/
public function getDbAlbumOverride()
{
return $this->album_override;
}
/** /**
* Get the [podcast_id] column value. * Get the [podcast_id] column value.
* *
@ -241,6 +260,35 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
return $this; return $this;
} // setDbAutoIngestTimestamp() } // setDbAutoIngestTimestamp()
/**
* Sets the value of the [album_override] 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 ImportedPodcast The current object (for fluent API support)
*/
public function setDbAlbumOverride($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->album_override !== $v) {
$this->album_override = $v;
$this->modifiedColumns[] = ImportedPodcastPeer::ALBUM_OVERRIDE;
}
return $this;
} // setDbAlbumOverride()
/** /**
* Set the value of [podcast_id] column. * Set the value of [podcast_id] column.
* *
@ -280,6 +328,10 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
return false; return false;
} }
if ($this->album_override !== false) {
return false;
}
// otherwise, everything was equal, so return true // otherwise, everything was equal, so return true
return true; return true;
} // hasOnlyDefaultValues() } // hasOnlyDefaultValues()
@ -305,7 +357,8 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->auto_ingest = ($row[$startcol + 1] !== null) ? (boolean) $row[$startcol + 1] : null; $this->auto_ingest = ($row[$startcol + 1] !== null) ? (boolean) $row[$startcol + 1] : null;
$this->auto_ingest_timestamp = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; $this->auto_ingest_timestamp = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->podcast_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; $this->album_override = ($row[$startcol + 3] !== null) ? (boolean) $row[$startcol + 3] : null;
$this->podcast_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
@ -315,7 +368,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
} }
$this->postHydrate($row, $startcol, $rehydrate); $this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 4; // 4 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS. return $startcol + 5; // 5 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating ImportedPodcast object", $e); throw new PropelException("Error populating ImportedPodcast object", $e);
@ -562,6 +615,9 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP)) { if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP)) {
$modifiedColumns[':p' . $index++] = '"auto_ingest_timestamp"'; $modifiedColumns[':p' . $index++] = '"auto_ingest_timestamp"';
} }
if ($this->isColumnModified(ImportedPodcastPeer::ALBUM_OVERRIDE)) {
$modifiedColumns[':p' . $index++] = '"album_override"';
}
if ($this->isColumnModified(ImportedPodcastPeer::PODCAST_ID)) { if ($this->isColumnModified(ImportedPodcastPeer::PODCAST_ID)) {
$modifiedColumns[':p' . $index++] = '"podcast_id"'; $modifiedColumns[':p' . $index++] = '"podcast_id"';
} }
@ -585,6 +641,9 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
case '"auto_ingest_timestamp"': case '"auto_ingest_timestamp"':
$stmt->bindValue($identifier, $this->auto_ingest_timestamp, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->auto_ingest_timestamp, PDO::PARAM_STR);
break; break;
case '"album_override"':
$stmt->bindValue($identifier, $this->album_override, PDO::PARAM_BOOL);
break;
case '"podcast_id"': case '"podcast_id"':
$stmt->bindValue($identifier, $this->podcast_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->podcast_id, PDO::PARAM_INT);
break; break;
@ -737,6 +796,9 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
return $this->getDbAutoIngestTimestamp(); return $this->getDbAutoIngestTimestamp();
break; break;
case 3: case 3:
return $this->getDbAlbumOverride();
break;
case 4:
return $this->getDbPodcastId(); return $this->getDbPodcastId();
break; break;
default: default:
@ -771,7 +833,8 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
$keys[0] => $this->getDbId(), $keys[0] => $this->getDbId(),
$keys[1] => $this->getDbAutoIngest(), $keys[1] => $this->getDbAutoIngest(),
$keys[2] => $this->getDbAutoIngestTimestamp(), $keys[2] => $this->getDbAutoIngestTimestamp(),
$keys[3] => $this->getDbPodcastId(), $keys[3] => $this->getDbAlbumOverride(),
$keys[4] => $this->getDbPodcastId(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@ -826,6 +889,9 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
$this->setDbAutoIngestTimestamp($value); $this->setDbAutoIngestTimestamp($value);
break; break;
case 3: case 3:
$this->setDbAlbumOverride($value);
break;
case 4:
$this->setDbPodcastId($value); $this->setDbPodcastId($value);
break; break;
} // switch() } // switch()
@ -855,7 +921,8 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setDbAutoIngest($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setDbAutoIngest($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbAutoIngestTimestamp($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setDbAutoIngestTimestamp($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbPodcastId($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setDbAlbumOverride($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbPodcastId($arr[$keys[4]]);
} }
/** /**
@ -870,6 +937,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
if ($this->isColumnModified(ImportedPodcastPeer::ID)) $criteria->add(ImportedPodcastPeer::ID, $this->id); if ($this->isColumnModified(ImportedPodcastPeer::ID)) $criteria->add(ImportedPodcastPeer::ID, $this->id);
if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST)) $criteria->add(ImportedPodcastPeer::AUTO_INGEST, $this->auto_ingest); if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST)) $criteria->add(ImportedPodcastPeer::AUTO_INGEST, $this->auto_ingest);
if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP)) $criteria->add(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, $this->auto_ingest_timestamp); if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP)) $criteria->add(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, $this->auto_ingest_timestamp);
if ($this->isColumnModified(ImportedPodcastPeer::ALBUM_OVERRIDE)) $criteria->add(ImportedPodcastPeer::ALBUM_OVERRIDE, $this->album_override);
if ($this->isColumnModified(ImportedPodcastPeer::PODCAST_ID)) $criteria->add(ImportedPodcastPeer::PODCAST_ID, $this->podcast_id); if ($this->isColumnModified(ImportedPodcastPeer::PODCAST_ID)) $criteria->add(ImportedPodcastPeer::PODCAST_ID, $this->podcast_id);
return $criteria; return $criteria;
@ -936,6 +1004,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
{ {
$copyObj->setDbAutoIngest($this->getDbAutoIngest()); $copyObj->setDbAutoIngest($this->getDbAutoIngest());
$copyObj->setDbAutoIngestTimestamp($this->getDbAutoIngestTimestamp()); $copyObj->setDbAutoIngestTimestamp($this->getDbAutoIngestTimestamp());
$copyObj->setDbAlbumOverride($this->getDbAlbumOverride());
$copyObj->setDbPodcastId($this->getDbPodcastId()); $copyObj->setDbPodcastId($this->getDbPodcastId());
if ($deepCopy && !$this->startCopy) { if ($deepCopy && !$this->startCopy) {
@ -1055,6 +1124,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
$this->id = null; $this->id = null;
$this->auto_ingest = null; $this->auto_ingest = null;
$this->auto_ingest_timestamp = null; $this->auto_ingest_timestamp = null;
$this->album_override = null;
$this->podcast_id = null; $this->podcast_id = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->alreadyInValidation = false; $this->alreadyInValidation = false;

View File

@ -24,13 +24,13 @@ abstract class BaseImportedPodcastPeer
const TM_CLASS = 'ImportedPodcastTableMap'; const TM_CLASS = 'ImportedPodcastTableMap';
/** The total number of columns. */ /** The total number of columns. */
const NUM_COLUMNS = 4; const NUM_COLUMNS = 5;
/** 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 = 4; const NUM_HYDRATE_COLUMNS = 5;
/** the column name for the id field */ /** the column name for the id field */
const ID = 'imported_podcast.id'; const ID = 'imported_podcast.id';
@ -41,6 +41,9 @@ abstract class BaseImportedPodcastPeer
/** the column name for the auto_ingest_timestamp field */ /** the column name for the auto_ingest_timestamp field */
const AUTO_INGEST_TIMESTAMP = 'imported_podcast.auto_ingest_timestamp'; const AUTO_INGEST_TIMESTAMP = 'imported_podcast.auto_ingest_timestamp';
/** the column name for the album_override field */
const ALBUM_OVERRIDE = 'imported_podcast.album_override';
/** the column name for the podcast_id field */ /** the column name for the podcast_id field */
const PODCAST_ID = 'imported_podcast.podcast_id'; const PODCAST_ID = 'imported_podcast.podcast_id';
@ -63,12 +66,12 @@ abstract class BaseImportedPodcastPeer
* e.g. ImportedPodcastPeer::$fieldNames[ImportedPodcastPeer::TYPE_PHPNAME][0] = 'Id' * e.g. ImportedPodcastPeer::$fieldNames[ImportedPodcastPeer::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbAutoIngest', 'DbAutoIngestTimestamp', 'DbPodcastId', ), BasePeer::TYPE_PHPNAME => array ('DbId', 'DbAutoIngest', 'DbAutoIngestTimestamp', 'DbAlbumOverride', 'DbPodcastId', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbAutoIngest', 'dbAutoIngestTimestamp', 'dbPodcastId', ), BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbAutoIngest', 'dbAutoIngestTimestamp', 'dbAlbumOverride', 'dbPodcastId', ),
BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID, ImportedPodcastPeer::AUTO_INGEST, ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, ImportedPodcastPeer::PODCAST_ID, ), BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID, ImportedPodcastPeer::AUTO_INGEST, ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, ImportedPodcastPeer::ALBUM_OVERRIDE, ImportedPodcastPeer::PODCAST_ID, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'AUTO_INGEST', 'AUTO_INGEST_TIMESTAMP', 'PODCAST_ID', ), BasePeer::TYPE_RAW_COLNAME => array ('ID', 'AUTO_INGEST', 'AUTO_INGEST_TIMESTAMP', 'ALBUM_OVERRIDE', 'PODCAST_ID', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'auto_ingest', 'auto_ingest_timestamp', 'podcast_id', ), BasePeer::TYPE_FIELDNAME => array ('id', 'auto_ingest', 'auto_ingest_timestamp', 'album_override', 'podcast_id', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
); );
/** /**
@ -78,12 +81,12 @@ abstract class BaseImportedPodcastPeer
* e.g. ImportedPodcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 * e.g. ImportedPodcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbAutoIngest' => 1, 'DbAutoIngestTimestamp' => 2, 'DbPodcastId' => 3, ), BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbAutoIngest' => 1, 'DbAutoIngestTimestamp' => 2, 'DbAlbumOverride' => 3, 'DbPodcastId' => 4, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbAutoIngest' => 1, 'dbAutoIngestTimestamp' => 2, 'dbPodcastId' => 3, ), BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbAutoIngest' => 1, 'dbAutoIngestTimestamp' => 2, 'dbAlbumOverride' => 3, 'dbPodcastId' => 4, ),
BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID => 0, ImportedPodcastPeer::AUTO_INGEST => 1, ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP => 2, ImportedPodcastPeer::PODCAST_ID => 3, ), BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID => 0, ImportedPodcastPeer::AUTO_INGEST => 1, ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP => 2, ImportedPodcastPeer::ALBUM_OVERRIDE => 3, ImportedPodcastPeer::PODCAST_ID => 4, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'AUTO_INGEST' => 1, 'AUTO_INGEST_TIMESTAMP' => 2, 'PODCAST_ID' => 3, ), BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'AUTO_INGEST' => 1, 'AUTO_INGEST_TIMESTAMP' => 2, 'ALBUM_OVERRIDE' => 3, 'PODCAST_ID' => 4, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'auto_ingest' => 1, 'auto_ingest_timestamp' => 2, 'podcast_id' => 3, ), BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'auto_ingest' => 1, 'auto_ingest_timestamp' => 2, 'album_override' => 3, 'podcast_id' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
); );
/** /**
@ -160,11 +163,13 @@ abstract class BaseImportedPodcastPeer
$criteria->addSelectColumn(ImportedPodcastPeer::ID); $criteria->addSelectColumn(ImportedPodcastPeer::ID);
$criteria->addSelectColumn(ImportedPodcastPeer::AUTO_INGEST); $criteria->addSelectColumn(ImportedPodcastPeer::AUTO_INGEST);
$criteria->addSelectColumn(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP); $criteria->addSelectColumn(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP);
$criteria->addSelectColumn(ImportedPodcastPeer::ALBUM_OVERRIDE);
$criteria->addSelectColumn(ImportedPodcastPeer::PODCAST_ID); $criteria->addSelectColumn(ImportedPodcastPeer::PODCAST_ID);
} else { } else {
$criteria->addSelectColumn($alias . '.id'); $criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.auto_ingest'); $criteria->addSelectColumn($alias . '.auto_ingest');
$criteria->addSelectColumn($alias . '.auto_ingest_timestamp'); $criteria->addSelectColumn($alias . '.auto_ingest_timestamp');
$criteria->addSelectColumn($alias . '.album_override');
$criteria->addSelectColumn($alias . '.podcast_id'); $criteria->addSelectColumn($alias . '.podcast_id');
} }
} }

View File

@ -9,11 +9,13 @@
* @method ImportedPodcastQuery orderByDbId($order = Criteria::ASC) Order by the id column * @method ImportedPodcastQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method ImportedPodcastQuery orderByDbAutoIngest($order = Criteria::ASC) Order by the auto_ingest column * @method ImportedPodcastQuery orderByDbAutoIngest($order = Criteria::ASC) Order by the auto_ingest column
* @method ImportedPodcastQuery orderByDbAutoIngestTimestamp($order = Criteria::ASC) Order by the auto_ingest_timestamp column * @method ImportedPodcastQuery orderByDbAutoIngestTimestamp($order = Criteria::ASC) Order by the auto_ingest_timestamp column
* @method ImportedPodcastQuery orderByDbAlbumOverride($order = Criteria::ASC) Order by the album_override column
* @method ImportedPodcastQuery orderByDbPodcastId($order = Criteria::ASC) Order by the podcast_id column * @method ImportedPodcastQuery orderByDbPodcastId($order = Criteria::ASC) Order by the podcast_id column
* *
* @method ImportedPodcastQuery groupByDbId() Group by the id column * @method ImportedPodcastQuery groupByDbId() Group by the id column
* @method ImportedPodcastQuery groupByDbAutoIngest() Group by the auto_ingest column * @method ImportedPodcastQuery groupByDbAutoIngest() Group by the auto_ingest column
* @method ImportedPodcastQuery groupByDbAutoIngestTimestamp() Group by the auto_ingest_timestamp column * @method ImportedPodcastQuery groupByDbAutoIngestTimestamp() Group by the auto_ingest_timestamp column
* @method ImportedPodcastQuery groupByDbAlbumOverride() Group by the album_override column
* @method ImportedPodcastQuery groupByDbPodcastId() Group by the podcast_id column * @method ImportedPodcastQuery groupByDbPodcastId() Group by the podcast_id column
* *
* @method ImportedPodcastQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ImportedPodcastQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
@ -29,11 +31,13 @@
* *
* @method ImportedPodcast findOneByDbAutoIngest(boolean $auto_ingest) Return the first ImportedPodcast filtered by the auto_ingest column * @method ImportedPodcast findOneByDbAutoIngest(boolean $auto_ingest) Return the first ImportedPodcast filtered by the auto_ingest column
* @method ImportedPodcast findOneByDbAutoIngestTimestamp(string $auto_ingest_timestamp) Return the first ImportedPodcast filtered by the auto_ingest_timestamp column * @method ImportedPodcast findOneByDbAutoIngestTimestamp(string $auto_ingest_timestamp) Return the first ImportedPodcast filtered by the auto_ingest_timestamp column
* @method ImportedPodcast findOneByDbAlbumOverride(boolean $album_override) Return the first ImportedPodcast filtered by the album_override column
* @method ImportedPodcast findOneByDbPodcastId(int $podcast_id) Return the first ImportedPodcast filtered by the podcast_id column * @method ImportedPodcast findOneByDbPodcastId(int $podcast_id) Return the first ImportedPodcast filtered by the podcast_id column
* *
* @method array findByDbId(int $id) Return ImportedPodcast objects filtered by the id column * @method array findByDbId(int $id) Return ImportedPodcast objects filtered by the id column
* @method array findByDbAutoIngest(boolean $auto_ingest) Return ImportedPodcast objects filtered by the auto_ingest column * @method array findByDbAutoIngest(boolean $auto_ingest) Return ImportedPodcast objects filtered by the auto_ingest column
* @method array findByDbAutoIngestTimestamp(string $auto_ingest_timestamp) Return ImportedPodcast objects filtered by the auto_ingest_timestamp column * @method array findByDbAutoIngestTimestamp(string $auto_ingest_timestamp) Return ImportedPodcast objects filtered by the auto_ingest_timestamp column
* @method array findByDbAlbumOverride(boolean $album_override) Return ImportedPodcast objects filtered by the album_override column
* @method array findByDbPodcastId(int $podcast_id) Return ImportedPodcast objects filtered by the podcast_id column * @method array findByDbPodcastId(int $podcast_id) Return ImportedPodcast objects filtered by the podcast_id column
* *
* @package propel.generator.airtime.om * @package propel.generator.airtime.om
@ -142,7 +146,7 @@ abstract class BaseImportedPodcastQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT "id", "auto_ingest", "auto_ingest_timestamp", "podcast_id" FROM "imported_podcast" WHERE "id" = :p0'; $sql = 'SELECT "id", "auto_ingest", "auto_ingest_timestamp", "album_override", "podcast_id" FROM "imported_podcast" 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);
@ -343,6 +347,33 @@ abstract class BaseImportedPodcastQuery extends ModelCriteria
return $this->addUsingAlias(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, $dbAutoIngestTimestamp, $comparison); return $this->addUsingAlias(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, $dbAutoIngestTimestamp, $comparison);
} }
/**
* Filter the query on the album_override column
*
* Example usage:
* <code>
* $query->filterByDbAlbumOverride(true); // WHERE album_override = true
* $query->filterByDbAlbumOverride('yes'); // WHERE album_override = true
* </code>
*
* @param boolean|string $dbAlbumOverride 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 ImportedPodcastQuery The current query, for fluid interface
*/
public function filterByDbAlbumOverride($dbAlbumOverride = null, $comparison = null)
{
if (is_string($dbAlbumOverride)) {
$dbAlbumOverride = in_array(strtolower($dbAlbumOverride), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(ImportedPodcastPeer::ALBUM_OVERRIDE, $dbAlbumOverride, $comparison);
}
/** /**
* Filter the query on the podcast_id column * Filter the query on the podcast_id column
* *

View File

@ -49,6 +49,7 @@ abstract class BaseThirdPartyTrackReferences extends BaseObject implements Persi
/** /**
* The value for the file_id field. * The value for the file_id field.
* Note: this column has a database default value of: 0
* @var int * @var int
*/ */
protected $file_id; protected $file_id;
@ -102,6 +103,27 @@ abstract class BaseThirdPartyTrackReferences extends BaseObject implements Persi
*/ */
protected $celeryTaskssScheduledForDeletion = null; protected $celeryTaskssScheduledForDeletion = null;
/**
* Applies default values to this object.
* This method should be called from the object's constructor (or
* equivalent initialization method).
* @see __construct()
*/
public function applyDefaultValues()
{
$this->file_id = 0;
}
/**
* Initializes internal state of BaseThirdPartyTrackReferences object.
* @see applyDefaults()
*/
public function __construct()
{
parent::__construct();
$this->applyDefaultValues();
}
/** /**
* Get the [id] column value. * Get the [id] column value.
* *
@ -334,6 +356,10 @@ abstract class BaseThirdPartyTrackReferences extends BaseObject implements Persi
*/ */
public function hasOnlyDefaultValues() public function hasOnlyDefaultValues()
{ {
if ($this->file_id !== 0) {
return false;
}
// otherwise, everything was equal, so return true // otherwise, everything was equal, so return true
return true; return true;
} // hasOnlyDefaultValues() } // hasOnlyDefaultValues()
@ -1129,7 +1155,7 @@ abstract class BaseThirdPartyTrackReferences extends BaseObject implements Persi
public function setCcFiles(CcFiles $v = null) public function setCcFiles(CcFiles $v = null)
{ {
if ($v === null) { if ($v === null) {
$this->setDbFileId(NULL); $this->setDbFileId(0);
} else { } else {
$this->setDbFileId($v->getDbId()); $this->setDbFileId($v->getDbId());
} }
@ -1427,6 +1453,7 @@ abstract class BaseThirdPartyTrackReferences extends BaseObject implements Persi
$this->alreadyInValidation = false; $this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false; $this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences(); $this->clearAllReferences();
$this->applyDefaultValues();
$this->resetModified(); $this->resetModified();
$this->setNew(true); $this->setNew(true);
$this->setDeleted(false); $this->setDeleted(false);

View File

@ -46,7 +46,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
public function importEpisode($podcastId, $episode) { public function importEpisode($podcastId, $episode) {
$e = $this->addPlaceholder($podcastId, $episode); $e = $this->addPlaceholder($podcastId, $episode);
$p = $e->getPodcast(); $p = $e->getPodcast();
$this->_download($e->getDbId(), $e->getDbDownloadUrl(), $p->getDbTitle()); $this->_download($e->getDbId(), $e->getDbDownloadUrl(), $p->getDbTitle(), $this->_getAlbumOverride($p));
return $e; return $e;
} }
@ -87,7 +87,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
public function addPlaceholder($podcastId, $episode) { public function addPlaceholder($podcastId, $episode) {
$existingEpisode = PodcastEpisodesQuery::create()->findOneByDbEpisodeGuid($episode["guid"]); $existingEpisode = PodcastEpisodesQuery::create()->findOneByDbEpisodeGuid($episode["guid"]);
if (!empty($existingEpisode)) { if (!empty($existingEpisode)) {
throw new DuplicatePodcastEpisodeException("Episode already exists: \n" . var_export($episode, true)); throw new DuplicatePodcastEpisodeException(sprintf("Episode already exists for podcast: %s, guid: %s\n", $episode['podcast_id'], $episode['guid']));
} }
// We need to check whether the array is parsed directly from the SimplePie // We need to check whether the array is parsed directly from the SimplePie
// feed object, or whether it's passed in as json // feed object, or whether it's passed in as json
@ -128,29 +128,47 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
/** @var PodcastEpisodes $episode */ /** @var PodcastEpisodes $episode */
foreach($episodes as $episode) { foreach($episodes as $episode) {
$podcast = $episode->getPodcast(); $podcast = $episode->getPodcast();
$this->_download($episode->getDbId(), $episode->getDbDownloadUrl(), $podcast->getDbTitle()); $this->_download($episode->getDbId(), $episode->getDbDownloadUrl(), $podcast->getDbTitle(), $this->_getAlbumOverride($podcast));
} }
} }
/**
* check if there is a podcast specific album override
*
* @param object $podcast podcast object
*
* @return boolean
*/
private function _getAlbumOverride($podcast) {
$override = Application_Model_Preference::GetPodcastAlbumOverride();
$podcast_override = $podcast->toArray();
$podcast_override = $podcast_override['DbAlbumOverride'];
if ($podcast_override) {
$override = $podcast_override;
}
return $override;
}
/** /**
* Given an episode ID and a download URL, send a Celery task * Given an episode ID and a download URL, send a Celery task
* to download an RSS feed track * to download an RSS feed track
* *
* @param int $id episode unique ID * @param int $id episode unique ID
* @param string $url download url for the episode * @param string $url download url for the episode
* @param string $title title of podcast to be downloaded - added as album to track metadata * @param string $title title of podcast to be downloaded - added as album to track metadata
* @param boolean $album_override should we override the album name when downloading
*/ */
private function _download($id, $url, $title) { private function _download($id, $url, $title, $album_override) {
$CC_CONFIG = Config::getConfig(); $CC_CONFIG = Config::getConfig();
$stationUrl = Application_Common_HTTPHelper::getStationUrl(); $stationUrl = Application_Common_HTTPHelper::getStationUrl();
$stationUrl .= substr($stationUrl, -1) == '/' ? '' : '/'; $stationUrl .= substr($stationUrl, -1) == '/' ? '' : '/';
$data = array( $data = array(
'id' => $id, 'id' => $id,
'url' => $url, 'url' => $url,
'callback_url' => $stationUrl . 'rest/media', 'callback_url' => $stationUrl . 'rest/media',
'api_key' => $CC_CONFIG["apiKey"][0], 'api_key' => $CC_CONFIG["apiKey"][0],
'podcast_name' => $title, 'podcast_name' => $title,
'album_override' => Application_Model_Preference::GetPodcastAlbumOverride(), 'album_override' => $album_override,
); );
$task = $this->_executeTask(static::$_CELERY_TASKS[self::DOWNLOAD], $data); $task = $this->_executeTask(static::$_CELERY_TASKS[self::DOWNLOAD], $data);
// Get the created ThirdPartyTaskReference and set the episode ID so // Get the created ThirdPartyTaskReference and set the episode ID so

View File

@ -506,3 +506,16 @@ class AirtimeUpgrader300alpha extends AirtimeUpgrader
return '3.0.0-alpha'; return '3.0.0-alpha';
} }
} }
class AirtimeUpgrader300alpha1 extends AirtimeUpgrader
{
protected function getSupportedSchemaVersions() {
return array(
'3.0.0-alpha'
);
}
public function getNewVersion() {
return '3.0.0-alpha.1';
}
}

View File

@ -17,9 +17,14 @@
<span class="podcast-metadata-field">{{podcast.url}}</span> <span class="podcast-metadata-field">{{podcast.url}}</span>
</a> </a>
</div> </div>
<div style="padding-top: 0.1em;">
<label for="podcast_auto_ingest"><?php echo _("Automatically download latest episodes?") ?></label> <label for="podcast_auto_ingest"><input name="podcast_auto_ingest" ng-model="podcast.auto_ingest" type="checkbox" class="float-right"/></label>
<input name="podcast_auto_ingest" ng-model="podcast.auto_ingest" type="checkbox"/> <span class="podcast-metadata-field"><?php echo _("Automatically download latest episodes?") ?></span>
</div>
<div style="padding-top: 0.1em;">
<label for="podcast_album_override"><input name="podcast_album_override" ng-model="podcast.album_override" type="checkbox" class="no-float"/></label>
<span class="podcast-metadata-field"><?php echo _("Override album name with podcast name during ingest."); ?></span>
</div>
</form> </form>
</div> </div>
@ -38,4 +43,4 @@
</div> </div>
<div class='success' style='display:none'></span></div> <div class='success' style='display:none'></span></div>
</div> </div>
</div> </div>

View File

@ -543,7 +543,7 @@
<column name="service" phpName="DbService" type="VARCHAR" size="256" required="true" /> <column name="service" phpName="DbService" type="VARCHAR" size="256" required="true" />
<!-- Make foreign ID a VARCHAR field in case a service uses hashes or other non-integer identifiers --> <!-- Make foreign ID a VARCHAR field in case a service uses hashes or other non-integer identifiers -->
<column name="foreign_id" phpName="DbForeignId" type="VARCHAR" size="256" /> <column name="foreign_id" phpName="DbForeignId" type="VARCHAR" size="256" />
<column name="file_id" phpName="DbFileId" type="INTEGER" required="true" /> <column name="file_id" phpName="DbFileId" type="INTEGER" required="true" default="0" />
<column name="upload_time" phpName="DbUploadTime" type="TIMESTAMP" /> <column name="upload_time" phpName="DbUploadTime" type="TIMESTAMP" />
<column name="status" phpName="DbStatus" type="VARCHAR" size="256" /> <column name="status" phpName="DbStatus" type="VARCHAR" size="256" />
<unique name="foreign_id_unique"> <unique name="foreign_id_unique">
@ -605,6 +605,7 @@
<column name="id" phpName="DbId" required="true" primaryKey="true" autoIncrement="true" type="INTEGER"/> <column name="id" phpName="DbId" required="true" primaryKey="true" autoIncrement="true" type="INTEGER"/>
<column name="auto_ingest" phpName="DbAutoIngest" type="BOOLEAN" required="true" defaultValue="false"/> <column name="auto_ingest" phpName="DbAutoIngest" type="BOOLEAN" required="true" defaultValue="false"/>
<column name="auto_ingest_timestamp" phpName="DbAutoIngestTimestamp" type="TIMESTAMP" required="false" /> <column name="auto_ingest_timestamp" phpName="DbAutoIngestTimestamp" type="TIMESTAMP" required="false" />
<column name="album_override" phpName="DbAlbumOverride" type="BOOLEAN" required="true" defaultValue="false"/>
<column name="podcast_id" phpName="DbPodcastId" required="true" type="INTEGER"/> <column name="podcast_id" phpName="DbPodcastId" required="true" type="INTEGER"/>
<foreign-key foreignTable="podcast" name="podcast_id_fkey" onDelete="CASCADE"> <foreign-key foreignTable="podcast" name="podcast_id_fkey" onDelete="CASCADE">
<reference local="podcast_id" foreign="id" /> <reference local="podcast_id" foreign="id" />

View File

@ -685,7 +685,7 @@ CREATE TABLE "third_party_track_references"
"id" serial NOT NULL, "id" serial NOT NULL,
"service" VARCHAR(256) NOT NULL, "service" VARCHAR(256) NOT NULL,
"foreign_id" VARCHAR(256), "foreign_id" VARCHAR(256),
"file_id" INTEGER NOT NULL, "file_id" INTEGER DEFAULT 0 NOT NULL,
"upload_time" TIMESTAMP, "upload_time" TIMESTAMP,
"status" VARCHAR(256), "status" VARCHAR(256),
PRIMARY KEY ("id"), PRIMARY KEY ("id"),
@ -760,6 +760,7 @@ CREATE TABLE "imported_podcast"
"id" serial NOT NULL, "id" serial NOT NULL,
"auto_ingest" BOOLEAN DEFAULT 'f' NOT NULL, "auto_ingest" BOOLEAN DEFAULT 'f' NOT NULL,
"auto_ingest_timestamp" TIMESTAMP, "auto_ingest_timestamp" TIMESTAMP,
"album_override" BOOLEAN DEFAULT 'f' NOT NULL,
"podcast_id" INTEGER NOT NULL, "podcast_id" INTEGER NOT NULL,
PRIMARY KEY ("id") PRIMARY KEY ("id")
); );

View File

@ -4140,6 +4140,17 @@ li .ui-state-hover {
margin: 8px 0 0; margin: 8px 0 0;
} }
.podcast-metadata input[type="checkbox"].no-float {
float: none;
margin: 8px 0 0;
}
.podcast-metadata input[type="checkbox"].float-right {
float:right;
margin: 8px 0 0;
}
.podcast-metadata label, .podcast-metadata label,
.media-metadata label { .media-metadata label {
display: block; display: block;