|Anonymous | Login | Signup for a new account||2014-03-12 10:19 CET|
|My View | View Issues | Change Log | Roadmap | My Account|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001580||MPD||Commands||public||2007-09-25 22:03||2009-06-20 22:44|
|Target Version||0.16.x||Fixed in Version|
|Summary||0001580: [PATCH] add complex/regex searching to mpd|
|Description||Because I use this feature a lot in my current music player, but would like to switch to mpd, I added complex and regular-expression-based searching to mpd, via a new command, "complex_search". The syntax is a bit strange, because I wanted to make the parser as small as possible (currently it's a single 114-line recursive function). I'd really like to see this feature make it into mainline mpd, so if in order to achieve this the command needs new syntax, I'd be happy to do that for you, although I'd feel happier splitting it out into a separate file in that case.|
Also, this program relies on POSIX "regex.h" to compile and match regular expressions. I don't know how unportable this may or may not make this program. It compiled and ran without modification to the autoconf magic (which I know nothing about) on the system I created it on, which is x86 Linux (Red-Hat based).
The syntax is as follows:
The equivalent of "search <tagname> <value>" is "complex_search :tag <tagname> <value". To do a regex search, do "complex_search :tag-regex <tagname> <regex>". Regex syntax is POSIX extended regular expressions. Tag can also be "file", "filename" or "any", just like in a regular search.
To 'AND' multiple queries, you do ":all <query> <query> ... !". To 'OR' multiple queries, you do ":any <query> <query> ... !". To 'NOT' multiple queries, do ":none <query> <query> ... !". Multiple exclamation points must each occupy their own argument; you cannot do ":all :tag foo bar :any :tag this that :tag xyzzy plugh !!". What you CAN do, however, is put a number after an exclamation point to indicate how many higher-level queries it ends. For example:
"complex_search :all :none :tag artist "bob dylan" ! :any :tag genre folk :tag genre jazz :tag genre blues !2"
This would search for all songs in the genres "folk", "jazz", or "blues" by artists not named "bob dylan" (ignoring case).
Attached is patch including my changes (produced by "diff -r").
|Tags||No tags attached.|
|Attached Files||mpd-search.patch [^] (8,402 bytes) 2007-09-25 22:03 [Show Content]|
This looks like a _very_ interesting patch.
But out of curiosity, what is the performance of the complex_search?
|Again, can you look at performance? does this still work with 100.000 songs?|
Avuton Olrich (administrator)
|What would be even better then at this point, since glib is now ingrained in MPD if Glib/GRegex could be utilized for this purpose. The patch would probably be much smaller in that case, and much easier to accept.|
|Moved to target version 0.16, due to time constraints.|
|My dynamic-playlist plugin for gmpc would benefit a lot from complex searches.|
By the way... it would be nice if it would support stickers like
:stickers song rate 5
or if stickers used as blacklist
:none :stickers artist blocked true
|2007-09-25 22:03||daekharel||New Issue|
|2007-09-25 22:03||daekharel||Status||new => assigned|
|2007-09-25 22:03||daekharel||Assigned To||=> shank|
|2007-09-25 22:03||daekharel||File Added: mpd-search.patch|
|2007-09-26 09:11||qball||Note Added: 0001650|
|2007-12-06 17:14||qball||Note Added: 0001834|
|2008-10-25 19:01||Avuton Olrich||Assigned To||shank => cirrus|
|2008-10-25 22:00||Avuton Olrich||Category||=> Commands|
|2008-11-23 01:38||Avuton Olrich||Note Added: 0002453|
|2009-02-25 10:42||cirrus||Target Version||=> 0.15|
|2009-03-14 12:10||cirrus||Target Version||0.15 => 0.16.x|
|2009-03-14 12:11||cirrus||Note Added: 0003400|
|2009-04-26 01:18||Misery||Note Added: 0003682|
|2009-06-20 22:44||Misery||Note Added: 0004016|
|Copyright © 2000 - 2014 MantisBT Team|