diff --git a/README.md b/README.md
index 4426420..fd60de8 100644
--- a/README.md
+++ b/README.md
@@ -77,22 +77,24 @@ example the German language file should be placed at
### Prepare a release
Consoult [Release.md](Release.md) on how to prepare a release for Gitlab and the app store.
-## Reporting bugs
+## Contribute
+
+### Reporting bugs
You can report bugs in the public gitlab repository [here](https://git.project-insanity.org/onny/nextcloud-app-radio/issues) and for discussion you can find a section for the app in the offical Nextcloud forums [here](https://help.nextcloud.com/c/apps/radio).
-## Adding translations
+### Adding translations
For now only German translations are provided, so please submit your translations if possible :) It's really easy, just `git clone` this repo and copy the translation files in `l10n` according to your locale. Merge requests go to [this radio repository](https://git.project-insanity.org/onny/nextcloud-app-radio).
-## Adding radio stations
+### Adding radio stations
This app uses a public and open database of radio stations as its backend, so any station you add in [radio-browser.info](http://www.radio-browser.info/) (no account required), will be also available in this app. Feel free to contribute :)
-## Credits
-* [radio-browser.info](http://www.radio-browser.info/) database api as backend for this app
-* Python example code to query stream metadata, took from [here](https://anton.logvinenko.name/en/blog/how-to-get-title-from-audio-stream-with-python.html).
-
-## Donation
+### Donation
If you like this app and want to support my work, you can donate to this Bitcoin address:
```
19mpmuNczGDgdxaBLBn3REEpQLPPcJHZB6
```
+
+## Credits
+* [radio-browser.info](http://www.radio-browser.info/) database api as backend for this app
+* Python example code to query stream metadata, took from [here](https://anton.logvinenko.name/en/blog/how-to-get-title-from-audio-stream-with-python.html).
diff --git a/lib/Controller/ExportController.php b/lib/Controller/ExportController.php
index 4fdfd1e..f39655b 100644
--- a/lib/Controller/ExportController.php
+++ b/lib/Controller/ExportController.php
@@ -23,11 +23,13 @@
namespace OCA\Radio\Controller;
+use OC;
use OCA\Radio\AppInfo\Application;
use OCA\Radio\Service\FavoriteService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
+use SimpleXMLElement;
class ExportController extends Controller {
/** @var FavoriteService */
@@ -50,10 +52,28 @@ class ExportController extends Controller {
* @NoAdminRequired
*/
public function index() {
- header('Content-Type: application/csv');
- header('Content-Disposition: attachment; filename="filename.csv"');
+ $xml = new SimpleXMLElement('');
+ $trackList = $xml->addChild('trackList');
+ $track = $trackList->addChild('track');
+ $track->addChild('location', 'http://localhost/test.mp3');
+ $track->addChild('title', 'Radio Test 404fm');
+ $track->addChild('image', 'http://localhost/favicon.ico');
+
+ $user = OC::$server->getUserSession()->getUser();
+ if (is_null($user)) {
+ throw new HintException('User not logged in');
+ }
+
+ $userName = $user->getDisplayName();
+ $productName = OC::$server->getThemingDefaults()->getName();
+ $dateTime = OC::$server->getDateTimeFormatter();
+
+ $export_name = '"' . $productName . ' Radio Favorites (' . $userName . ') (' . $dateTime->formatDate(time()) . ').xspf"';
+
+ header('Content-Type: application/xspf+xml');
+ header('Content-Disposition: attachment; filename=' . $export_name);
//return new DataResponse($this->service->findAll($this->userId));
- return "hello";
+ return $xml->asXML();
}
}
diff --git a/package.json b/package.json
index 369c245..8717eaa 100644
--- a/package.json
+++ b/package.json
@@ -30,6 +30,7 @@
"stylelint:fix": "stylelint src --fix"
},
"dependencies": {
+ "@nextcloud/auth": "^1.3.0",
"@nextcloud/axios": "^1.6.0",
"@nextcloud/dialogs": "^3.1.1",
"@nextcloud/l10n": "^1.4.1",
diff --git a/src/views/Favorites.vue b/src/views/Favorites.vue
index 3db0d2c..7642743 100644
--- a/src/views/Favorites.vue
+++ b/src/views/Favorites.vue
@@ -40,7 +40,7 @@
+ @click="doExport">
Export favorites
@@ -114,15 +114,13 @@ import Breadcrumb from '@nextcloud/vue/dist/Components/Breadcrumb'
import Actions from '@nextcloud/vue/dist/Components/Actions'
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
import Modal from '@nextcloud/vue/dist/Components/Modal'
+import { getRequestToken } from '@nextcloud/auth'
import Navigation from './../components/Navigation'
import Table from './../components/Table'
import Sidebar from './../components/Sidebar'
import { mapGetters, mapActions } from 'vuex'
-import axios from '@nextcloud/axios'
-import { generateUrl } from '@nextcloud/router'
import { RadioBrowserApi } from './../services/RadioBrowserApi'
const apiClient = new RadioBrowserApi()
-const requesttoken = axios.defaults.headers.requesttoken
export default {
name: 'Favorites',
@@ -270,15 +268,10 @@ export default {
this.modal = false
},
- exportList() {
- console.log('export list')
- axios.defaults.headers.requesttoken = requesttoken
- axios.get(generateUrl('/apps/radio/export'))
- .then(
- (response) => {
- return Promise.resolve(response.data)
- },
- )
+ doExport() {
+ window.location
+ = 'export?requesttoken='
+ + encodeURIComponent(getRequestToken())
},
},