Reply To: Automatically create smart playlists?

#11065
rpedde
Participant

@oboeaaron wrote:

Hi.

Can anyone provide me with a pithy example of how to insert a smart playlist into the database from the (Unix) command line?

I am looking at writing a shell script that automatically inserts a new playlist based on path into the database whenever a folder containing music files is uploaded to the server. Here is the scenario:

1. User uploads a folder named “tracks” containing music files.
2. Server automatically detects the new folder and starts up the script.
3. Script adds a new playlist:
“tracks” {
path includes “tracks”
}

1 and 2 are no problem. Most of 3 is no problem. Trouble is that I am not a DB admin and can’t make heads or tails of the info on this page:

http://trac.fireflyserver.org/wiki/SmartPlaylists

Any help greatly appreciated.

-Aaron

This: http://trac.fireflymediaserver.org/wiki/XmlApi is probably a help, too.

Something like:


$ wget http://admin:password@server:port/databases/1/containers/add?output=xml&org.mt-daapd.playlist-type=1&dmap.itemname=tracks&org.mt-daapd.smart-playlist-spec=path+includes+%22tracks%22

That’s with nightlies. You could also do the same thing with sqlite, but you wouldn’t want to probably do that while the server is running.