Automating Madsonic

Need help? Post your questions here.

Automating Madsonic

Unread postby mwpmorris » 31 Dec 2016, 10:03

Hello,

In a development to my other thread: 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: http://myserver.madsonic.org:myport/playlistSettings.view?backupPlaylists

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!
mwpmorris
 
Posts: 6
Joined: 18 Nov 2016, 17:33
Has thanked: 0 time
Been thanked: 6 times

Re: Automating Madsonic

Unread postby Madevil » 01 Jan 2017, 19:58

mwpmorris wrote:Hello,

In a development to my other thread: 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: http://myserver.madsonic.org:myport/playlistSettings.view?backupPlaylists

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
User avatar
Madevil
Administrator
Administrator
 
Posts: 926
Joined: 07 Dec 2012, 03:58
Has thanked: 1312 times
Been thanked: 959 times

Re: Automating Madsonic

Unread postby mwpmorris » 03 Jan 2017, 00:31

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

Re: Automating Madsonic

Unread postby mwpmorris » 21 Feb 2017, 16:15

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.
mwpmorris
 
Posts: 6
Joined: 18 Nov 2016, 17:33
Has thanked: 0 time
Been thanked: 6 times


Return to Support 6.x

Who is online

Users browsing this forum: No registered users and 1 guest