Add metadata tests

This commit is contained in:
Elijah Lopez
2020-08-14 15:19:28 -04:00
parent 6014d1d48b
commit 7589d5fb82
2 changed files with 21 additions and 0 deletions

View File

@@ -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)

View File

@@ -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,