mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-30 06:40:02 +02:00
[M3uFormat] basic M3U support
This commit is contained in:
parent
683c968d64
commit
db8a3d674d
1 changed files with 24 additions and 0 deletions
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…
Add table
Add a link
Reference in a new issue