mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-08 16:08:54 +00:00
[M3uFormat] basic M3U support
This commit is contained in:
parent
683c968d64
commit
db8a3d674d
24
formats/M3uFormat.php
Normal file
24
formats/M3uFormat.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?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');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user