Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: foobar 'media library search' syntax (Read 5597 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

foobar 'media library search' syntax

Hi all, There is probably a simple answer to this, but my knowledge of foobar syntax is limited. I am populating the genre attribute of my music library manually.
I want to be able to search flexibly using the media library search facility, both using the program itself (via my computer) and using foobar2000 controller pro for android (remotely via phone).
Consequently, I am populating the genre field with multiple genres, each separated by a semicolon. I note the syntax that is required to search and I am trying to get my head around it.

Entering '%genre% HAS pop' in the search facility shows all genres that literally contains the string 'pop'. Is there a way to search only for 'pop' so that the 'pop' genre is identifiable specifically?
Otherwise, pop-rock, folk-pop. etc are included in the above search result, which is less than ideal. I have tried using quotation marks and wildcards to try and make the search behave as I want,
but to no avail. Advice appreciated!

Regards, Chris

foobar 'media library search' syntax

Reply #1
That would probably be "%genre% IS pop". Have a look into the foobar2000 install folder. There should be an HTML file called "Query Syntax Help" that summarizes the available operators. There's also another one called "titleformat_help" (Title Formatting Syntax Reference) that lists standard fields and functions available.

foobar 'media library search' syntax

Reply #2
That would probably be "%genre% IS pop". Have a look into the foobar2000 install folder. There should be an HTML file called "Query Syntax Help" that summarizes the available operators. There's also another one called "titleformat_help" (Title Formatting Syntax Reference) that lists standard fields and functions available.


That produces no results, presumably because of the multiple entries in the genre field?

foobar 'media library search' syntax

Reply #3
What Wormbo said...IS or = cuz HAS is the same as a wildcard search, meaning 'contains'

foobar 'media library search' syntax

Reply #4
Use genre IS pop (without the % signs)

foobar 'media library search' syntax

Reply #5
Use genre IS pop (without the % signs)



Thanks, that helps somewhat. If I have files classified as multiple genres (inc pop) and then some files classified as pop only (classified as a single genre), how do I search for the latter without getting the former in the search results?

I still get 'pop-rock' etc in the search results when using "genre IS pop" because of the multiple genres, even though it is finding the 'pop' genre alone in these instances

foobar 'media library search' syntax

Reply #6
Entering '%genre% HAS pop' in the search facility shows all genres that literally contains the string 'pop'. Is there a way to search only for 'pop' so that the 'pop' genre is identifiable specifically?

These work:
Code: [Select]
%genre% HAS ", pop"
%genre% HAS ", pop,"


I suggest you not use pop as the first value or last value.

foobar 'media library search' syntax

Reply #7
Thanks, that helps somewhat. If I have files classified as multiple genres (inc pop) and then some files classified as pop only (classified as a single genre), how do I search for the latter without getting the former in the search results?
genre IS pop AND "$meta_num(genre)" IS 1

foobar 'media library search' syntax

Reply #8
Thanks, that helps somewhat. If I have files classified as multiple genres (inc pop) and then some files classified as pop only (classified as a single genre), how do I search for the latter without getting the former in the search results?
genre IS pop AND "$meta_num(genre)" IS 1


Thanks for that. That is quite a complex command to remember. All of this has given me something to chew on. Many thanks to all who responded for your helpful advice

foobar 'media library search' syntax

Reply #9
Thanks, that helps somewhat. If I have files classified as multiple genres (inc pop) and then some files classified as pop only (classified as a single genre), how do I search for the latter without getting the former in the search results?
genre IS pop AND "$meta_num(genre)" IS 1

This part ( AND "$meta_num(genre)" IS 1 ) of the query shouldn't be necessary as genre IS pop should only return results where genre has the singular value of pop.

foobar 'media library search' syntax

Reply #10
This part ( AND "$meta_num(genre)" IS 1 ) of the query shouldn't be necessary as genre IS pop should only return results where genre has the singular value of pop.
That's wrong. genre IS pop returns also results with multiple genre values, where one of them is pop. But, of course, an easier solution would be %genre% IS pop for singular values.

foobar 'media library search' syntax

Reply #11
Now I'm puzzled because the only place I see the behavior you describe is in the Playlist Search. For me, all the various other searches and filters in my setup behave as I described.

EDIT:

While I'm not sure of the exact cause (genre tags were added with Mp3tag or with foobar mostly using TagBox but also Tagger Panel), altering the genre tag and saving it fixes the problem and searching/filtering is behaving as you described.

foobar 'media library search' syntax

Reply #12
Maybe it has something to do with the handling of different ID3 tag versions. Anyway, the behaviour I described is documented in "Query Syntax Help.html", which is shipped with the foobar2000 installation package:
Quote
Using title formatting strings instead of simple field names will decrease search speed on large libraries and break multiple field value handling in the IS operator - for example, a track with two artist names: “name1” and “name2”, will be found by artist IS name1 query, but not by %artist% IS name1.

foobar 'media library search' syntax

Reply #13
The culprit is likely related to Mp3tag albeit with help from me  . I was incorrect when I wrote some of the genre tags were added through foobar. All of them were added with Mp3tag. I do add some custom genre-related tags with foobar. It wasn't until I modified a genre tag with foobar yesterday while investigating OP's question and our subsequent exchange that searching/filtering behaved somewhat as it is supposed to (why only for that file and only in the Playlist Search at first, IDK). Anyhow, further tinkering fixed the issue.

I'm somewhat curious to see if I can re-create the issue, but I wonder if there is any point to doing so. There's a known issue with TDAT frames created with Mp3tag that causes foobar to display it like an additional TYER frame. It was fixed via Mp3tag but the change was reverted. The only way to avoid it is to not use Mp3tag to create the frame because it and the TYER frame will be rewritten as TXXX "DATE" frames with tag modifications performed with foobar. So who knows how any bug I discover related to genre tags may be handled.

Anyway, the inability to search for exact matches within my multi-value genre tags was my biggest peeve with foobar. If I'd only investigated it more thoroughly before now, I wouldn't have had to learn how to use the various library viewers and title formatting

foobar 'media library search' syntax

Reply #14
Have a look into the foobar2000 install folder. There should be an HTML file called "Query Syntax Help" that summarizes the available operators. There's also another one called "titleformat_help" (Title Formatting Syntax Reference) that lists standard fields and functions available.

The packaged files are respectively over four and five years old. The Wiki versions are much more complete and up to date:
http://wiki.hydrogenaudio.org/index.php?ti...tting_Reference
http://wiki.hydrogenaudio.org/index.php?ti...00:Query_syntax