add export favorite stations as playlist (fixes #105)
This commit is contained in:
parent
7813cf4a51
commit
8371027730
@ -5,6 +5,8 @@
|
|||||||
[#251](https://git.project-insanity.org/onny/nextcloud-app-radio/-/issues/251) @onny
|
[#251](https://git.project-insanity.org/onny/nextcloud-app-radio/-/issues/251) @onny
|
||||||
- Support add stations manually
|
- Support add stations manually
|
||||||
[#157](https://git.project-insanity.org/onny/nextcloud-app-radio/-/issues/157) @onny
|
[#157](https://git.project-insanity.org/onny/nextcloud-app-radio/-/issues/157) @onny
|
||||||
|
- Export favorite radio stations as playlist
|
||||||
|
[#105](https://git.project-insanity.org/onny/nextcloud-app-radio/-/issues/105) @onny
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Cleanup SCSS
|
- Cleanup SCSS
|
||||||
|
@ -31,6 +31,7 @@ use OCP\AppFramework\Controller;
|
|||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use SimpleXMLElement;
|
use SimpleXMLElement;
|
||||||
|
use DOMDocument;
|
||||||
|
|
||||||
class ExportController extends Controller {
|
class ExportController extends Controller {
|
||||||
/** @var FavoriteService */
|
/** @var FavoriteService */
|
||||||
@ -57,12 +58,19 @@ class ExportController extends Controller {
|
|||||||
$xml = new SimpleXMLElement('<?xml version="1.0"?><playlist></playlist>');
|
$xml = new SimpleXMLElement('<?xml version="1.0"?><playlist></playlist>');
|
||||||
$xml->addAttribute('encoding', 'UTF-8');
|
$xml->addAttribute('encoding', 'UTF-8');
|
||||||
$trackList = $xml->addChild('trackList');
|
$trackList = $xml->addChild('trackList');
|
||||||
$track = $trackList->addChild('track');
|
foreach($this->service->findAll($this->userId) as $station) {
|
||||||
$track->addChild('location', 'http://localhost/test.mp3');
|
$track = $trackList->addChild('track');
|
||||||
$track->addChild('title', 'Radio Test 404fm');
|
$track->addChild('location', $station->getUrlresolved());
|
||||||
$track->addChild('image', 'http://localhost/favicon.ico');
|
$track->addChild('title', $station->getName());
|
||||||
|
$track->addChild('image', $station->getFavicon());
|
||||||
|
}
|
||||||
|
|
||||||
return new ExportResponse($xml->asXML());
|
$dom = new DOMDocument("1.0");
|
||||||
|
$dom->preserveWhiteSpace = false;
|
||||||
|
$dom->formatOutput = true;
|
||||||
|
$dom->loadXML($xml->asXML());
|
||||||
|
|
||||||
|
return new ExportResponse($dom->saveXML());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user