mirror of
https://github.com/beetbox/beets.git
synced 2025-12-26 02:24:33 +01:00
added PaddingFloat
This commit is contained in:
parent
76e333c054
commit
3f3b102885
2 changed files with 18 additions and 7 deletions
|
|
@ -183,6 +183,17 @@ class Float(Type):
|
|||
return u'{0:.1f}'.format(value or 0.0)
|
||||
|
||||
|
||||
class PaddedFloat(Integer):
|
||||
"""A float field that is formatted with a given number of digits,
|
||||
padded with zeroes.
|
||||
"""
|
||||
def __init__(self, digits):
|
||||
self.digits = digits
|
||||
|
||||
def format(self, value):
|
||||
return u'{0:0{1}d}'.format(value or 0, self.digits)
|
||||
|
||||
|
||||
class NullFloat(Float):
|
||||
"""Same as `Float`, but does not normalize `None` to `0.0`.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -117,13 +117,13 @@ class AcousticPlugin(plugins.BeetsPlugin):
|
|||
'genre_rosamerica': types.STRING,
|
||||
'initial_key': types.STRING,
|
||||
'key_strength': types.FLOAT,
|
||||
'mood_acoustic': types.FLOAT,
|
||||
'mood_aggressive': types.FLOAT,
|
||||
'mood_electronic': types.FLOAT,
|
||||
'mood_happy': types.FLOAT,
|
||||
'mood_party': types.FLOAT,
|
||||
'mood_relaxed': types.FLOAT,
|
||||
'mood_sad': types.FLOAT,
|
||||
'mood_acoustic': types.PaddedInt(6),
|
||||
'mood_aggressive': types.PaddedInt(6),
|
||||
'mood_electronic': types.PaddedInt(6),
|
||||
'mood_happy': types.PaddedInt(6),
|
||||
'mood_party': types.PaddedInt(6),
|
||||
'mood_relaxed': types.PaddedInt(6),
|
||||
'mood_sad': types.PaddedInt(6),
|
||||
'rhythm': types.FLOAT,
|
||||
'tonal': types.FLOAT,
|
||||
'voice_instrumental': types.STRING,
|
||||
|
|
|
|||
Loading…
Reference in a new issue