mirror of
https://github.com/iluvcapra/wavinfo.git
synced 2025-12-31 08:50:41 +00:00
Add metadata tests
This commit is contained in:
@@ -93,3 +93,22 @@ class TestWaveInfo(TestCase):
|
||||
self.assertIsNotNone(track.channel_index)
|
||||
if basename == 'A101_4.WAV' and track.channel_index == '1':
|
||||
self.assertEqual(track.name, 'MKH516 A')
|
||||
|
||||
def test_metadata(self):
|
||||
file_with_metadata = 'tests/test_files/sound_grinder_pro/new_camera bumb 1.wav'
|
||||
self.assertTrue(os.path.exists(file_with_metadata))
|
||||
info = wavinfo.WavInfoReader(file_with_metadata).info
|
||||
self.assertEqual(info.title, 'camera bumb 1')
|
||||
self.assertEqual(info.artist, 'Jamie Hardt')
|
||||
self.assertEqual(info.copyright, '© 2010 Jamie Hardt')
|
||||
self.assertEqual(info.product, 'Test Sounds') # album
|
||||
self.assertEqual(info.album, info.product)
|
||||
self.assertEqual(info.comment, 'Comments')
|
||||
self.assertEqual(info.software, 'Sound Grinder Pro')
|
||||
self.assertEqual(info.created_date, '2010-12-28')
|
||||
self.assertEqual(info.engineer, 'JPH')
|
||||
self.assertEqual(info.keywords, 'Sound Effect, movement, microphone, bump')
|
||||
self.assertEqual(info.title, 'camera bumb 1')
|
||||
self.assertEqual(type(info.to_dict()), dict)
|
||||
self.assertEqual(type(info.__repr__()), str)
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ class WavInfoChunkReader:
|
||||
self.copyright = self._get_field(f, b'ICOP')
|
||||
#: 'IPRD' Product
|
||||
self.product = self._get_field(f, b'IPRD')
|
||||
self.album = self.product
|
||||
#: 'IGNR' Genre
|
||||
self.genre = self._get_field(f, b'IGNR')
|
||||
#: 'ISBJ' Supject
|
||||
@@ -63,6 +64,7 @@ class WavInfoChunkReader:
|
||||
"""
|
||||
return {'copyright': self.copyright,
|
||||
'product': self.product,
|
||||
'album': self.album,
|
||||
'genre': self.genre,
|
||||
'artist': self.artist,
|
||||
'comment': self.comment,
|
||||
|
||||
Reference in New Issue
Block a user