How to access flex attributes outside of Beets?

I’m using beets to clean and store metadata for a project I’m working on. Based on the discussion here, it looks like I’m best off to do my queries and so forth outside beets, but to rely on that database. No problem.

Except that after a fair bit of searching, I cannot find two attributes that I would like to use: play count and last played. Again, shouldn’t be a problem. I read about flex attributes. Unfortunately, I can’t quite figure out where the data in the flex attrs are actually stored, nor how to access the data without a command line beets query.

Any thoughts about what I should be looking for/at?

(Project is: building a MAME cab got me to thinking how much I missed my jukeboxes. So I’m building a digital one. A riff on old school 45 playing jukes, not the modern ones out of a sci fi set. In order to create ‘hot’ tunes I’ll use play counts and most recently played items. I also need a field for an attribute indicating whether or not to create virtual title strips for a given song, letting me rotate songs in an out for whatever reason.)

Interesting project! If I were you, I’d probably try writing a custom beets plugin—that’s an easy way to get access to all the data with minimal fuss. Barring that, though, I’d also consider writing a Python program that starts with import beets and goes from there. We don’t have great documentation yet on this latter path, but some discussion has recently started about an example “external app” here: https://github.com/beetbox/beets/pull/2641

Will take a look at that discussion.