# How to access flex attributes outside of Beets?

**URL:** <https://discourse.beets.io/t/how-to-access-flex-attributes-outside-of-beets/188>\
**Category:** Help\
**Created:** [September 25, 2017, 5:07am UTC](https://discourse.beets.io/t/how-to-access-flex-attributes-outside-of-beets/188 "2017-09-25T05:07:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgeh](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/georgeh/32/74_2.png) [@georgeh](https://discourse.beets.io/u/georgeh)\
**Post date:** [September 25, 2017, 5:07am UTC](https://discourse.beets.io/t/how-to-access-flex-attributes-outside-of-beets/188/1 "2017-09-25T05:07:12Z")

</div>

I’m using beets to clean and store metadata for a project I’m working on. Based on the discussion [here](https://discourse.beets.io/t/custom-rest-api-for-beets-similar-to-aura/175), 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](http://beets.io/blog/flexattr.html). 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.)

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [September 25, 2017, 8:18am UTC](https://discourse.beets.io/t/how-to-access-flex-attributes-outside-of-beets/188/2 "2017-09-25T08:18:52Z")

</div>

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](https://github.com/beetbox/beets/pull/2641)

---

<div class="post-metadata">

**Author:** ![georgeh](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/georgeh/32/74_2.png) [@georgeh](https://discourse.beets.io/u/georgeh)\
**Post date:** [September 26, 2017, 2:54am UTC](https://discourse.beets.io/t/how-to-access-flex-attributes-outside-of-beets/188/3 "2017-09-26T02:54:44Z")

</div>

Will take a look at that discussion.
