Move id3_lang key to MP3 class

This commit is contained in:
Thomas Scholtes 2014-02-04 15:48:38 +01:00
parent 709a2693b1
commit 006f7f3ef7

View file

@ -275,18 +275,15 @@ class StorageStyle(object):
- float_places: When the value is a floating-point number and
encoded as a string, the number of digits to store after the
point.
For MP3 only:
- id3_lang: set the language field of the frame object.
"""
def __init__(self, key, as_type=unicode,
packing=None, pack_pos=0,
id3_lang=None, suffix=None, float_places=2):
suffix=None, float_places=2):
self.key = key
self.as_type = as_type
self.packing = packing
self.pack_pos = pack_pos
self.id3_lang = id3_lang
self.suffix = suffix
self.float_places = float_places
@ -459,8 +456,13 @@ class MP4StorageStyle(StorageStyle):
value = value.encode('utf8')
return value
class MP3StorageStyle(StorageStyle):
def __init__(self, key, id3_lang=None, **kwargs):
self.id3_lang = id3_lang
super(MP3StorageStyle, self).__init__(key, **kwargs)
def fetch(self, mediafile):
try:
frame = mediafile.mgfile[self.key]
@ -477,6 +479,7 @@ class MP3StorageStyle(StorageStyle):
frame = mutagen.id3.Frames[self.key](encoding=3, text=[value])
mediafile.mgfile.tags.setall(self.key, [frame])
class MP3UFIDStorageStyle(MP3StorageStyle):
def __init__(self, owner, **kwargs):