Using bitrate_mode in beet list

I can do beet ls -f '${bitrate} and get the output I expect, a list of all the bitrates in the library. But when I do beet ls -f '${bitrate_mode}, I just get a long list of literal ${bitrate_mode} as output. Why? Is this expected? Is it a bug? I’m using beets 1.6.0. Thanks for any help or ideas!!

What version of beets are you on? bitrate_mode is only available on the development branch at the moment, a release containing it hasn’t been pushed out yet.

See the FAQ on running the latest source version for instructions on how to try this version out (be sure to keep a backup of your library!).

1 Like

I see! I found the field using the info plugin. I didn’t realize it wasn’t necessarily possible to query on all those fields. I see now that the field is not listed in the output of beet fields. So, the basic rule is that you can only query based on the officially supported fields, even if the file itself contains other tags? Is there a way to fall back on a full scan of the library for a particular tag?

Thanks for the reply, this already gave me a better understanding of the beets approach!

I agree it’s not obvious that you can’t query using all fields output by beet info.

For some context, the reason behind this is that the info command without -l or -a uses raw file tags (provided by mediafile) instead of pulling them from the beets database, but queries can only be performed on fields present in the database (which bitrate_mode will be in the next release).

If you use beet info -l or beet info -a it will display data from the database instead of from the audio files themselves - you should be able to query using all of these fields.

3 Likes

Makes sense. It seems like it might be nice to have a flag or a separate command that actually does support doing a full library scan. Of course it could take a long time, but the only alternative is to scrape the tags yourself and do a grep/awk thing, which is certainly going to take just as long!

1 Like

To tease out the implication, based on this thread (not my own knowledge):

beet ls uses the beets database. This uses a technology called SQL, which is able to create results very fast.

beet info “without -l or -a uses raw file tags”. That means the beet program is going file by file on your drive, opening the part of the file that has tags, and returning the info you asked for. This is significantly slower, because there is a lot of info the program has to look through and toss out before it finds the info you need.

That seems to be correct.

As a side note, it’s still surprising to me that there’s no way to coax beet ls to even use file tags when you format the output. I can understand not supporting queries against the raw files, but once you’ve selected the things to display, it would be nice if there were a way to include those tags in the formatted output.