Skip to content

Commit

Permalink
Add itunes:episode tag
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-xo committed Jan 5, 2023
1 parent bad78f5 commit 1bd9a59
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions dir2cast.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ public function appendToItem(DOMElement $d, DOMDocument $doc, RSS_Item $item)
$item->setID3Album( $info['comments']['album'][0] );
if(!empty($info['comments']['comment'][0]))
$item->setID3Comment( $info['comments']['comment'][0] );
if(!empty($info['comments']['track'][0]))
$item->setID3Track( $info['comments']['track'][0] );
if(!empty($info['comments']['part_of_a_set'][0]))
$item->setID3PartOfASet( $info['comments']['part_of_a_set'][0] );

Expand Down Expand Up @@ -394,6 +396,12 @@ public function appendToChannel(DOMElement $channel, DOMDocument $doc)
$channel->appendChild( $doc->createElement('itunes:image') )
->setAttribute('href', $this->image_href);
}

if(iTunes_Podcast_Helper::$ITUNES_TYPE_SERIAL)
{
$channel->appendChild( $doc->createElement('itunes:type') )
->appendChild( new DOMText( 'serial' ) );
}
}

public function appendToItem(DOMElement $item_element, DOMDocument $doc, RSS_Item $item)
Expand Down Expand Up @@ -432,6 +440,13 @@ public function appendToItem(DOMElement $item_element, DOMDocument $doc, RSS_Ite

if(iTunes_Podcast_Helper::$ITUNES_TYPE_SERIAL)
{

$episode = $item->getEpisode();
if($episode !== '')
{
$elements['episode'] = $episode;
}

$season = $item->getSeason();
if($season !== '')
{
Expand Down Expand Up @@ -931,6 +946,17 @@ public function getSubtitle()
return $subtitle;
}

public function getEpisode()
{
$episode = parent::getEpisode();
if(!$episode)
{
// use track tag as season if there's no override
$episode = $this->getID3Track();
}
return $episode;
}

public function getSeason()
{
$season = parent::getSeason();
Expand Down

0 comments on commit 1bd9a59

Please sign in to comment.