Merge pull request #659 from Robbt/podcast-metadata-override

added track title and artist override for podcasts
This commit is contained in:
frecuencialibre 2019-01-21 14:09:39 -06:00 committed by GitHub
commit c26e15fd70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 247 additions and 39 deletions

View File

@ -101,4 +101,4 @@ class PodcastManager {
return (strtotime($a["pub_date"]) < strtotime($b["pub_date"])) ? 1 : -1; // Descending order return (strtotime($a["pub_date"]) < strtotime($b["pub_date"])) ? 1 : -1; // Descending order
} }
} }

View File

@ -0,0 +1,2 @@
ALTER TABLE podcast_episodes DROP COLUMN IF EXISTS episode_title;
ALTER TABLE podcast_episodes DROP COLUMN IF EXISTS episode_description;

View File

@ -0,0 +1,2 @@
ALTER TABLE podcast_episodes ADD COLUMN episode_title VARCHAR(4096);
ALTER TABLE podcast_episodes ADD COLUMN episode_description VARCHAR(4096);

View File

@ -102,13 +102,13 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$podcast_album_override = new Zend_Form_Element_Radio('podcastAlbumOverride'); $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( $podcast_album_override->setMultiOptions(array(
_("Disabled"), _("Disabled"),
_("Enabled"), _("Enabled"),
)); ));
$podcast_album_override->setValue(Application_Model_Preference::GetPodcastAlbumOverride()); $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 <br> between radio buttons $podcast_album_override->setSeparator(' '); //No <br> between radio buttons
$podcast_album_override->addDecorator('HtmlTag', array('tag' => 'dd', $podcast_album_override->addDecorator('HtmlTag', array('tag' => 'dd',
'id'=>"podcastAlbumOverride-element", 'id'=>"podcastAlbumOverride-element",

View File

@ -46,7 +46,7 @@ class CcBlockTableMap extends TableMap
$this->addForeignKey('creator_id', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'id', false, null, null); $this->addForeignKey('creator_id', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'id', false, null, null);
$this->addColumn('description', 'DbDescription', 'VARCHAR', false, 512, null); $this->addColumn('description', 'DbDescription', 'VARCHAR', false, 512, null);
$this->addColumn('length', 'DbLength', 'VARCHAR', false, null, '00:00:00'); $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 // validators
} // initialize() } // initialize()

View File

@ -45,6 +45,8 @@ class PodcastEpisodesTableMap extends TableMap
$this->addColumn('publication_date', 'DbPublicationDate', 'TIMESTAMP', true, null, null); $this->addColumn('publication_date', 'DbPublicationDate', 'TIMESTAMP', true, null, null);
$this->addColumn('download_url', 'DbDownloadUrl', 'VARCHAR', true, 4096, null); $this->addColumn('download_url', 'DbDownloadUrl', 'VARCHAR', true, 4096, null);
$this->addColumn('episode_guid', 'DbEpisodeGuid', '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 // validators
} // initialize() } // initialize()

View File

@ -55,7 +55,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent
/** /**
* The value for the trackoffset field. * 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 * @var double
*/ */
protected $trackoffset; protected $trackoffset;
@ -136,7 +136,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent
*/ */
public function applyDefaultValues() public function applyDefaultValues()
{ {
$this->trackoffset = 0; $this->trackoffset = 0.0;
$this->cliplength = '00:00:00'; $this->cliplength = '00:00:00';
$this->cuein = '00:00:00'; $this->cuein = '00:00:00';
$this->cueout = '00:00:00'; $this->cueout = '00:00:00';
@ -548,7 +548,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent
*/ */
public function hasOnlyDefaultValues() public function hasOnlyDefaultValues()
{ {
if ($this->trackoffset !== 0) { if ($this->trackoffset !== 0.0) {
return false; return false;
} }

View File

@ -74,7 +74,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/** /**
* The value for the trackoffset field. * 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 * @var double
*/ */
protected $trackoffset; protected $trackoffset;
@ -161,7 +161,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
public function applyDefaultValues() public function applyDefaultValues()
{ {
$this->type = 0; $this->type = 0;
$this->trackoffset = 0; $this->trackoffset = 0.0;
$this->cliplength = '00:00:00'; $this->cliplength = '00:00:00';
$this->cuein = '00:00:00'; $this->cuein = '00:00:00';
$this->cueout = '00:00:00'; $this->cueout = '00:00:00';
@ -677,7 +677,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
return false; return false;
} }
if ($this->trackoffset !== 0) { if ($this->trackoffset !== 0.0) {
return false; return false;
} }

View File

@ -65,6 +65,18 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent
*/ */
protected $episode_guid; 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 * @var CcFiles
*/ */
@ -185,6 +197,28 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent
return $this->episode_guid; 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. * Set the value of [id] column.
* *
@ -321,6 +355,48 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent
return $this; return $this;
} // setDbEpisodeGuid() } // 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. * 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->publication_date = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->download_url = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : 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_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->resetModified();
$this->setNew(false); $this->setNew(false);
@ -368,7 +446,7 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent
} }
$this->postHydrate($row, $startcol, $rehydrate); $this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 6; // 6 = PodcastEpisodesPeer::NUM_HYDRATE_COLUMNS. return $startcol + 8; // 8 = PodcastEpisodesPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating PodcastEpisodes object", $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)) { if ($this->isColumnModified(PodcastEpisodesPeer::EPISODE_GUID)) {
$modifiedColumns[':p' . $index++] = '"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( $sql = sprintf(
'INSERT INTO "podcast_episodes" (%s) VALUES (%s)', 'INSERT INTO "podcast_episodes" (%s) VALUES (%s)',
@ -664,6 +748,12 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent
case '"episode_guid"': case '"episode_guid"':
$stmt->bindValue($identifier, $this->episode_guid, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->episode_guid, PDO::PARAM_STR);
break; 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(); $stmt->execute();
@ -827,6 +917,12 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent
case 5: case 5:
return $this->getDbEpisodeGuid(); return $this->getDbEpisodeGuid();
break; break;
case 6:
return $this->getDbEpisodeTitle();
break;
case 7:
return $this->getDbEpisodeDescription();
break;
default: default:
return null; return null;
break; break;
@ -862,6 +958,8 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent
$keys[3] => $this->getDbPublicationDate(), $keys[3] => $this->getDbPublicationDate(),
$keys[4] => $this->getDbDownloadUrl(), $keys[4] => $this->getDbDownloadUrl(),
$keys[5] => $this->getDbEpisodeGuid(), $keys[5] => $this->getDbEpisodeGuid(),
$keys[6] => $this->getDbEpisodeTitle(),
$keys[7] => $this->getDbEpisodeDescription(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@ -927,6 +1025,12 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent
case 5: case 5:
$this->setDbEpisodeGuid($value); $this->setDbEpisodeGuid($value);
break; break;
case 6:
$this->setDbEpisodeTitle($value);
break;
case 7:
$this->setDbEpisodeDescription($value);
break;
} // switch() } // 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[3], $arr)) $this->setDbPublicationDate($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbDownloadUrl($arr[$keys[4]]); 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[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::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::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_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; return $criteria;
} }
@ -1042,6 +1150,8 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent
$copyObj->setDbPublicationDate($this->getDbPublicationDate()); $copyObj->setDbPublicationDate($this->getDbPublicationDate());
$copyObj->setDbDownloadUrl($this->getDbDownloadUrl()); $copyObj->setDbDownloadUrl($this->getDbDownloadUrl());
$copyObj->setDbEpisodeGuid($this->getDbEpisodeGuid()); $copyObj->setDbEpisodeGuid($this->getDbEpisodeGuid());
$copyObj->setDbEpisodeTitle($this->getDbEpisodeTitle());
$copyObj->setDbEpisodeDescription($this->getDbEpisodeDescription());
if ($deepCopy && !$this->startCopy) { if ($deepCopy && !$this->startCopy) {
// important: temporarily setNew(false) because this affects the behavior of // important: temporarily setNew(false) because this affects the behavior of
@ -1215,6 +1325,8 @@ abstract class BasePodcastEpisodes extends BaseObject implements Persistent
$this->publication_date = null; $this->publication_date = null;
$this->download_url = null; $this->download_url = null;
$this->episode_guid = null; $this->episode_guid = null;
$this->episode_title = null;
$this->episode_description = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->alreadyInValidation = false; $this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false; $this->alreadyInClearAllReferencesDeep = false;

View File

@ -24,13 +24,13 @@ abstract class BasePodcastEpisodesPeer
const TM_CLASS = 'PodcastEpisodesTableMap'; const TM_CLASS = 'PodcastEpisodesTableMap';
/** The total number of columns. */ /** The total number of columns. */
const NUM_COLUMNS = 6; const NUM_COLUMNS = 8;
/** 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 = 6; const NUM_HYDRATE_COLUMNS = 8;
/** the column name for the id field */ /** the column name for the id field */
const ID = 'podcast_episodes.id'; const ID = 'podcast_episodes.id';
@ -50,6 +50,12 @@ abstract class BasePodcastEpisodesPeer
/** the column name for the episode_guid field */ /** the column name for the episode_guid field */
const EPISODE_GUID = 'podcast_episodes.episode_guid'; 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 **/ /** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML'; const DEFAULT_STRING_FORMAT = 'YAML';
@ -69,12 +75,12 @@ abstract class BasePodcastEpisodesPeer
* e.g. PodcastEpisodesPeer::$fieldNames[PodcastEpisodesPeer::TYPE_PHPNAME][0] = 'Id' * e.g. PodcastEpisodesPeer::$fieldNames[PodcastEpisodesPeer::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbFileId', 'DbPodcastId', 'DbPublicationDate', 'DbDownloadUrl', 'DbEpisodeGuid', ), BasePeer::TYPE_PHPNAME => array ('DbId', 'DbFileId', 'DbPodcastId', 'DbPublicationDate', 'DbDownloadUrl', 'DbEpisodeGuid', 'DbEpisodeTitle', 'DbEpisodeDescription', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFileId', 'dbPodcastId', 'dbPublicationDate', 'dbDownloadUrl', 'dbEpisodeGuid', ), 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, ), 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', ), 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', ), 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, ) 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 * e.g. PodcastEpisodesPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFileId' => 1, 'DbPodcastId' => 2, 'DbPublicationDate' => 3, 'DbDownloadUrl' => 4, 'DbEpisodeGuid' => 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, ), 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, ), 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, ), 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, ), 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, ) 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::PUBLICATION_DATE);
$criteria->addSelectColumn(PodcastEpisodesPeer::DOWNLOAD_URL); $criteria->addSelectColumn(PodcastEpisodesPeer::DOWNLOAD_URL);
$criteria->addSelectColumn(PodcastEpisodesPeer::EPISODE_GUID); $criteria->addSelectColumn(PodcastEpisodesPeer::EPISODE_GUID);
$criteria->addSelectColumn(PodcastEpisodesPeer::EPISODE_TITLE);
$criteria->addSelectColumn(PodcastEpisodesPeer::EPISODE_DESCRIPTION);
} else { } else {
$criteria->addSelectColumn($alias . '.id'); $criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.file_id'); $criteria->addSelectColumn($alias . '.file_id');
@ -176,6 +184,8 @@ abstract class BasePodcastEpisodesPeer
$criteria->addSelectColumn($alias . '.publication_date'); $criteria->addSelectColumn($alias . '.publication_date');
$criteria->addSelectColumn($alias . '.download_url'); $criteria->addSelectColumn($alias . '.download_url');
$criteria->addSelectColumn($alias . '.episode_guid'); $criteria->addSelectColumn($alias . '.episode_guid');
$criteria->addSelectColumn($alias . '.episode_title');
$criteria->addSelectColumn($alias . '.episode_description');
} }
} }

View File

@ -12,6 +12,8 @@
* @method PodcastEpisodesQuery orderByDbPublicationDate($order = Criteria::ASC) Order by the publication_date column * @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 orderByDbDownloadUrl($order = Criteria::ASC) Order by the download_url column
* @method PodcastEpisodesQuery orderByDbEpisodeGuid($order = Criteria::ASC) Order by the episode_guid 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 groupByDbId() Group by the id column
* @method PodcastEpisodesQuery groupByDbFileId() Group by the file_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 groupByDbPublicationDate() Group by the publication_date column
* @method PodcastEpisodesQuery groupByDbDownloadUrl() Group by the download_url column * @method PodcastEpisodesQuery groupByDbDownloadUrl() Group by the download_url column
* @method PodcastEpisodesQuery groupByDbEpisodeGuid() Group by the episode_guid 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 leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method PodcastEpisodesQuery rightJoin($relation) Adds a RIGHT 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 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 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 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 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 * @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 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 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 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 * @package propel.generator.airtime.om
*/ */
@ -154,7 +162,7 @@ abstract class BasePodcastEpisodesQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) 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 { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@ -474,6 +482,64 @@ abstract class BasePodcastEpisodesQuery extends ModelCriteria
return $this->addUsingAlias(PodcastEpisodesPeer::EPISODE_GUID, $dbEpisodeGuid, $comparison); return $this->addUsingAlias(PodcastEpisodesPeer::EPISODE_GUID, $dbEpisodeGuid, $comparison);
} }
/**
* Filter the query on the episode_title column
*
* Example usage:
* <code>
* $query->filterByDbEpisodeTitle('fooValue'); // WHERE episode_title = 'fooValue'
* $query->filterByDbEpisodeTitle('%fooValue%'); // WHERE episode_title LIKE '%fooValue%'
* </code>
*
* @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:
* <code>
* $query->filterByDbEpisodeDescription('fooValue'); // WHERE episode_description = 'fooValue'
* $query->filterByDbEpisodeDescription('%fooValue%'); // WHERE episode_description LIKE '%fooValue%'
* </code>
*
* @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 * Filter the query by a related CcFiles object
* *

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->_getAlbumOverride($p)); $this->_download($e->getDbId(), $e->getDbDownloadUrl(), $p->getDbTitle(), $this->_getAlbumOverride($p), $episode["title"]);
return $e; return $e;
} }
@ -93,7 +93,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
// feed object, or whether it's passed in as json // feed object, or whether it's passed in as json
$enclosure = $episode["enclosure"]; $enclosure = $episode["enclosure"];
$url = $enclosure instanceof SimplePie_Enclosure ? $enclosure->get_link() : $enclosure["link"]; $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 $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 $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 $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 * @return PodcastEpisodes the newly created PodcastEpisodes object
* *
* @throws Exception * @throws Exception
* @throws PropelException * @throws PropelException
*/ */
private function _buildEpisode($podcastId, $url, $guid, $publicationDate) { private function _buildEpisode($podcastId, $url, $guid, $publicationDate, $title, $description) {
$e = new PodcastEpisodes(); $e = new PodcastEpisodes();
$e->setDbPodcastId($podcastId); $e->setDbPodcastId($podcastId);
$e->setDbDownloadUrl($url); $e->setDbDownloadUrl($url);
$e->setDbEpisodeGuid($guid); $e->setDbEpisodeGuid($guid);
$e->setDbPublicationDate($publicationDate); $e->setDbPublicationDate($publicationDate);
$e->setDbEpisodeTitle($title);
$e->setDbEpisodeDescription($description);
$e->save(); $e->save();
return $e; return $e;
} }
@ -128,7 +132,8 @@ 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->_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 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 * @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(); $CC_CONFIG = Config::getConfig();
$stationUrl = Application_Common_HTTPHelper::getStationUrl(); $stationUrl = Application_Common_HTTPHelper::getStationUrl();
$stationUrl .= substr($stationUrl, -1) == '/' ? '' : '/'; $stationUrl .= substr($stationUrl, -1) == '/' ? '' : '/';
@ -169,7 +174,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
'api_key' => $CC_CONFIG["apiKey"][0], 'api_key' => $CC_CONFIG["apiKey"][0],
'podcast_name' => $title, 'podcast_name' => $title,
'album_override' => $album_override, 'album_override' => $album_override,
); 'track_title' => $track_title);
$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
// we can remove the placeholder if the import ends up stuck in a pending state // we can remove the placeholder if the import ends up stuck in a pending state

View File

@ -26,7 +26,7 @@
<input name="podcast_album_override" id="podcast_album_override" ng-model="podcast.album_override" type="checkbox" /> <input name="podcast_album_override" id="podcast_album_override" ng-model="podcast.album_override" type="checkbox" />
</div> </div>
<div> <div>
<label for="podcast_album_override"><?php echo _("Overwrite episode album names"); ?></label> <span class='album_names help_icon'></span> <label for="podcast_album_override"><?php echo _("Overwrite episode track metadata"); ?></label> <span class='album_names help_icon'></span>
</div> </div>
</div> </div>
<div class="podcast-metadata-row" > <div class="podcast-metadata-row" >

View File

@ -281,7 +281,7 @@
<column name="creator_id" phpName="DbCreatorId" type="INTEGER" required="false"/> <column name="creator_id" phpName="DbCreatorId" type="INTEGER" required="false"/>
<column name="description" phpName="DbDescription" type="VARCHAR" size="512" required="false"/> <column name="description" phpName="DbDescription" type="VARCHAR" size="512" required="false"/>
<column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" defaultValue="00:00:00"/> <column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" defaultValue="00:00:00"/>
<column name="type" phpName="DbType" type="VARCHAR" size="7" defaultValue="static"/> <column name="type" phpName="DbType" type="VARCHAR" size="7" defaultValue="dynamic"/>
<behavior name="aggregate_column"> <behavior name="aggregate_column">
<parameter name="name" value="length" /> <parameter name="name" value="length" />
<parameter name="foreign_table" value="cc_blockcontents" /> <parameter name="foreign_table" value="cc_blockcontents" />
@ -623,6 +623,9 @@
<column name="publication_date" phpName="DbPublicationDate" type="TIMESTAMP" required="true" /> <column name="publication_date" phpName="DbPublicationDate" type="TIMESTAMP" required="true" />
<column name="download_url" phpName="DbDownloadUrl" type="varchar" size="4096" required="true" /> <column name="download_url" phpName="DbDownloadUrl" type="varchar" size="4096" required="true" />
<column name="episode_guid" phpName="DbEpisodeGuid" type="varchar" size="4096" required="true" /> <column name="episode_guid" phpName="DbEpisodeGuid" type="varchar" size="4096" required="true" />
<column name="episode_title" phpName="DbEpisodeTitle" type="varchar" size="4096" required="true" />
<column name="episode_description" phpName="DbEpisodeDescription" type="varchar" size="4096" required="true" />
<foreign-key foreignTable="cc_files" name="podcast_episodes_cc_files_fkey" onDelete="CASCADE"> <foreign-key foreignTable="cc_files" name="podcast_episodes_cc_files_fkey" onDelete="CASCADE">
<reference local="file_id" foreign="id" /> <reference local="file_id" foreign="id" />
</foreign-key> </foreign-key>

View File

@ -780,6 +780,8 @@ CREATE TABLE "podcast_episodes"
"publication_date" TIMESTAMP NOT NULL, "publication_date" TIMESTAMP NOT NULL,
"download_url" VARCHAR(4096) NOT NULL, "download_url" VARCHAR(4096) NOT NULL,
"episode_guid" 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") PRIMARY KEY ("id")
); );

View File

@ -329,7 +329,7 @@ var AIRTIME = (function (AIRTIME) {
$(".album_names.help_icon").qtip({ $(".album_names.help_icon").qtip({
content: { 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: { hide: {
delay: 500, delay: 500,

View File

@ -128,7 +128,7 @@ def soundcloud_delete(token, track_id):
@celery.task(name='podcast-download', acks_late=True) @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 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 api_key: API key for callback authentication
:param podcast_name: Name of podcast to be added to id3 metadata for smartblock :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 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 :return: JSON formatted string of a dictionary of download statuses
and file identifiers (for successful uploads) 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 # so we treat it like a mp3 if it has a mp3 file extension and hope for the best
if filename.endswith(mp3suffix): if filename.endswith(mp3suffix):
metadata_audiofile = mutagen.mp3.MP3(audiofile.name, ID3=mutagen.easyid3.EasyID3) metadata_audiofile = mutagen.mp3.MP3(audiofile.name, ID3=mutagen.easyid3.EasyID3)
#replace album title as needed #replace track metadata as indicated by album_override setting
metadata_audiofile = podcast_override_album(metadata_audiofile, podcast_name, album_override) # replace album title as needed
metadata_audiofile = podcast_override_metadata(metadata_audiofile, podcast_name, album_override, track_title)
metadata_audiofile.save() metadata_audiofile.save()
filetypeinfo = metadata_audiofile.pprint() filetypeinfo = metadata_audiofile.pprint()
logger.info('filetypeinfo is {0}'.format(filetypeinfo.encode('ascii', 'ignore'))) 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 obj['status'] = 0
return json.dumps(obj) 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 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: if override is True:
logger.debug('overriding album name to {0} in podcast'.format(podcast_name.encode('ascii', 'ignore'))) logger.debug('overriding album name to {0} in podcast'.format(podcast_name.encode('ascii', 'ignore')))
m['album'] = podcast_name m['album'] = podcast_name
m['title'] = track_title
m['artist'] = podcast_name
else: else:
# replace the album id3 tag with the podcast name if the album tag is empty # replace the album id3 tag with the podcast name if the album tag is empty
try: try: