FLAC support
This commit is contained in:
parent
19a8fd97aa
commit
2eb68928d5
@ -33,3 +33,6 @@ class MP3Parser(MutagenParser):
|
|||||||
|
|
||||||
class OGGParser(MutagenParser):
|
class OGGParser(MutagenParser):
|
||||||
mimetypes = {'audio/ogg', }
|
mimetypes = {'audio/ogg', }
|
||||||
|
|
||||||
|
class FLACParser(MutagenParser):
|
||||||
|
mimetypes = {'audio/flac', }
|
||||||
|
BIN
tests/data/dirty.flac
Normal file
BIN
tests/data/dirty.flac
Normal file
Binary file not shown.
@ -35,6 +35,11 @@ class TestGetMeta(unittest.TestCase):
|
|||||||
meta = p.get_meta()
|
meta = p.get_meta()
|
||||||
self.assertEqual(meta['TITLE'], ['I am so'])
|
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):
|
class TestCleaning(unittest.TestCase):
|
||||||
def test_pdf(self):
|
def test_pdf(self):
|
||||||
@ -112,3 +117,18 @@ class TestCleaning(unittest.TestCase):
|
|||||||
self.assertEqual(p.get_meta(), {})
|
self.assertEqual(p.get_meta(), {})
|
||||||
|
|
||||||
os.remove('./tests/data/clean.ogg')
|
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')
|
||||||
|
Loading…
Reference in New Issue
Block a user