further work on export favorites as playlist
This commit is contained in:
parent
e2cb02959e
commit
69e42d7014
@ -27,7 +27,8 @@ use OC;
|
|||||||
use OCA\Radio\AppInfo\Application;
|
use OCA\Radio\AppInfo\Application;
|
||||||
use OCA\Radio\Service\FavoriteService;
|
use OCA\Radio\Service\FavoriteService;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse; // FIXME: Remove if not required
|
||||||
|
use OCP\AppFramework\Http\Response;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use SimpleXMLElement;
|
use SimpleXMLElement;
|
||||||
|
|
||||||
@ -51,8 +52,9 @@ class ExportController extends Controller {
|
|||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index(): Response {
|
||||||
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><playlist></playlist>');
|
$xml = new SimpleXMLElement('<?xml version="1.0"?><playlist></playlist>');
|
||||||
|
$xml->addAttribute('encoding', 'UTF-8');
|
||||||
$trackList = $xml->addChild('trackList');
|
$trackList = $xml->addChild('trackList');
|
||||||
$track = $trackList->addChild('track');
|
$track = $trackList->addChild('track');
|
||||||
$track->addChild('location', 'http://localhost/test.mp3');
|
$track->addChild('location', 'http://localhost/test.mp3');
|
||||||
@ -73,7 +75,8 @@ class ExportController extends Controller {
|
|||||||
header('Content-Type: application/xspf+xml');
|
header('Content-Type: application/xspf+xml');
|
||||||
header('Content-Disposition: attachment; filename=' . $export_name);
|
header('Content-Disposition: attachment; filename=' . $export_name);
|
||||||
//return new DataResponse($this->service->findAll($this->userId));
|
//return new DataResponse($this->service->findAll($this->userId));
|
||||||
return $xml->asXML();
|
return new Response($xml->asXML());
|
||||||
|
//return $xml->asXML();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user