support some alternate ogg field names

This commit is contained in:
Adrian Sampson 2010-06-26 02:12:55 -07:00
parent f944952300
commit f8c8bff694
3 changed files with 13 additions and 2 deletions

View file

@ -538,7 +538,8 @@ class MediaFile(object):
mp4 = StorageStyle('disk',
packing = packing.TUPLE,
pack_pos = 0),
etc = StorageStyle('disc')
etc = [StorageStyle('disc'),
StorageStyle('discnumber')]
)
disctotal = MediaField(out_type = int,
mp3 = StorageStyle('TPOS',
@ -547,7 +548,8 @@ class MediaFile(object):
mp4 = StorageStyle('disk',
packing = packing.TUPLE,
pack_pos = 1),
etc = StorageStyle('disctotal')
etc = [StorageStyle('disctotal'),
StorageStyle('discc')]
)
lyrics = MediaField(
mp3 = StorageStyle('USLT',

BIN
test/rsrc/discc.ogg Normal file

Binary file not shown.

View file

@ -253,6 +253,14 @@ class EdgeTest(unittest.TestCase):
# rather than just a number.
f = beets.mediafile.MediaFile(os.path.join('rsrc', 'bpm.mp3'))
self.assertEqual(f.bpm, 128)
def test_discc_alternate_field(self):
# Different taggers use different vorbis comments to reflect
# the disc and disc count fields: ensure that the alternative
# style works.
f = beets.mediafile.MediaFile(os.path.join('rsrc', 'discc.ogg'))
self.assertEqual(f.disc, 4)
self.assertEqual(f.disctotal, 5)
test_files = {
'm4a': ['full', 'partial', 'min'],
@ -291,6 +299,7 @@ def suite():
s.addTest(EdgeTest('test_release_time_with_t'))
s.addTest(EdgeTest('test_release_time_with_space'))
s.addTest(EdgeTest('test_tempo_with_bpm'))
s.addTest(EdgeTest('test_discc_alternate_field'))
return s