mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-26 12:15:24 +02:00
25 lines
533 B
PHP
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');
|
||
|
}
|
||
|
}
|