1
0
mirror of synced 2024-11-22 01:04:23 +01:00

FLAC support

This commit is contained in:
jvoisin 2018-03-25 16:20:45 +02:00
parent 19a8fd97aa
commit 2eb68928d5
3 changed files with 23 additions and 0 deletions

View File

@ -33,3 +33,6 @@ class MP3Parser(MutagenParser):
class OGGParser(MutagenParser):
mimetypes = {'audio/ogg', }
class FLACParser(MutagenParser):
mimetypes = {'audio/flac', }

BIN
tests/data/dirty.flac Normal file

Binary file not shown.

View File

@ -35,6 +35,11 @@ class TestGetMeta(unittest.TestCase):
meta = p.get_meta()
self.assertEqual(meta['TITLE'], ['I am so'])
def test_flac(self):
p = audio.FLACParser('./tests/data/dirty.flac')
meta = p.get_meta()
self.assertEqual(meta['TITLE'], ['I am so'])
class TestCleaning(unittest.TestCase):
def test_pdf(self):
@ -112,3 +117,18 @@ class TestCleaning(unittest.TestCase):
self.assertEqual(p.get_meta(), {})
os.remove('./tests/data/clean.ogg')
def test_flac(self):
shutil.copy('./tests/data/dirty.flac', './tests/data/clean.flac')
p = audio.FLACParser('./tests/data/clean.flac')
meta = p.get_meta()
self.assertEqual(meta['TITLE'], ['I am so'])
ret = p.remove_all()
self.assertTrue(ret)
p = audio.FLACParser('./tests/data/clean.flac.cleaned')
self.assertEqual(p.get_meta(), {})
os.remove('./tests/data/clean.flac')