Automating Madsonic

Need help? Post your questions here.
mwpmorris
Posts: 6
Joined: 18 Nov 2016, 17:33
Has thanked: 0
Been thanked: 6 times

Automating Madsonic

Unread post 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!
These users thanked the author mwpmorris for the post:
Madsonic
Rating: 7.69%
User avatar
Madsonic
Administrator
Administrator
Posts: 984
Joined: 07 Dec 2012, 03:58
Answers: 7
Has thanked: 1201 times
Been thanked: 470 times

Re: Automating Madsonic

Unread post 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
These users thanked the author Madsonic for the post:
Matt Zornig
Rating: 7.69%
mwpmorris
Posts: 6
Joined: 18 Nov 2016, 17:33
Has thanked: 0
Been thanked: 6 times

Re: Automating Madsonic

Unread post by mwpmorris »

Thanks!
mwpmorris
Posts: 6
Joined: 18 Nov 2016, 17:33
Has thanked: 0
Been thanked: 6 times

Re: Automating Madsonic

Unread post 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.
These users thanked the author mwpmorris for the post:
Matt Zornig
Rating: 7.69%
Post Reply