pauper
September 28, 2018, 11:17pm
1
Trying to weed out tracks with acousticbrainz values stored as strings as per this issue:
opened 05:45PM - 13 Jan 18 UTC
closed 03:53PM - 30 Apr 19 UTC
bug
### Problem
Using the acousticbrainz plugin (I don't know if it's specific to… it, it might be a wider issue), when storing really small values, they end up formatted in an exponential style, e.g. `1.82764233614e-05`. As a result, the whole (flexible, in this case) attribute ends up being treated as a string - which forbids using ranges in query, for example.
Here's an example with the recording `9dcdb20b-3bdf-4d1f-842f-d3cb545bea28` on MusicBrainz. The `mood_happy` probability is really low on AcousticBrainz: http://acousticbrainz.org/api/v1/9dcdb20b-3bdf-4d1f-842f-d3cb545bea28/high-level?n=0 (field value is `0.0000182764233614`). In beets, it ends up being stored as `1.82764233614e-05`:
```sh
$ beet -vv acousticbrainz M83 Ludivine -f
user configuration: /root/.config/beets/config.yaml
data directory: /root/.config/beets
plugin paths: /root/.config/beets/beets-alternatives/beetsplug
Sending event: pluginload
lyrics: Disabling google source: no API key configured.
inline: adding item field disc_with_title
inline: adding album field spinnin_catalognum
library database: /root/.config/beets/beets.blb
library directory: /media/sao/Musique
Sending event: library_opened
acousticbrainz: getting data for: M83 - Junk - Ludivine
acousticbrainz: fetching URL: https://acousticbrainz.org/9dcdb20b-3bdf-4d1f-842f-d3cb545bea28/low-level
acousticbrainz: fetching URL: https://acousticbrainz.org/9dcdb20b-3bdf-4d1f-842f-d3cb545bea28/high-level
acousticbrainz: attribute danceable of M83 - Junk - Ludivine set to 0.00766881043091
acousticbrainz: attribute gender of M83 - Junk - Ludivine set to male
acousticbrainz: attribute genre_rosamerica of M83 - Junk - Ludivine set to cla
acousticbrainz: attribute mood_acoustic of M83 - Junk - Ludivine set to 0.995353162289
acousticbrainz: attribute mood_aggressive of M83 - Junk - Ludivine set to 0.042748786509
acousticbrainz: attribute mood_electronic of M83 - Junk - Ludivine set to 0.0935237780213
acousticbrainz: attribute mood_happy of M83 - Junk - Ludivine set to 1.82764233614e-05
acousticbrainz: attribute mood_party of M83 - Junk - Ludivine set to 0.0153690651059
acousticbrainz: attribute mood_relaxed of M83 - Junk - Ludivine set to 0.987963736057
acousticbrainz: attribute mood_sad of M83 - Junk - Ludivine set to 0.956809282303
acousticbrainz: attribute rhythm of M83 - Junk - Ludivine set to Tango
acousticbrainz: attribute tonal of M83 - Junk - Ludivine set to 0.435981780291
acousticbrainz: attribute voice_instrumental of M83 - Junk - Ludivine set to instrumental
acousticbrainz: attribute average_loudness of M83 - Junk - Ludivine set to 0.753472864628
acousticbrainz: attribute bpm of M83 - Junk - Ludivine set to 106.67628479
acousticbrainz: attribute chords_changes_rate of M83 - Junk - Ludivine set to 0.0346172600985
acousticbrainz: attribute chords_key of M83 - Junk - Ludivine set to D
acousticbrainz: attribute chords_number_rate of M83 - Junk - Ludivine set to 0.00487567018718
acousticbrainz: attribute chords_scale of M83 - Junk - Ludivine set to major
acousticbrainz: attribute key_strength of M83 - Junk - Ludivine set to 0.704598069191
acousticbrainz: attribute initial_key of M83 - Junk - Ludivine set to F# minor
Sending event: database_change
Sending event: write
```
### Setup
* OS: Linux
* Python version: 3.6.4
* beets version: 1.4.6
* Turning off plugins made problem go away (yes/no): irrelevant, I guess
My configuration (output of `beet config`) is: probably irrelevant too, I just have the plugin enabled without any configuration.
I’m having trouble getting the query right to search all fields:
beet list -f ‘$path’ “:.[0-9]+e-[0-9]{2}$”
produces no results, but:
beet list -f ‘$path’ “mood_aggressive::.[0-9]+e-[0-9]{2}$”
will show tracks with these string values for mood_aggressive (or any single specified field). Am I doing something wrong?
adrian
September 29, 2018, 1:46pm
2
Using a single leading : will search across all the default fields (i.e., the same set of fields as a plain, non-prefixed query). For example:
$ beet ls ':99[\d\s]'
Crystal Castles - Crystal Castles - 1991
DJ Danger Mouse - The Grey Album - 99 Problems
We don’t currently have a way to express a query that searches across all fields, including those flexible attributes defined by a plugin. That could be an interesting addition, though!
pauper
September 29, 2018, 6:14pm
3
I knew there was something I musn’t have been understanding. It’d be great if that could be incorporated in a future release.