Delete pictures of FLAC files
This commit is contained in:
parent
35dca4bf1c
commit
b2e153b69c
@ -44,3 +44,17 @@ class OGGParser(MutagenParser):
|
||||
|
||||
class FLACParser(MutagenParser):
|
||||
mimetypes = {'audio/flac', 'audio/x-flac'}
|
||||
|
||||
def remove_all(self):
|
||||
shutil.copy(self.filename, self.output_filename)
|
||||
f = mutagen.File(self.output_filename)
|
||||
f.clear_pictures()
|
||||
f.delete()
|
||||
f.save(deleteid3=True)
|
||||
return True
|
||||
|
||||
def get_meta(self):
|
||||
meta = super().get_meta()
|
||||
if mutagen.File(self.filename).pictures:
|
||||
meta['Picture'] = 'Cover'
|
||||
return meta
|
||||
|
Binary file not shown.
@ -96,6 +96,7 @@ class TestGetMeta(unittest.TestCase):
|
||||
p = audio.FLACParser('./tests/data/dirty.flac')
|
||||
meta = p.get_meta()
|
||||
self.assertEqual(meta['title'], 'I am so')
|
||||
self.assertEqual(meta['Picture'], 'Cover')
|
||||
|
||||
def test_docx(self):
|
||||
p = office.MSOfficeParser('./tests/data/dirty.docx')
|
||||
|
Loading…
Reference in New Issue
Block a user