From a60935ed1c69993c0739c41d6c0afb3febbd03c5 Mon Sep 17 00:00:00 2001 From: Rainer Hihn Date: Mon, 22 Apr 2019 19:50:11 +0200 Subject: [PATCH] Prevent scientific notation --- beetsplug/acousticbrainz.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/beetsplug/acousticbrainz.py b/beetsplug/acousticbrainz.py index f4960c301..bbbd098c7 100644 --- a/beetsplug/acousticbrainz.py +++ b/beetsplug/acousticbrainz.py @@ -17,9 +17,10 @@ """ from __future__ import division, absolute_import, print_function +from collections import defaultdict + import requests -from collections import defaultdict from beets import plugins, ui ACOUSTIC_BASE = "https://acousticbrainz.org/" @@ -101,6 +102,10 @@ ABSCHEME = { } } +FLOAT_FIELDS = ['danceable', 'mood_acoustic', 'mood_aggressive', + 'mood_electronic', 'mood_happy', 'mood_party', 'mood_relaxed', + 'mood_sad', 'tonal', 'average_loudness', 'chords_changes_rate', + 'chords_number_rate', 'key_strength'] class AcousticPlugin(plugins.BeetsPlugin): @@ -186,6 +191,8 @@ class AcousticPlugin(plugins.BeetsPlugin): if data: for attr, val in self._map_data_to_scheme(data, ABSCHEME): if not tags or attr in tags: + if attr in FLOAT_FIELDS: + val = '%f' % val self._log.debug(u'attribute {} of {} set to {}', attr, item,