Skip to content

Commit

Permalink
Add 'itunes:duration' tag for items with duration (#3774)
Browse files Browse the repository at this point in the history
* [{Atom,Mrss}Format] Allow itunes tags on items without enclosure

* [Arte7Bridge] Add $item['itunes']['duration'] value
  • Loading branch information
tpikonen authored Oct 19, 2023
1 parent 9056106 commit 6583912
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
4 changes: 4 additions & 0 deletions bridges/Arte7Bridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ public function collectData()
. $element['mainImage']['url']
. '" /></a>';

$item['itunes'] = [
'duration' => $durationSeconds,
];

$this->items[] = $item;
}
}
Expand Down
12 changes: 7 additions & 5 deletions formats/AtomFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,13 @@ public function stringify()
$entry->appendChild($itunesProperty);
$itunesProperty->appendChild($document->createTextNode($itunesValue));
}
$itunesEnclosure = $document->createElement('enclosure');
$entry->appendChild($itunesEnclosure);
$itunesEnclosure->setAttribute('url', $itemArray['enclosure']['url']);
$itunesEnclosure->setAttribute('length', $itemArray['enclosure']['length']);
$itunesEnclosure->setAttribute('type', $itemArray['enclosure']['type']);
if (isset($itemArray['enclosure'])) {
$itunesEnclosure = $document->createElement('enclosure');
$entry->appendChild($itunesEnclosure);
$itunesEnclosure->setAttribute('url', $itemArray['enclosure']['url']);
$itunesEnclosure->setAttribute('length', $itemArray['enclosure']['length']);
$itunesEnclosure->setAttribute('type', $itemArray['enclosure']['type']);
}
} elseif (!empty($entryUri)) {
$entryLinkAlternate = $document->createElement('link');
$entry->appendChild($entryLinkAlternate);
Expand Down
12 changes: 7 additions & 5 deletions formats/MrssFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,13 @@ public function stringify()
$entry->appendChild($itunesProperty);
$itunesProperty->appendChild($document->createTextNode($itunesValue));
}
$itunesEnclosure = $document->createElement('enclosure');
$entry->appendChild($itunesEnclosure);
$itunesEnclosure->setAttribute('url', $itemArray['enclosure']['url']);
$itunesEnclosure->setAttribute('length', $itemArray['enclosure']['length']);
$itunesEnclosure->setAttribute('type', $itemArray['enclosure']['type']);
if (isset($itemArray['enclosure'])) {
$itunesEnclosure = $document->createElement('enclosure');
$entry->appendChild($itunesEnclosure);
$itunesEnclosure->setAttribute('url', $itemArray['enclosure']['url']);
$itunesEnclosure->setAttribute('length', $itemArray['enclosure']['length']);
$itunesEnclosure->setAttribute('type', $itemArray['enclosure']['type']);
}
} if (!empty($itemUri)) {
$entryLink = $document->createElement('link');
$entry->appendChild($entryLink);
Expand Down

0 comments on commit 6583912

Please sign in to comment.