mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-08 16:08:54 +00:00
[M3uFormat] supports "enclosures" field
This commit is contained in:
parent
f0fc9a7ae2
commit
2ab615162c
@ -20,14 +20,25 @@ class M3uFormat extends FormatAbstract
|
|||||||
if (isset($itemArray['enclosure'])) {
|
if (isset($itemArray['enclosure'])) {
|
||||||
$m3uitem->url = $itemArray['enclosure']['url'];
|
$m3uitem->url = $itemArray['enclosure']['url'];
|
||||||
$m3uitem->bytes = $itemArray['enclosure']['length'];
|
$m3uitem->bytes = $itemArray['enclosure']['length'];
|
||||||
}
|
if (isset($itemArray['itunes']) && isset($itemArray['itunes']['duration'])) {
|
||||||
if (isset($itemArray['itunes']) && isset($itemArray['itunes']['duration'])) {
|
$m3uitem->duration = self::parseDuration($itemArray['itunes']['duration']);
|
||||||
$m3uitem->duration = self::parseDuration($itemArray['itunes']['duration']);
|
}
|
||||||
}
|
}
|
||||||
if (isset($itemArray['title'])) {
|
if (isset($itemArray['title'])) {
|
||||||
$m3uitem->title = $itemArray['title'];
|
$m3uitem->title = $itemArray['title'];
|
||||||
}
|
}
|
||||||
$contents .= $m3uitem->render();
|
if (! $m3uitem->isEmpty()) {
|
||||||
|
$contents .= $m3uitem->render();
|
||||||
|
} else {
|
||||||
|
foreach ($item->enclosures as $url) {
|
||||||
|
$m3uitem = new M3uItem();
|
||||||
|
$m3uitem->url = $url;
|
||||||
|
if (isset($itemArray['title'])) {
|
||||||
|
$m3uitem->title = $itemArray['title'];
|
||||||
|
}
|
||||||
|
$contents .= $m3uitem->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return mb_convert_encoding($contents, $this->getCharset(), 'UTF-8');
|
return mb_convert_encoding($contents, $this->getCharset(), 'UTF-8');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user