Page 1 of 1

Automating Madsonic

Posted: 31 Dec 2016, 10:03
by mwpmorris
Hello,

In a development to my other thread: http://forum.madsonic.org/viewtopic.php?f=62&t=1986

I have a sequence of database query commands that update playlists based on date added, "starred" status etc. Unfortunately I have to manually enter these commands in the Madsonic web GUI. Is there any way of automating this, perhaps by using a HSQLDB script, or watchdog event? I've done some digging on SQL forums but have drawn a blank.

I also need to have Madsonic regularly export or backup playlists to the default folders. I can achieve this locally by using the URL: [url]http://myserver.madsonic.org:myport/playlistSettings.view?backupPlaylists[/url]

Is there any way of automating this? I have thought about a shell script with cURL but imagine that I would have login problems.

Thanks in advance!

Re: Automating Madsonic

Posted: 01 Jan 2017, 19:58
by Madsonic
mwpmorris wrote:Hello,

In a development to my other thread: http://forum.madsonic.org/viewtopic.php?f=62&t=1986

I have a sequence of database query commands that update playlists based on date added, "starred" status etc. Unfortunately I have to manually enter these commands in the Madsonic web GUI. Is there any way of automating this, perhaps by using a HSQLDB script, or watchdog event? I've done some digging on SQL forums but have drawn a blank.

I also need to have Madsonic regularly export or backup playlists to the default folders. I can achieve this locally by using the URL: [url]http://myserver.madsonic.org:myport/playlistSettings.view?backupPlaylists[/url]

Is there any way of automating this? I have thought about a shell script with cURL but imagine that I would have login problems.

Thanks in advance!
Hi there,

If you want edit or modify your database you can try SQL Workbench http://www.sql-workbench.net/index.html or RazorSQL https://razorsql.com/ in offline mode.
workbench.png
you can also try this script to automate backup

Code: Select all

::::::::::::::::::::::::::::::
:: Backup Madsonic Playlist ::
::::::::::::::::::::::::::::::

:: edit username/password/serverlink to your need

set username=admin
set password=admin
set serverlink=http://127.0.0.1:4040

:::::::::::::::::::::

set wgetsettings=--spider --no-check-certificate --cookies=on --keep-session-cookies --save-cookies=%temp%\cookie.txt
wget %wgetsettings% --user-agent=Mozilla "%serverlink%/login.view?user=%username%&password=%password%" 
wget %wgetsettings% --load-cookies=%temp%\cookie.txt --referer="%serverlink%" "%serverlink%/playlistSettings.view?backupPlaylists"

BTW: On every mediascan a backup is automatically made to the playlist backup folder!

Best regards,
The Madsonic Team

Re: Automating Madsonic

Posted: 03 Jan 2017, 00:31
by mwpmorris
Thanks!

Re: Automating Madsonic

Posted: 21 Feb 2017, 16:15
by mwpmorris
If anyone is interested, I managed to automate the db queries by using cURL:

Code: Select all

curl --cookie /PATH/TO/YOUR/COOKIEFILE.txt -d query="SQL QUERY - URLENCODED" http://path.to.madsonic.server:port/db.view
The authentication method mentioned above did not work for me, so I captured a cookie file using a Chrome plugin and linked to it with cURL.