0
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-25 21:05:42 +00:00
rss-bridge/formats/M3uFormat.php
2024-03-05 19:48:23 +01:00

25 lines
533 B
PHP

<?php
/**
* M3U
*
*/
class M3uFormat extends FormatAbstract
{
const MIME_TYPE = 'application/mpegurl';
public function stringify()
{
$contents = "#EXTM3U\n";
foreach ($this->getItems() as $item) {
$itemArray = $item->toArray();
if (isset($itemArray['itunes']) && isset($itemArray['enclosure'])) {
$contents .= $itemArray['enclosure']['url'] . "\n";
}
}
return mb_convert_encoding($contents, $this->getCharset(), 'UTF-8');
}
}