From 69e42d7014da31431beb779f6be34a48d4fa8131 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Thu, 11 Mar 2021 15:00:04 +0100 Subject: [PATCH] further work on export favorites as playlist --- lib/Controller/ExportController.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Controller/ExportController.php b/lib/Controller/ExportController.php index f39655b..e7c7af1 100644 --- a/lib/Controller/ExportController.php +++ b/lib/Controller/ExportController.php @@ -27,7 +27,8 @@ use OC; use OCA\Radio\AppInfo\Application; use OCA\Radio\Service\FavoriteService; 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 SimpleXMLElement; @@ -51,8 +52,9 @@ class ExportController extends Controller { /** * @NoAdminRequired */ - public function index() { - $xml = new SimpleXMLElement(''); + public function index(): Response { + $xml = new SimpleXMLElement(''); + $xml->addAttribute('encoding', 'UTF-8'); $trackList = $xml->addChild('trackList'); $track = $trackList->addChild('track'); $track->addChild('location', 'http://localhost/test.mp3'); @@ -73,7 +75,8 @@ class ExportController extends Controller { header('Content-Type: application/xspf+xml'); header('Content-Disposition: attachment; filename=' . $export_name); //return new DataResponse($this->service->findAll($this->userId)); - return $xml->asXML(); + return new Response($xml->asXML()); + //return $xml->asXML(); } }