further work on export favorites as playlist

This commit is contained in:
Jonas Heinrich 2021-03-12 10:42:47 +01:00
parent 69e42d7014
commit 49825a038f

View File

@ -52,7 +52,7 @@ class ExportController extends Controller {
/** /**
* @NoAdminRequired * @NoAdminRequired
*/ */
public function index(): Response { public function index() {
$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');
@ -72,10 +72,12 @@ class ExportController extends Controller {
$export_name = '"' . $productName . ' Radio Favorites (' . $userName . ') (' . $dateTime->formatDate(time()) . ').xspf"'; $export_name = '"' . $productName . ' Radio Favorites (' . $userName . ') (' . $dateTime->formatDate(time()) . ').xspf"';
header('Content-Type: application/xspf+xml'); $response = new Response();
header('Content-Disposition: attachment; filename=' . $export_name); $response->addHeader('Content-Type', 'application/xspf+xml');
$response->addHeader('Content-Disposition', 'attachment; filename=' . $export_name);
$response->render();
//return new DataResponse($this->service->findAll($this->userId)); //return new DataResponse($this->service->findAll($this->userId));
return new Response($xml->asXML()); return $response;
//return $xml->asXML(); //return $xml->asXML();
} }