From 033e8160151f1e8a3b7f72b52a55eedf9dcc77aa Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Fri, 17 Mar 2017 11:45:10 +0100 Subject: [PATCH 1/9] Edit form --- .../application/views/scripts/podcast/podcast.phtml | 13 +++++++++---- airtime_mvc/public/css/styles.css | 5 +++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/views/scripts/podcast/podcast.phtml b/airtime_mvc/application/views/scripts/podcast/podcast.phtml index 313419914..6b7530437 100644 --- a/airtime_mvc/application/views/scripts/podcast/podcast.phtml +++ b/airtime_mvc/application/views/scripts/podcast/podcast.phtml @@ -17,9 +17,14 @@ {{podcast.url}} - - - +
+ + +
+
+ + +
@@ -38,4 +43,4 @@ - \ No newline at end of file + diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index b11bcbf81..93f4f6968 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -4140,6 +4140,11 @@ li .ui-state-hover { margin: 8px 0 0; } +.podcast-metadata input[type="checkbox"].no-float { + float: none; + margin: 8px 0 0; +} + .podcast-metadata label, .media-metadata label { display: block; From a2eb4b2297058c7b49e1a823317469868c5633fb Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Fri, 17 Mar 2017 11:52:03 +0100 Subject: [PATCH 2/9] Add album_override field for imported_podcasts --- .../airtime/map/ImportedPodcastTableMap.php | 1 + .../models/airtime/om/BaseImportedPodcast.php | 78 ++++++++++++++++++- .../airtime/om/BaseImportedPodcastPeer.php | 33 ++++---- .../airtime/om/BaseImportedPodcastQuery.php | 33 +++++++- airtime_mvc/build/schema.xml | 1 + airtime_mvc/build/sql/schema.sql | 1 + 6 files changed, 128 insertions(+), 19 deletions(-) diff --git a/airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php b/airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php index 53030858e..be9f1ea5e 100644 --- a/airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php +++ b/airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php @@ -42,6 +42,7 @@ class ImportedPodcastTableMap extends TableMap $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null); $this->addColumn('auto_ingest', 'DbAutoIngest', 'BOOLEAN', true, null, false); $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); // validators } // initialize() diff --git a/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php index 1b72d0cef..635c27e4b 100644 --- a/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php +++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php @@ -48,6 +48,13 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent */ 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. * @var int @@ -88,6 +95,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent public function applyDefaultValues() { $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. * @@ -241,6 +260,35 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent return $this; } // 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. * @@ -280,6 +328,10 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent return false; } + if ($this->album_override !== false) { + return false; + } + // otherwise, everything was equal, so return true return true; } // hasOnlyDefaultValues() @@ -305,7 +357,8 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent $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_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->setNew(false); @@ -315,7 +368,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent } $this->postHydrate($row, $startcol, $rehydrate); - return $startcol + 4; // 4 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS. + return $startcol + 5; // 5 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $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)) { $modifiedColumns[':p' . $index++] = '"auto_ingest_timestamp"'; } + if ($this->isColumnModified(ImportedPodcastPeer::ALBUM_OVERRIDE)) { + $modifiedColumns[':p' . $index++] = '"album_override"'; + } if ($this->isColumnModified(ImportedPodcastPeer::PODCAST_ID)) { $modifiedColumns[':p' . $index++] = '"podcast_id"'; } @@ -585,6 +641,9 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent case '"auto_ingest_timestamp"': $stmt->bindValue($identifier, $this->auto_ingest_timestamp, PDO::PARAM_STR); break; + case '"album_override"': + $stmt->bindValue($identifier, $this->album_override, PDO::PARAM_BOOL); + break; case '"podcast_id"': $stmt->bindValue($identifier, $this->podcast_id, PDO::PARAM_INT); break; @@ -737,6 +796,9 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent return $this->getDbAutoIngestTimestamp(); break; case 3: + return $this->getDbAlbumOverride(); + break; + case 4: return $this->getDbPodcastId(); break; default: @@ -771,7 +833,8 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent $keys[0] => $this->getDbId(), $keys[1] => $this->getDbAutoIngest(), $keys[2] => $this->getDbAutoIngestTimestamp(), - $keys[3] => $this->getDbPodcastId(), + $keys[3] => $this->getDbAlbumOverride(), + $keys[4] => $this->getDbPodcastId(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -826,6 +889,9 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent $this->setDbAutoIngestTimestamp($value); break; case 3: + $this->setDbAlbumOverride($value); + break; + case 4: $this->setDbPodcastId($value); break; } // 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[1], $arr)) $this->setDbAutoIngest($arr[$keys[1]]); 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::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::ALBUM_OVERRIDE)) $criteria->add(ImportedPodcastPeer::ALBUM_OVERRIDE, $this->album_override); if ($this->isColumnModified(ImportedPodcastPeer::PODCAST_ID)) $criteria->add(ImportedPodcastPeer::PODCAST_ID, $this->podcast_id); return $criteria; @@ -936,6 +1004,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent { $copyObj->setDbAutoIngest($this->getDbAutoIngest()); $copyObj->setDbAutoIngestTimestamp($this->getDbAutoIngestTimestamp()); + $copyObj->setDbAlbumOverride($this->getDbAlbumOverride()); $copyObj->setDbPodcastId($this->getDbPodcastId()); if ($deepCopy && !$this->startCopy) { @@ -1055,6 +1124,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent $this->id = null; $this->auto_ingest = null; $this->auto_ingest_timestamp = null; + $this->album_override = null; $this->podcast_id = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; diff --git a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php index 70aa4080f..dc79b2a2b 100644 --- a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php @@ -24,13 +24,13 @@ abstract class BaseImportedPodcastPeer const TM_CLASS = 'ImportedPodcastTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 4; + const NUM_COLUMNS = 5; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 4; + const NUM_HYDRATE_COLUMNS = 5; /** the column name for the id field */ const ID = 'imported_podcast.id'; @@ -41,6 +41,9 @@ abstract class BaseImportedPodcastPeer /** the column name for the auto_ingest_timestamp field */ 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 */ const PODCAST_ID = 'imported_podcast.podcast_id'; @@ -63,12 +66,12 @@ abstract class BaseImportedPodcastPeer * e.g. ImportedPodcastPeer::$fieldNames[ImportedPodcastPeer::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbAutoIngest', 'DbAutoIngestTimestamp', 'DbPodcastId', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbAutoIngest', 'dbAutoIngestTimestamp', 'dbPodcastId', ), - BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID, ImportedPodcastPeer::AUTO_INGEST, ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, ImportedPodcastPeer::PODCAST_ID, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'AUTO_INGEST', 'AUTO_INGEST_TIMESTAMP', 'PODCAST_ID', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'auto_ingest', 'auto_ingest_timestamp', 'podcast_id', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbAutoIngest', 'DbAutoIngestTimestamp', 'DbAlbumOverride', 'DbPodcastId', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbAutoIngest', 'dbAutoIngestTimestamp', 'dbAlbumOverride', 'dbPodcastId', ), + 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', 'ALBUM_OVERRIDE', 'PODCAST_ID', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'auto_ingest', 'auto_ingest_timestamp', 'album_override', 'podcast_id', ), + 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 */ protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbAutoIngest' => 1, 'DbAutoIngestTimestamp' => 2, 'DbPodcastId' => 3, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbAutoIngest' => 1, 'dbAutoIngestTimestamp' => 2, 'dbPodcastId' => 3, ), - BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID => 0, ImportedPodcastPeer::AUTO_INGEST => 1, ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP => 2, ImportedPodcastPeer::PODCAST_ID => 3, ), - BasePeer::TYPE_RAW_COLNAME => 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, 'podcast_id' => 3, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 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, 'dbAlbumOverride' => 3, 'dbPodcastId' => 4, ), + 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, 'ALBUM_OVERRIDE' => 3, 'PODCAST_ID' => 4, ), + 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, 4, ) ); /** @@ -160,11 +163,13 @@ abstract class BaseImportedPodcastPeer $criteria->addSelectColumn(ImportedPodcastPeer::ID); $criteria->addSelectColumn(ImportedPodcastPeer::AUTO_INGEST); $criteria->addSelectColumn(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP); + $criteria->addSelectColumn(ImportedPodcastPeer::ALBUM_OVERRIDE); $criteria->addSelectColumn(ImportedPodcastPeer::PODCAST_ID); } else { $criteria->addSelectColumn($alias . '.id'); $criteria->addSelectColumn($alias . '.auto_ingest'); $criteria->addSelectColumn($alias . '.auto_ingest_timestamp'); + $criteria->addSelectColumn($alias . '.album_override'); $criteria->addSelectColumn($alias . '.podcast_id'); } } diff --git a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php index fa52bc7cc..59de45849 100644 --- a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php @@ -9,11 +9,13 @@ * @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 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 groupByDbId() Group by the id column * @method ImportedPodcastQuery groupByDbAutoIngest() Group by the auto_ingest 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 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 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 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 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 * * @package propel.generator.airtime.om @@ -142,7 +146,7 @@ abstract class BaseImportedPodcastQuery extends ModelCriteria */ 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 { $stmt = $con->prepare($sql); $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); } + /** + * Filter the query on the album_override column + * + * Example usage: + * + * $query->filterByDbAlbumOverride(true); // WHERE album_override = true + * $query->filterByDbAlbumOverride('yes'); // WHERE album_override = true + * + * + * @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 * diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index e2d129954..387366b92 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -605,6 +605,7 @@ + diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index a7ef747ed..c6719bdb7 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -760,6 +760,7 @@ CREATE TABLE "imported_podcast" "id" serial NOT NULL, "auto_ingest" BOOLEAN DEFAULT 'f' NOT NULL, "auto_ingest_timestamp" TIMESTAMP, + "album_override" BOOLEAN DEFAULT 'f' NOT NULL, "podcast_id" INTEGER NOT NULL, PRIMARY KEY ("id") ); From d68c95b1442b7e1726faf81c0d497b656f0c5d94 Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Fri, 17 Mar 2017 14:36:28 +0100 Subject: [PATCH 3/9] Add db up/downgrade script for album_override field --- .../airtime_3.0.0-alpha.1/downgrade.sql | 1 + .../upgrade_sql/airtime_3.0.0-alpha.1/upgrade.sql | 1 + airtime_mvc/application/upgrade/Upgrades.php | 13 +++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.1/downgrade.sql create mode 100644 airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.1/upgrade.sql diff --git a/airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.1/downgrade.sql b/airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.1/downgrade.sql new file mode 100644 index 000000000..3a6bf5768 --- /dev/null +++ b/airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.1/downgrade.sql @@ -0,0 +1 @@ +ALTER TABLE imported_podcast DROP COLUMN IF EXISTS album_override; diff --git a/airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.1/upgrade.sql b/airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.1/upgrade.sql new file mode 100644 index 000000000..5616fc47f --- /dev/null +++ b/airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.1/upgrade.sql @@ -0,0 +1 @@ +ALTER TABLE imported_podcast ADD COLUMN album_override boolean default 'f' NOT NULL; diff --git a/airtime_mvc/application/upgrade/Upgrades.php b/airtime_mvc/application/upgrade/Upgrades.php index 262aabfd1..f5d70ef96 100644 --- a/airtime_mvc/application/upgrade/Upgrades.php +++ b/airtime_mvc/application/upgrade/Upgrades.php @@ -506,3 +506,16 @@ class AirtimeUpgrader300alpha extends AirtimeUpgrader 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'; + } +} From e3879b42a3b5bd86ba2be5a8b05740880edf783f Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Fri, 17 Mar 2017 14:56:33 +0100 Subject: [PATCH 4/9] Send per podcast album override flag to celery --- .../services/PodcastEpisodeService.php | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/airtime_mvc/application/services/PodcastEpisodeService.php b/airtime_mvc/application/services/PodcastEpisodeService.php index 6a85f3b12..78900fbdd 100644 --- a/airtime_mvc/application/services/PodcastEpisodeService.php +++ b/airtime_mvc/application/services/PodcastEpisodeService.php @@ -46,7 +46,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir public function importEpisode($podcastId, $episode) { $e = $this->addPlaceholder($podcastId, $episode); $p = $e->getPodcast(); - $this->_download($e->getDbId(), $e->getDbDownloadUrl(), $p->getDbTitle()); + $this->_download($e->getDbId(), $e->getDbDownloadUrl(), $p->getDbTitle(), $this->_getAlbumOverride($p)); return $e; } @@ -128,29 +128,47 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir /** @var PodcastEpisodes $episode */ foreach($episodes as $episode) { $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 * to download an RSS feed track * - * @param int $id episode unique ID - * @param string $url download url for the episode - * @param string $title title of podcast to be downloaded - added as album to track metadata + * @param int $id episode unique ID + * @param string $url download url for the episode + * @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(); $stationUrl = Application_Common_HTTPHelper::getStationUrl(); $stationUrl .= substr($stationUrl, -1) == '/' ? '' : '/'; $data = array( - 'id' => $id, - 'url' => $url, - 'callback_url' => $stationUrl . 'rest/media', - 'api_key' => $CC_CONFIG["apiKey"][0], - 'podcast_name' => $title, - 'album_override' => Application_Model_Preference::GetPodcastAlbumOverride(), + 'id' => $id, + 'url' => $url, + 'callback_url' => $stationUrl . 'rest/media', + 'api_key' => $CC_CONFIG["apiKey"][0], + 'podcast_name' => $title, + 'album_override' => $album_override, ); $task = $this->_executeTask(static::$_CELERY_TASKS[self::DOWNLOAD], $data); // Get the created ThirdPartyTaskReference and set the episode ID so From 7f00182913001bb0d039dc5c0d0766d0695654aa Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Sat, 18 Mar 2017 11:37:45 +0100 Subject: [PATCH 5/9] Allow 0 file_id in third_party_trackrefs The previous constraint of NOT NULL made it impossible to create a placeholder entry for later downloading. This uses a 0 default instead of the constraint and downloading as well as the green checkbox work again. --- .../airtime_3.0.0-alpha.1/downgrade.sql | 2 ++ .../map/ThirdPartyTrackReferencesTableMap.php | 2 +- .../om/BaseThirdPartyTrackReferences.php | 29 ++++++++++++++++++- airtime_mvc/build/schema.xml | 2 +- airtime_mvc/build/sql/schema.sql | 2 +- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.1/downgrade.sql b/airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.1/downgrade.sql index 3a6bf5768..fc4c019cd 100644 --- a/airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.1/downgrade.sql +++ b/airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.1/downgrade.sql @@ -1 +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; diff --git a/airtime_mvc/application/models/airtime/map/ThirdPartyTrackReferencesTableMap.php b/airtime_mvc/application/models/airtime/map/ThirdPartyTrackReferencesTableMap.php index 98b907c19..3b90ff4ff 100644 --- a/airtime_mvc/application/models/airtime/map/ThirdPartyTrackReferencesTableMap.php +++ b/airtime_mvc/application/models/airtime/map/ThirdPartyTrackReferencesTableMap.php @@ -42,7 +42,7 @@ class ThirdPartyTrackReferencesTableMap extends TableMap $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null); $this->addColumn('service', 'DbService', 'VARCHAR', true, 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('status', 'DbStatus', 'VARCHAR', false, 256, null); // validators diff --git a/airtime_mvc/application/models/airtime/om/BaseThirdPartyTrackReferences.php b/airtime_mvc/application/models/airtime/om/BaseThirdPartyTrackReferences.php index a7860e1eb..662e287cb 100644 --- a/airtime_mvc/application/models/airtime/om/BaseThirdPartyTrackReferences.php +++ b/airtime_mvc/application/models/airtime/om/BaseThirdPartyTrackReferences.php @@ -49,6 +49,7 @@ abstract class BaseThirdPartyTrackReferences extends BaseObject implements Persi /** * The value for the file_id field. + * Note: this column has a database default value of: 0 * @var int */ protected $file_id; @@ -102,6 +103,27 @@ abstract class BaseThirdPartyTrackReferences extends BaseObject implements Persi */ 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. * @@ -334,6 +356,10 @@ abstract class BaseThirdPartyTrackReferences extends BaseObject implements Persi */ public function hasOnlyDefaultValues() { + if ($this->file_id !== 0) { + return false; + } + // otherwise, everything was equal, so return true return true; } // hasOnlyDefaultValues() @@ -1129,7 +1155,7 @@ abstract class BaseThirdPartyTrackReferences extends BaseObject implements Persi public function setCcFiles(CcFiles $v = null) { if ($v === null) { - $this->setDbFileId(NULL); + $this->setDbFileId(0); } else { $this->setDbFileId($v->getDbId()); } @@ -1427,6 +1453,7 @@ abstract class BaseThirdPartyTrackReferences extends BaseObject implements Persi $this->alreadyInValidation = false; $this->alreadyInClearAllReferencesDeep = false; $this->clearAllReferences(); + $this->applyDefaultValues(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 387366b92..8c944ed10 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -543,7 +543,7 @@ - + diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index c6719bdb7..f98e6a012 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -685,7 +685,7 @@ CREATE TABLE "third_party_track_references" "id" serial NOT NULL, "service" VARCHAR(256) NOT NULL, "foreign_id" VARCHAR(256), - "file_id" INTEGER NOT NULL, + "file_id" INTEGER DEFAULT 0 NOT NULL, "upload_time" TIMESTAMP, "status" VARCHAR(256), PRIMARY KEY ("id"), From b36b1ea63cf5c8854f409f105361b4bcb892173f Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Sat, 18 Mar 2017 11:38:58 +0100 Subject: [PATCH 6/9] Get rid of var_export in logs This has been bugging me since I first saw it. Dumping the whole object has no value at all, whats left should suffice. --- airtime_mvc/application/services/PodcastEpisodeService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/services/PodcastEpisodeService.php b/airtime_mvc/application/services/PodcastEpisodeService.php index 78900fbdd..124290ac2 100644 --- a/airtime_mvc/application/services/PodcastEpisodeService.php +++ b/airtime_mvc/application/services/PodcastEpisodeService.php @@ -87,7 +87,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir public function addPlaceholder($podcastId, $episode) { $existingEpisode = PodcastEpisodesQuery::create()->findOneByDbEpisodeGuid($episode["guid"]); 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 // feed object, or whether it's passed in as json From 1310c44d75eead47b627fa1706f5662bfab65052 Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Sat, 18 Mar 2017 11:46:30 +0100 Subject: [PATCH 7/9] Fix: add missing upgrade scripts --- .../controllers/upgrade_sql/airtime_3.0.0-alpha.1/upgrade.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.1/upgrade.sql b/airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.1/upgrade.sql index 5616fc47f..786a3a033 100644 --- a/airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.1/upgrade.sql +++ b/airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.1/upgrade.sql @@ -1 +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; From 5684689a1200fe4116fff97c1f31c593ba3e06c5 Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Sat, 18 Mar 2017 17:38:58 +0100 Subject: [PATCH 8/9] Make some room for text to fit line In some resolutions the line-height was not adding up to be enough space. --- airtime_mvc/application/views/scripts/podcast/podcast.phtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/views/scripts/podcast/podcast.phtml b/airtime_mvc/application/views/scripts/podcast/podcast.phtml index 6b7530437..7b216986a 100644 --- a/airtime_mvc/application/views/scripts/podcast/podcast.phtml +++ b/airtime_mvc/application/views/scripts/podcast/podcast.phtml @@ -17,11 +17,11 @@ -
+
-
+
From 91290b5e43b6170ebaebb41f47d247e17006660c Mon Sep 17 00:00:00 2001 From: Robb Ebright Date: Sat, 18 Mar 2017 14:34:21 -0400 Subject: [PATCH 9/9] Fixing CSS for podcast override --- airtime_mvc/application/views/scripts/podcast/podcast.phtml | 2 +- airtime_mvc/public/css/styles.css | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/views/scripts/podcast/podcast.phtml b/airtime_mvc/application/views/scripts/podcast/podcast.phtml index 7b216986a..1472bc78b 100644 --- a/airtime_mvc/application/views/scripts/podcast/podcast.phtml +++ b/airtime_mvc/application/views/scripts/podcast/podcast.phtml @@ -18,7 +18,7 @@
- +
diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index 93f4f6968..ae1583f66 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -4145,6 +4145,12 @@ li .ui-state-hover { margin: 8px 0 0; } +.podcast-metadata input[type="checkbox"].float-right { + float:right; + margin: 8px 0 0; + +} + .podcast-metadata label, .media-metadata label { display: block;