Fandom

Music Player Daemon Community Wiki

Hack:mpdspl.py

525pages on
this wiki
Add New Page
Talk0 Share

A script that allows you to creates smart playlists, using various criteria to match track attributes (available matchers are regex, timestamp and time-delta).

Get it from http://github.com/sdelafond/mpd/blob/master/mpdspl.py

Usage: mpdspl.py [options]

Playlist ruleset:
       Each ruleset is made of several rules, separated by commas.
       Each rule is made of a keyword, an operator, a value to match
       surrounded by delimiters, and several optional flags influencing the
       match.
       There are 3 types of rules, each defined by a specific delimiter:

         '@' ->  Match according to a timestamp, for instance:
              before 2010-01-02   -->   <@2010-01-02@
              after  2009-12-20   -->   >@2009-12-20@
              on     2009-11-18   -->   =@2009-11-18@
         '%' ->  Match according to a timedelta, for instance:
              in the last 3 days   -->   <%3days%
              before last month    -->   >%1month%
              3 years ago          -->   =%3years%
         '/' ->  Search according to a regex, for instance:
              contains foo                     -->   =/foo/
              contains bar, case-insensitive   -->   =/bar/i
       These available keywords are:
           fp/file : file full path
           le/Time : track duration (in seconds)
           ye/Date : track year
           al/Album : album
           tn/Track : track number
           mt/mtime : file modification time
           ge/Genre : genre
           ar/Artist : artist
           ra/Rating : track rating
           ti/Title : title
           fn/key : file name

       For example, a rule for all tracks by 'Fred' or 'George', which have a
       title containing (case-insensitive) 'the' and 'and', which don't
       include the word 'when' (case-insensitive), and whose modification
       time was in the last 3 days would be written:

         ar=/(Fred|George)/ ti=/(the.*and|and.*the)/i ti=/when/i mt<%3days%

   Notes:
       Paths specified in the MPD config file containing a '~' will have the
       '~'s replaced by the user MPD runs as..

Options:
 -h, --help            show this help message and exit
 -f, --force-update    Force an update of the cache file and any playlists
 -C FILE, --cache-file=FILE
                       Location of the cache file
 -D DIR, --data-dir=DIR
                       Location of the data directory (where we save playlist
                       info)
 -d FILE, --database-file=FILE
                       Location of the MPD database file
 -s FILE, --sticker-file=FILE
                       Location of the MPD sticker file( holding ratings)
 -c FILE, --config-file=FILE
                       Location of the MPD config file
 -p DIR, --playlist-dir=DIR
                       Location of the MPD playlist directory
 -u USER, --user=USER  User MPD runs as
 -n NAME 'RULESET', --new-playlist=NAME 'RULESET'
                       Create a new playlist
 -o, --output-only     Only print the final track list to STDOUT

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki