diff --git a/airtime_mvc/application/common/PodcastManager.php b/airtime_mvc/application/common/PodcastManager.php index a090ff910..d29816a54 100644 --- a/airtime_mvc/application/common/PodcastManager.php +++ b/airtime_mvc/application/common/PodcastManager.php @@ -101,4 +101,4 @@ class PodcastManager { return (strtotime($a["pub_date"]) < strtotime($b["pub_date"])) ? 1 : -1; // Descending order } -} \ No newline at end of file +} diff --git a/airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.8/downgrade.sql b/airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.8/downgrade.sql new file mode 100644 index 000000000..9e5f23e31 --- /dev/null +++ b/airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.8/downgrade.sql @@ -0,0 +1,2 @@ +ALTER TABLE podcast_episodes DROP COLUMN IF EXISTS episode_title; +ALTER TABLE podcast_episodes DROP COLUMN IF EXISTS episode_description; \ No newline at end of file diff --git a/airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.8/upgrade.sql b/airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.8/upgrade.sql new file mode 100644 index 000000000..a578c537e --- /dev/null +++ b/airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.8/upgrade.sql @@ -0,0 +1,2 @@ +ALTER TABLE podcast_episodes ADD COLUMN episode_title VARCHAR(4096); +ALTER TABLE podcast_episodes ADD COLUMN episode_description VARCHAR(4096); \ No newline at end of file diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index 924264751..ec9390e5c 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -102,13 +102,13 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm $podcast_album_override = new Zend_Form_Element_Radio('podcastAlbumOverride'); - $podcast_album_override->setLabel(_('Podcast Album Override')); + $podcast_album_override->setLabel(_('Podcast Metadata Override')); $podcast_album_override->setMultiOptions(array( _("Disabled"), _("Enabled"), )); $podcast_album_override->setValue(Application_Model_Preference::GetPodcastAlbumOverride()); - $podcast_album_override->setDescription(_('Enabling this means that podcast tracks will always contain the podcast name in their album field.')); + $podcast_album_override->setDescription(_('Enabling this means that podcast tracks will get their metadata set from the podcast feed values')); $podcast_album_override->setSeparator(' '); //No
between radio buttons $podcast_album_override->addDecorator('HtmlTag', array('tag' => 'dd', 'id'=>"podcastAlbumOverride-element", diff --git a/airtime_mvc/application/models/airtime/map/CcBlockTableMap.php b/airtime_mvc/application/models/airtime/map/CcBlockTableMap.php index dfc5c95ff..72b72a09a 100644 --- a/airtime_mvc/application/models/airtime/map/CcBlockTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcBlockTableMap.php @@ -46,7 +46,7 @@ class CcBlockTableMap extends TableMap $this->addForeignKey('creator_id', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'id', false, null, null); $this->addColumn('description', 'DbDescription', 'VARCHAR', false, 512, null); $this->addColumn('length', 'DbLength', 'VARCHAR', false, null, '00:00:00'); - $this->addColumn('type', 'DbType', 'VARCHAR', false, 7, 'static'); + $this->addColumn('type', 'DbType', 'VARCHAR', false, 7, 'dynamic'); // validators } // initialize() diff --git a/airtime_mvc/application/models/airtime/map/PodcastEpisodesTableMap.php b/airtime_mvc/application/models/airtime/map/PodcastEpisodesTableMap.php index ef3895069..978cf12a1 100644 --- a/airtime_mvc/application/models/airtime/map/PodcastEpisodesTableMap.php +++ b/airtime_mvc/application/models/airtime/map/PodcastEpisodesTableMap.php @@ -45,6 +45,8 @@ class PodcastEpisodesTableMap extends TableMap $this->addColumn('publication_date', 'DbPublicationDate', 'TIMESTAMP', true, null, null); $this->addColumn('download_url', 'DbDownloadUrl', 'VARCHAR', true, 4096, null); $this->addColumn('episode_guid', 'DbEpisodeGuid', 'VARCHAR', true, 4096, null); + $this->addColumn('episode_title', 'DbEpisodeTitle', 'VARCHAR', true, 4096, null); + $this->addColumn('episode_description', 'DbEpisodeDescription', 'VARCHAR', true, 4096, null); // validators } // initialize() diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php index ec32bc9c8..0729979ab 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php @@ -55,7 +55,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent /** * The value for the trackoffset field. - * Note: this column has a database default value of: 0 + * Note: this column has a database default value of: 0.0 * @var double */ protected $trackoffset; @@ -136,7 +136,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent */ public function applyDefaultValues() { - $this->trackoffset = 0; + $this->trackoffset = 0.0; $this->cliplength = '00:00:00'; $this->cuein = '00:00:00'; $this->cueout = '00:00:00'; @@ -548,7 +548,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent */ public function hasOnlyDefaultValues() { - if ($this->trackoffset !== 0) { + if ($this->trackoffset !== 0.0) { return false; } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php index 1c634b382..b0552a756 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php @@ -74,7 +74,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * The value for the trackoffset field. - * Note: this column has a database default value of: 0 + * Note: this column has a database default value of: 0.0 * @var double */ protected $trackoffset; @@ -161,7 +161,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent public function applyDefaultValues() { $this->type = 0; - $this->trackoffset = 0; + $this->trackoffset = 0.0; $this->cliplength = '00:00:00'; $this->cuein = '00:00:00'; $this->cueout = '00:00:00'; @@ -677,7 +677,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent return false; } - if ($this->trackoffset !== 0) { + if ($this->trackoffset !== 0.0) { return false; } diff --git a/airtime_mvc/application/models/airtime/om/BasePodcastEpisodes.php b/airtime_mvc/application/models/airtime/om/BasePodcastEpisodes.php index e39015230..23e331847 100644 --- a/airtime_mvc/application/models/airtime/om/BasePodcastEpisodes.php +++ b/airtime_mvc/application/models/airtime/om/BasePodcastEpisodes.php @@ -65,6 +65,18 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent */ protected $episode_guid; + /** + * The value for the episode_title field. + * @var string + */ + protected $episode_title; + + /** + * The value for the episode_description field. + * @var string + */ + protected $episode_description; + /** * @var CcFiles */ @@ -185,6 +197,28 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent return $this->episode_guid; } + /** + * Get the [episode_title] column value. + * + * @return string + */ + public function getDbEpisodeTitle() + { + + return $this->episode_title; + } + + /** + * Get the [episode_description] column value. + * + * @return string + */ + public function getDbEpisodeDescription() + { + + return $this->episode_description; + } + /** * Set the value of [id] column. * @@ -321,6 +355,48 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent return $this; } // setDbEpisodeGuid() + /** + * Set the value of [episode_title] column. + * + * @param string $v new value + * @return PodcastEpisodes The current object (for fluent API support) + */ + public function setDbEpisodeTitle($v) + { + if ($v !== null && is_numeric($v)) { + $v = (string) $v; + } + + if ($this->episode_title !== $v) { + $this->episode_title = $v; + $this->modifiedColumns[] = PodcastEpisodesPeer::EPISODE_TITLE; + } + + + return $this; + } // setDbEpisodeTitle() + + /** + * Set the value of [episode_description] column. + * + * @param string $v new value + * @return PodcastEpisodes The current object (for fluent API support) + */ + public function setDbEpisodeDescription($v) + { + if ($v !== null && is_numeric($v)) { + $v = (string) $v; + } + + if ($this->episode_description !== $v) { + $this->episode_description = $v; + $this->modifiedColumns[] = PodcastEpisodesPeer::EPISODE_DESCRIPTION; + } + + + return $this; + } // setDbEpisodeDescription() + /** * Indicates whether the columns in this object are only set to default values. * @@ -359,6 +435,8 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent $this->publication_date = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; $this->download_url = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; $this->episode_guid = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->episode_title = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->episode_description = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; $this->resetModified(); $this->setNew(false); @@ -368,7 +446,7 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent } $this->postHydrate($row, $startcol, $rehydrate); - return $startcol + 6; // 6 = PodcastEpisodesPeer::NUM_HYDRATE_COLUMNS. + return $startcol + 8; // 8 = PodcastEpisodesPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating PodcastEpisodes object", $e); @@ -635,6 +713,12 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent if ($this->isColumnModified(PodcastEpisodesPeer::EPISODE_GUID)) { $modifiedColumns[':p' . $index++] = '"episode_guid"'; } + if ($this->isColumnModified(PodcastEpisodesPeer::EPISODE_TITLE)) { + $modifiedColumns[':p' . $index++] = '"episode_title"'; + } + if ($this->isColumnModified(PodcastEpisodesPeer::EPISODE_DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = '"episode_description"'; + } $sql = sprintf( 'INSERT INTO "podcast_episodes" (%s) VALUES (%s)', @@ -664,6 +748,12 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent case '"episode_guid"': $stmt->bindValue($identifier, $this->episode_guid, PDO::PARAM_STR); break; + case '"episode_title"': + $stmt->bindValue($identifier, $this->episode_title, PDO::PARAM_STR); + break; + case '"episode_description"': + $stmt->bindValue($identifier, $this->episode_description, PDO::PARAM_STR); + break; } } $stmt->execute(); @@ -827,6 +917,12 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent case 5: return $this->getDbEpisodeGuid(); break; + case 6: + return $this->getDbEpisodeTitle(); + break; + case 7: + return $this->getDbEpisodeDescription(); + break; default: return null; break; @@ -862,6 +958,8 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent $keys[3] => $this->getDbPublicationDate(), $keys[4] => $this->getDbDownloadUrl(), $keys[5] => $this->getDbEpisodeGuid(), + $keys[6] => $this->getDbEpisodeTitle(), + $keys[7] => $this->getDbEpisodeDescription(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -927,6 +1025,12 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent case 5: $this->setDbEpisodeGuid($value); break; + case 6: + $this->setDbEpisodeTitle($value); + break; + case 7: + $this->setDbEpisodeDescription($value); + break; } // switch() } @@ -957,6 +1061,8 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent if (array_key_exists($keys[3], $arr)) $this->setDbPublicationDate($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setDbDownloadUrl($arr[$keys[4]]); if (array_key_exists($keys[5], $arr)) $this->setDbEpisodeGuid($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbEpisodeTitle($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDbEpisodeDescription($arr[$keys[7]]); } /** @@ -974,6 +1080,8 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent if ($this->isColumnModified(PodcastEpisodesPeer::PUBLICATION_DATE)) $criteria->add(PodcastEpisodesPeer::PUBLICATION_DATE, $this->publication_date); if ($this->isColumnModified(PodcastEpisodesPeer::DOWNLOAD_URL)) $criteria->add(PodcastEpisodesPeer::DOWNLOAD_URL, $this->download_url); if ($this->isColumnModified(PodcastEpisodesPeer::EPISODE_GUID)) $criteria->add(PodcastEpisodesPeer::EPISODE_GUID, $this->episode_guid); + if ($this->isColumnModified(PodcastEpisodesPeer::EPISODE_TITLE)) $criteria->add(PodcastEpisodesPeer::EPISODE_TITLE, $this->episode_title); + if ($this->isColumnModified(PodcastEpisodesPeer::EPISODE_DESCRIPTION)) $criteria->add(PodcastEpisodesPeer::EPISODE_DESCRIPTION, $this->episode_description); return $criteria; } @@ -1042,6 +1150,8 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent $copyObj->setDbPublicationDate($this->getDbPublicationDate()); $copyObj->setDbDownloadUrl($this->getDbDownloadUrl()); $copyObj->setDbEpisodeGuid($this->getDbEpisodeGuid()); + $copyObj->setDbEpisodeTitle($this->getDbEpisodeTitle()); + $copyObj->setDbEpisodeDescription($this->getDbEpisodeDescription()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -1215,6 +1325,8 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent $this->publication_date = null; $this->download_url = null; $this->episode_guid = null; + $this->episode_title = null; + $this->episode_description = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->alreadyInClearAllReferencesDeep = false; diff --git a/airtime_mvc/application/models/airtime/om/BasePodcastEpisodesPeer.php b/airtime_mvc/application/models/airtime/om/BasePodcastEpisodesPeer.php index 3415c9345..91fcbeee2 100644 --- a/airtime_mvc/application/models/airtime/om/BasePodcastEpisodesPeer.php +++ b/airtime_mvc/application/models/airtime/om/BasePodcastEpisodesPeer.php @@ -24,13 +24,13 @@ abstract class BasePodcastEpisodesPeer const TM_CLASS = 'PodcastEpisodesTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 6; + const NUM_COLUMNS = 8; /** 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 = 6; + const NUM_HYDRATE_COLUMNS = 8; /** the column name for the id field */ const ID = 'podcast_episodes.id'; @@ -50,6 +50,12 @@ abstract class BasePodcastEpisodesPeer /** the column name for the episode_guid field */ const EPISODE_GUID = 'podcast_episodes.episode_guid'; + /** the column name for the episode_title field */ + const EPISODE_TITLE = 'podcast_episodes.episode_title'; + + /** the column name for the episode_description field */ + const EPISODE_DESCRIPTION = 'podcast_episodes.episode_description'; + /** The default string format for model objects of the related table **/ const DEFAULT_STRING_FORMAT = 'YAML'; @@ -69,12 +75,12 @@ abstract class BasePodcastEpisodesPeer * e.g. PodcastEpisodesPeer::$fieldNames[PodcastEpisodesPeer::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbFileId', 'DbPodcastId', 'DbPublicationDate', 'DbDownloadUrl', 'DbEpisodeGuid', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFileId', 'dbPodcastId', 'dbPublicationDate', 'dbDownloadUrl', 'dbEpisodeGuid', ), - BasePeer::TYPE_COLNAME => array (PodcastEpisodesPeer::ID, PodcastEpisodesPeer::FILE_ID, PodcastEpisodesPeer::PODCAST_ID, PodcastEpisodesPeer::PUBLICATION_DATE, PodcastEpisodesPeer::DOWNLOAD_URL, PodcastEpisodesPeer::EPISODE_GUID, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FILE_ID', 'PODCAST_ID', 'PUBLICATION_DATE', 'DOWNLOAD_URL', 'EPISODE_GUID', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'file_id', 'podcast_id', 'publication_date', 'download_url', 'episode_guid', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbFileId', 'DbPodcastId', 'DbPublicationDate', 'DbDownloadUrl', 'DbEpisodeGuid', 'DbEpisodeTitle', 'DbEpisodeDescription', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFileId', 'dbPodcastId', 'dbPublicationDate', 'dbDownloadUrl', 'dbEpisodeGuid', 'dbEpisodeTitle', 'dbEpisodeDescription', ), + BasePeer::TYPE_COLNAME => array (PodcastEpisodesPeer::ID, PodcastEpisodesPeer::FILE_ID, PodcastEpisodesPeer::PODCAST_ID, PodcastEpisodesPeer::PUBLICATION_DATE, PodcastEpisodesPeer::DOWNLOAD_URL, PodcastEpisodesPeer::EPISODE_GUID, PodcastEpisodesPeer::EPISODE_TITLE, PodcastEpisodesPeer::EPISODE_DESCRIPTION, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FILE_ID', 'PODCAST_ID', 'PUBLICATION_DATE', 'DOWNLOAD_URL', 'EPISODE_GUID', 'EPISODE_TITLE', 'EPISODE_DESCRIPTION', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'file_id', 'podcast_id', 'publication_date', 'download_url', 'episode_guid', 'episode_title', 'episode_description', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -84,12 +90,12 @@ abstract class BasePodcastEpisodesPeer * e.g. PodcastEpisodesPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFileId' => 1, 'DbPodcastId' => 2, 'DbPublicationDate' => 3, 'DbDownloadUrl' => 4, 'DbEpisodeGuid' => 5, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFileId' => 1, 'dbPodcastId' => 2, 'dbPublicationDate' => 3, 'dbDownloadUrl' => 4, 'dbEpisodeGuid' => 5, ), - BasePeer::TYPE_COLNAME => array (PodcastEpisodesPeer::ID => 0, PodcastEpisodesPeer::FILE_ID => 1, PodcastEpisodesPeer::PODCAST_ID => 2, PodcastEpisodesPeer::PUBLICATION_DATE => 3, PodcastEpisodesPeer::DOWNLOAD_URL => 4, PodcastEpisodesPeer::EPISODE_GUID => 5, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FILE_ID' => 1, 'PODCAST_ID' => 2, 'PUBLICATION_DATE' => 3, 'DOWNLOAD_URL' => 4, 'EPISODE_GUID' => 5, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'file_id' => 1, 'podcast_id' => 2, 'publication_date' => 3, 'download_url' => 4, 'episode_guid' => 5, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFileId' => 1, 'DbPodcastId' => 2, 'DbPublicationDate' => 3, 'DbDownloadUrl' => 4, 'DbEpisodeGuid' => 5, 'DbEpisodeTitle' => 6, 'DbEpisodeDescription' => 7, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFileId' => 1, 'dbPodcastId' => 2, 'dbPublicationDate' => 3, 'dbDownloadUrl' => 4, 'dbEpisodeGuid' => 5, 'dbEpisodeTitle' => 6, 'dbEpisodeDescription' => 7, ), + BasePeer::TYPE_COLNAME => array (PodcastEpisodesPeer::ID => 0, PodcastEpisodesPeer::FILE_ID => 1, PodcastEpisodesPeer::PODCAST_ID => 2, PodcastEpisodesPeer::PUBLICATION_DATE => 3, PodcastEpisodesPeer::DOWNLOAD_URL => 4, PodcastEpisodesPeer::EPISODE_GUID => 5, PodcastEpisodesPeer::EPISODE_TITLE => 6, PodcastEpisodesPeer::EPISODE_DESCRIPTION => 7, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FILE_ID' => 1, 'PODCAST_ID' => 2, 'PUBLICATION_DATE' => 3, 'DOWNLOAD_URL' => 4, 'EPISODE_GUID' => 5, 'EPISODE_TITLE' => 6, 'EPISODE_DESCRIPTION' => 7, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'file_id' => 1, 'podcast_id' => 2, 'publication_date' => 3, 'download_url' => 4, 'episode_guid' => 5, 'episode_title' => 6, 'episode_description' => 7, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -169,6 +175,8 @@ abstract class BasePodcastEpisodesPeer $criteria->addSelectColumn(PodcastEpisodesPeer::PUBLICATION_DATE); $criteria->addSelectColumn(PodcastEpisodesPeer::DOWNLOAD_URL); $criteria->addSelectColumn(PodcastEpisodesPeer::EPISODE_GUID); + $criteria->addSelectColumn(PodcastEpisodesPeer::EPISODE_TITLE); + $criteria->addSelectColumn(PodcastEpisodesPeer::EPISODE_DESCRIPTION); } else { $criteria->addSelectColumn($alias . '.id'); $criteria->addSelectColumn($alias . '.file_id'); @@ -176,6 +184,8 @@ abstract class BasePodcastEpisodesPeer $criteria->addSelectColumn($alias . '.publication_date'); $criteria->addSelectColumn($alias . '.download_url'); $criteria->addSelectColumn($alias . '.episode_guid'); + $criteria->addSelectColumn($alias . '.episode_title'); + $criteria->addSelectColumn($alias . '.episode_description'); } } diff --git a/airtime_mvc/application/models/airtime/om/BasePodcastEpisodesQuery.php b/airtime_mvc/application/models/airtime/om/BasePodcastEpisodesQuery.php index fbf44a00f..f96d61b8d 100644 --- a/airtime_mvc/application/models/airtime/om/BasePodcastEpisodesQuery.php +++ b/airtime_mvc/application/models/airtime/om/BasePodcastEpisodesQuery.php @@ -12,6 +12,8 @@ * @method PodcastEpisodesQuery orderByDbPublicationDate($order = Criteria::ASC) Order by the publication_date column * @method PodcastEpisodesQuery orderByDbDownloadUrl($order = Criteria::ASC) Order by the download_url column * @method PodcastEpisodesQuery orderByDbEpisodeGuid($order = Criteria::ASC) Order by the episode_guid column + * @method PodcastEpisodesQuery orderByDbEpisodeTitle($order = Criteria::ASC) Order by the episode_title column + * @method PodcastEpisodesQuery orderByDbEpisodeDescription($order = Criteria::ASC) Order by the episode_description column * * @method PodcastEpisodesQuery groupByDbId() Group by the id column * @method PodcastEpisodesQuery groupByDbFileId() Group by the file_id column @@ -19,6 +21,8 @@ * @method PodcastEpisodesQuery groupByDbPublicationDate() Group by the publication_date column * @method PodcastEpisodesQuery groupByDbDownloadUrl() Group by the download_url column * @method PodcastEpisodesQuery groupByDbEpisodeGuid() Group by the episode_guid column + * @method PodcastEpisodesQuery groupByDbEpisodeTitle() Group by the episode_title column + * @method PodcastEpisodesQuery groupByDbEpisodeDescription() Group by the episode_description column * * @method PodcastEpisodesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method PodcastEpisodesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -40,6 +44,8 @@ * @method PodcastEpisodes findOneByDbPublicationDate(string $publication_date) Return the first PodcastEpisodes filtered by the publication_date column * @method PodcastEpisodes findOneByDbDownloadUrl(string $download_url) Return the first PodcastEpisodes filtered by the download_url column * @method PodcastEpisodes findOneByDbEpisodeGuid(string $episode_guid) Return the first PodcastEpisodes filtered by the episode_guid column + * @method PodcastEpisodes findOneByDbEpisodeTitle(string $episode_title) Return the first PodcastEpisodes filtered by the episode_title column + * @method PodcastEpisodes findOneByDbEpisodeDescription(string $episode_description) Return the first PodcastEpisodes filtered by the episode_description column * * @method array findByDbId(int $id) Return PodcastEpisodes objects filtered by the id column * @method array findByDbFileId(int $file_id) Return PodcastEpisodes objects filtered by the file_id column @@ -47,6 +53,8 @@ * @method array findByDbPublicationDate(string $publication_date) Return PodcastEpisodes objects filtered by the publication_date column * @method array findByDbDownloadUrl(string $download_url) Return PodcastEpisodes objects filtered by the download_url column * @method array findByDbEpisodeGuid(string $episode_guid) Return PodcastEpisodes objects filtered by the episode_guid column + * @method array findByDbEpisodeTitle(string $episode_title) Return PodcastEpisodes objects filtered by the episode_title column + * @method array findByDbEpisodeDescription(string $episode_description) Return PodcastEpisodes objects filtered by the episode_description column * * @package propel.generator.airtime.om */ @@ -154,7 +162,7 @@ abstract class BasePodcastEpisodesQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT "id", "file_id", "podcast_id", "publication_date", "download_url", "episode_guid" FROM "podcast_episodes" WHERE "id" = :p0'; + $sql = 'SELECT "id", "file_id", "podcast_id", "publication_date", "download_url", "episode_guid", "episode_title", "episode_description" FROM "podcast_episodes" WHERE "id" = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -474,6 +482,64 @@ abstract class BasePodcastEpisodesQuery extends ModelCriteria return $this->addUsingAlias(PodcastEpisodesPeer::EPISODE_GUID, $dbEpisodeGuid, $comparison); } + /** + * Filter the query on the episode_title column + * + * Example usage: + * + * $query->filterByDbEpisodeTitle('fooValue'); // WHERE episode_title = 'fooValue' + * $query->filterByDbEpisodeTitle('%fooValue%'); // WHERE episode_title LIKE '%fooValue%' + * + * + * @param string $dbEpisodeTitle The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return PodcastEpisodesQuery The current query, for fluid interface + */ + public function filterByDbEpisodeTitle($dbEpisodeTitle = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbEpisodeTitle)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbEpisodeTitle)) { + $dbEpisodeTitle = str_replace('*', '%', $dbEpisodeTitle); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(PodcastEpisodesPeer::EPISODE_TITLE, $dbEpisodeTitle, $comparison); + } + + /** + * Filter the query on the episode_description column + * + * Example usage: + * + * $query->filterByDbEpisodeDescription('fooValue'); // WHERE episode_description = 'fooValue' + * $query->filterByDbEpisodeDescription('%fooValue%'); // WHERE episode_description LIKE '%fooValue%' + * + * + * @param string $dbEpisodeDescription The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return PodcastEpisodesQuery The current query, for fluid interface + */ + public function filterByDbEpisodeDescription($dbEpisodeDescription = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbEpisodeDescription)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbEpisodeDescription)) { + $dbEpisodeDescription = str_replace('*', '%', $dbEpisodeDescription); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(PodcastEpisodesPeer::EPISODE_DESCRIPTION, $dbEpisodeDescription, $comparison); + } + /** * Filter the query by a related CcFiles object * diff --git a/airtime_mvc/application/services/PodcastEpisodeService.php b/airtime_mvc/application/services/PodcastEpisodeService.php index 124290ac2..a607b8d08 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->_getAlbumOverride($p)); + $this->_download($e->getDbId(), $e->getDbDownloadUrl(), $p->getDbTitle(), $this->_getAlbumOverride($p), $episode["title"]); return $e; } @@ -93,7 +93,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir // feed object, or whether it's passed in as json $enclosure = $episode["enclosure"]; $url = $enclosure instanceof SimplePie_Enclosure ? $enclosure->get_link() : $enclosure["link"]; - return $this->_buildEpisode($podcastId, $url, $episode["guid"], $episode["pub_date"]); + return $this->_buildEpisode($podcastId, $url, $episode["guid"], $episode["pub_date"], $episode["title"], $episode["description"]); } /** @@ -103,18 +103,22 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir * @param string $url the download URL for the episode * @param string $guid the unique id for the episode. Often the same as the download URL * @param string $publicationDate the publication date of the episode + * @param string $title the title of the episode + * @param string $description the description of the epsiode * * @return PodcastEpisodes the newly created PodcastEpisodes object * * @throws Exception * @throws PropelException */ - private function _buildEpisode($podcastId, $url, $guid, $publicationDate) { + private function _buildEpisode($podcastId, $url, $guid, $publicationDate, $title, $description) { $e = new PodcastEpisodes(); $e->setDbPodcastId($podcastId); $e->setDbDownloadUrl($url); $e->setDbEpisodeGuid($guid); $e->setDbPublicationDate($publicationDate); + $e->setDbEpisodeTitle($title); + $e->setDbEpisodeDescription($description); $e->save(); return $e; } @@ -128,7 +132,8 @@ 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->_getAlbumOverride($podcast)); + Logging::info($episode); + $this->_download($episode->getDbId(), $episode->getDbDownloadUrl(), $podcast->getDbTitle(), $this->_getAlbumOverride($podcast), $episode->getDbEpisodeTitle()); } } @@ -158,7 +163,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir * @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, $album_override) { + private function _download($id, $url, $title, $album_override, $track_title = null) { $CC_CONFIG = Config::getConfig(); $stationUrl = Application_Common_HTTPHelper::getStationUrl(); $stationUrl .= substr($stationUrl, -1) == '/' ? '' : '/'; @@ -169,7 +174,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir 'api_key' => $CC_CONFIG["apiKey"][0], 'podcast_name' => $title, 'album_override' => $album_override, - ); + 'track_title' => $track_title); $task = $this->_executeTask(static::$_CELERY_TASKS[self::DOWNLOAD], $data); // Get the created ThirdPartyTaskReference and set the episode ID so // we can remove the placeholder if the import ends up stuck in a pending state diff --git a/airtime_mvc/application/views/scripts/podcast/podcast.phtml b/airtime_mvc/application/views/scripts/podcast/podcast.phtml index 9342636f2..f2b7b57e0 100644 --- a/airtime_mvc/application/views/scripts/podcast/podcast.phtml +++ b/airtime_mvc/application/views/scripts/podcast/podcast.phtml @@ -26,7 +26,7 @@
- +
diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 7c46ce495..ecb538a63 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -281,7 +281,7 @@ - + @@ -623,6 +623,9 @@ + + + diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index aae02129e..a158db43a 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -780,6 +780,8 @@ CREATE TABLE "podcast_episodes" "publication_date" TIMESTAMP NOT NULL, "download_url" VARCHAR(4096) NOT NULL, "episode_guid" VARCHAR(4096) NOT NULL, + "episode_title" VARCHAR(4096) NOT NULL, + "episode_description" VARCHAR(4096) NOT NULL, PRIMARY KEY ("id") ); diff --git a/airtime_mvc/public/js/airtime/library/podcast.js b/airtime_mvc/public/js/airtime/library/podcast.js index c7ce2c548..99805f1bc 100644 --- a/airtime_mvc/public/js/airtime/library/podcast.js +++ b/airtime_mvc/public/js/airtime/library/podcast.js @@ -329,7 +329,7 @@ var AIRTIME = (function (AIRTIME) { $(".album_names.help_icon").qtip({ content: { - text: $.i18n._('Overwrite downloaded podcast episodes\' "Album" metadata tag with the Podcast Name specified above. This album name can then be used as a search criteria by a smartblock.') + text: $.i18n._('Overwrite downloaded podcast episodes\' "Album" and "Creator" metadata tag with the Podcast Name specified above and set the track title to the title of the Podcast Episode. This album name can then be used as a search criteria by a smartblock. ') }, hide: { delay: 500, diff --git a/python_apps/airtime-celery/airtime-celery/tasks.py b/python_apps/airtime-celery/airtime-celery/tasks.py index 4a203cbf0..bedc6efa7 100644 --- a/python_apps/airtime-celery/airtime-celery/tasks.py +++ b/python_apps/airtime-celery/airtime-celery/tasks.py @@ -128,7 +128,7 @@ def soundcloud_delete(token, track_id): @celery.task(name='podcast-download', acks_late=True) -def podcast_download(id, url, callback_url, api_key, podcast_name, album_override): +def podcast_download(id, url, callback_url, api_key, podcast_name, album_override, track_title): """ Download a podcast episode @@ -138,6 +138,7 @@ def podcast_download(id, url, callback_url, api_key, podcast_name, album_overrid :param api_key: API key for callback authentication :param podcast_name: Name of podcast to be added to id3 metadata for smartblock :param album_override: Passing whether to override the album id3 even if it exists + :param track_title: Passing the title of the episode from feed to override the metadata :return: JSON formatted string of a dictionary of download statuses and file identifiers (for successful uploads) @@ -162,8 +163,9 @@ def podcast_download(id, url, callback_url, api_key, podcast_name, album_overrid # so we treat it like a mp3 if it has a mp3 file extension and hope for the best if filename.endswith(mp3suffix): metadata_audiofile = mutagen.mp3.MP3(audiofile.name, ID3=mutagen.easyid3.EasyID3) - #replace album title as needed - metadata_audiofile = podcast_override_album(metadata_audiofile, podcast_name, album_override) + #replace track metadata as indicated by album_override setting + # replace album title as needed + metadata_audiofile = podcast_override_metadata(metadata_audiofile, podcast_name, album_override, track_title) metadata_audiofile.save() filetypeinfo = metadata_audiofile.pprint() logger.info('filetypeinfo is {0}'.format(filetypeinfo.encode('ascii', 'ignore'))) @@ -179,7 +181,7 @@ def podcast_download(id, url, callback_url, api_key, podcast_name, album_overrid obj['status'] = 0 return json.dumps(obj) -def podcast_override_album(m, podcast_name, override): +def podcast_override_metadata(m, podcast_name, override, track_title): """ Override m['album'] if empty or forced with override arg """ @@ -187,6 +189,8 @@ def podcast_override_album(m, podcast_name, override): if override is True: logger.debug('overriding album name to {0} in podcast'.format(podcast_name.encode('ascii', 'ignore'))) m['album'] = podcast_name + m['title'] = track_title + m['artist'] = podcast_name else: # replace the album id3 tag with the podcast name if the album tag is empty try: