Advanced search syntax comparison



Foobar can perform advanced searches as Winamp. Here is a table to translate the fields and operators from one to another.

Here is an example of Foobar2000 search syntax:
(%genre% HAS rock AND %date% LESS 2000) OR (%last_played% DURING LAST 2 WEEKS AND NOT %artist% HAS the) OR %genre% MISSING
Ok it doesn't make sense, it's just an example. I think it's self-explanatory. Just in case, it will return all music which: either has "rock" in its genre (alt. rock, classic rock, rock and roll...) and was released before or in 2000 ; or music played in the last 2 weeks and which artists does not contain "the"; or files that have an empty "genre" field.

Fields:


WinampFoobar2000
Filename with path FILENAME
Filename without path
%filename%
Path
%path%
Length, in seconds LENGTH %tracklength% (in seconds)
Artist ARTIST %artist%
Album ALBUM %album%
Album Artist ALBUMARTIST %album artist%
Title TITLE %title%
Track number of file TRACKNO %track number% or %track%
Genre GENRE %genre%
Year YEAR %date%
Comment COMMENT %comment%
Composer COMPOSER %composer%
Disc number of a CD set DISC %disc%
File size, in kilobytes FILESIZE %filesize% (IN BYTES)
Last known file date/time on disk FILETIME ?
Containing folder FOLDER %directoryname%
Date/time of file imported to library or modified in library LASTUPD %added%1
Date/time of last play LASTPLAY %last_played%1
Rating value (1-5, or 0 or empty for unrated) RATING %rating%
Number of plays PLAYCOUNT %play_count% 1
Publisher or record label PUBLISHER %publisher%
ReplayGain Album Gain REPLAYGAIN_ALBUM_GAIN %replaygain_album_gain%
ReplayGain Track Gain REPLAYGAIN_TRACK_GAIN %replaygain_track_gain%
Bitrate (in KBPS) BITRATE %bitrate%
Total number of tracks on the disc TRACKS
Total number of discs in the set DISCS
1 for a podcast episode, 0 otherwise ISPODCAST
The name of the channel for a podcast PODCASTCHANNEL
Date/time when the podcast was published PODCASTPUBDATE
Sample rate
%samplerate%
Codex
%codec%
Replaygain album peak
%replaygain_album_peak%
Replaygain track peak
%replaygain_track_peak%
Any field
*

1: component foo_playcount is required. Please see this post.

Operators:


WinampFoobar2000
String or integer equals value '=' IS
String or integer does not equal value '!=' NOT …. IS 1
String or integer is less than value '<' LESS
String or integer is greater than value '>' GREATER
String or integer is less than or equal to value '<=' NOT …. GREATER 1
String or integer is greater than or equal to value '>=' NOT …. LESS 1
String contains value HAS HAS
String does not contain value NOTHAS NOT …. HAS 1
String is similar to value ("the" and whitespace are ignored) LIKE
String begins with value BEGINS
String begins like value BEGINSLIKE
String ends with value ENDS
(no comparison value required) TRUE if is empty ISEMPTY MISSING
(no comparison value required) TRUE if is not empty ISNOTEMPTY PRESENT
Before
BEFORE 2
After
AFTER 2
During (ex: DURING 2007)
DURING
During last
DURING LAST 3





SORT [DESCENDING] BY …
boolean AND two comparisons &&, &, or AND AND
boolean OR two comparisons ||, |, or OR OR
prefix this to an expression for the boolean NOT of that expression !, or NOT NOT

1: Exampe: "NOT genre IS ROCK"
2: Thar argument must be in one of the following formats:YYYY, YYYY-MM, YYYY-MM-DD, YYYY-MM-DD HH, YYYY-MM-DD HH
3: The argument is (number) (time-unit), with (time-unit)=[SECONDS, MINUTES, HOURS, DAYS, or WEEKS]. (ex: DURING LAST 3 DAYS)