You are here: Home » Topic » Automatically create smart playlists?

Automatically create smart playlists?

This topic contains 3 replies, has 3 voices, and was last updated by  oboeaaron 10 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1455

    oboeaaron
    Participant

    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

    #11064

    fizze
    Participant

    Actually this has been discussed and a solution has been posted here a while ago.
    Someone wrote a perl script that does just what you want. He actually inserted static playlists, because those survive a rescan, IIRC.

    A search in these forums should yield some insight.

    #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:[email protected]: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.

    #11066

    oboeaaron
    Participant

    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.

    I should have mentioned I’m running the latest nightly. That command did the trick, though I had to place the entire argument to wget in double-quotation marks. The shell script is done and everything works great. Thanks Ron!

    -Aaron

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.