further work on export favorites as playlist
This commit is contained in:
parent
4f9cf298f7
commit
e2cb02959e
18
README.md
18
README.md
@ -77,22 +77,24 @@ example the German language file should be placed at
|
|||||||
### Prepare a release
|
### Prepare a release
|
||||||
Consoult [Release.md](Release.md) on how to prepare a release for Gitlab and the app store.
|
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).
|
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).
|
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 :)
|
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
|
### Donation
|
||||||
* [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
|
|
||||||
If you like this app and want to support my work, you can donate to this Bitcoin address:
|
If you like this app and want to support my work, you can donate to this Bitcoin address:
|
||||||
```
|
```
|
||||||
19mpmuNczGDgdxaBLBn3REEpQLPPcJHZB6
|
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).
|
||||||
|
@ -23,11 +23,13 @@
|
|||||||
|
|
||||||
namespace OCA\Radio\Controller;
|
namespace OCA\Radio\Controller;
|
||||||
|
|
||||||
|
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;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
use SimpleXMLElement;
|
||||||
|
|
||||||
class ExportController extends Controller {
|
class ExportController extends Controller {
|
||||||
/** @var FavoriteService */
|
/** @var FavoriteService */
|
||||||
@ -50,10 +52,28 @@ class ExportController extends Controller {
|
|||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
header('Content-Type: application/csv');
|
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><playlist></playlist>');
|
||||||
header('Content-Disposition: attachment; filename="filename.csv"');
|
$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 new DataResponse($this->service->findAll($this->userId));
|
||||||
return "hello";
|
return $xml->asXML();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
"stylelint:fix": "stylelint src --fix"
|
"stylelint:fix": "stylelint src --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@nextcloud/auth": "^1.3.0",
|
||||||
"@nextcloud/axios": "^1.6.0",
|
"@nextcloud/axios": "^1.6.0",
|
||||||
"@nextcloud/dialogs": "^3.1.1",
|
"@nextcloud/dialogs": "^3.1.1",
|
||||||
"@nextcloud/l10n": "^1.4.1",
|
"@nextcloud/l10n": "^1.4.1",
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
<ActionButton
|
<ActionButton
|
||||||
icon="icon-download"
|
icon="icon-download"
|
||||||
:close-after-click="true"
|
:close-after-click="true"
|
||||||
@click="exportList">
|
@click="doExport">
|
||||||
Export favorites
|
Export favorites
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</Actions>
|
</Actions>
|
||||||
@ -114,15 +114,13 @@ import Breadcrumb from '@nextcloud/vue/dist/Components/Breadcrumb'
|
|||||||
import Actions from '@nextcloud/vue/dist/Components/Actions'
|
import Actions from '@nextcloud/vue/dist/Components/Actions'
|
||||||
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
|
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
|
||||||
import Modal from '@nextcloud/vue/dist/Components/Modal'
|
import Modal from '@nextcloud/vue/dist/Components/Modal'
|
||||||
|
import { getRequestToken } from '@nextcloud/auth'
|
||||||
import Navigation from './../components/Navigation'
|
import Navigation from './../components/Navigation'
|
||||||
import Table from './../components/Table'
|
import Table from './../components/Table'
|
||||||
import Sidebar from './../components/Sidebar'
|
import Sidebar from './../components/Sidebar'
|
||||||
import { mapGetters, mapActions } from 'vuex'
|
import { mapGetters, mapActions } from 'vuex'
|
||||||
import axios from '@nextcloud/axios'
|
|
||||||
import { generateUrl } from '@nextcloud/router'
|
|
||||||
import { RadioBrowserApi } from './../services/RadioBrowserApi'
|
import { RadioBrowserApi } from './../services/RadioBrowserApi'
|
||||||
const apiClient = new RadioBrowserApi()
|
const apiClient = new RadioBrowserApi()
|
||||||
const requesttoken = axios.defaults.headers.requesttoken
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Favorites',
|
name: 'Favorites',
|
||||||
@ -270,15 +268,10 @@ export default {
|
|||||||
this.modal = false
|
this.modal = false
|
||||||
},
|
},
|
||||||
|
|
||||||
exportList() {
|
doExport() {
|
||||||
console.log('export list')
|
window.location
|
||||||
axios.defaults.headers.requesttoken = requesttoken
|
= 'export?requesttoken='
|
||||||
axios.get(generateUrl('/apps/radio/export'))
|
+ encodeURIComponent(getRequestToken())
|
||||||
.then(
|
|
||||||
(response) => {
|
|
||||||
return Promise.resolve(response.data)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user