summaryrefslogtreecommitdiff
path: root/libmat/audio.py
diff options
context:
space:
mode:
Diffstat (limited to 'libmat/audio.py')
-rw-r--r--libmat/audio.py53
1 files changed, 0 insertions, 53 deletions
diff --git a/libmat/audio.py b/libmat/audio.py
deleted file mode 100644
index 2747dc1..0000000
--- a/libmat/audio.py
+++ /dev/null
@@ -1,53 +0,0 @@
1""" Care about audio fileformat
2"""
3
4try:
5 from mutagen.flac import FLAC
6 from mutagen.oggvorbis import OggVorbis
7except ImportError:
8 pass
9
10import parser
11import mutagenstripper
12
13
14class MpegAudioStripper(parser.GenericParser):
15 """ Represent mpeg audio file (mp3, ...)
16 """
17 def _should_remove(self, field):
18 return field.name in ("id3v1", "id3v2")
19
20
21class OggStripper(mutagenstripper.MutagenStripper):
22 """ Represent an ogg vorbis file
23 """
24 def _create_mfile(self):
25 self.mfile = OggVorbis(self.filename)
26
27
28class FlacStripper(mutagenstripper.MutagenStripper):
29 """ Represent a Flac audio file
30 """
31 def _create_mfile(self):
32 self.mfile = FLAC(self.filename)
33
34 def remove_all(self):
35 """ Remove the "metadata" block from the file
36 """
37 super(FlacStripper, self).remove_all()
38 self.mfile.clear_pictures()
39 self.mfile.save()
40 return True
41
42 def is_clean(self):
43 """ Check if the "metadata" block is present in the file
44 """
45 return super(FlacStripper, self).is_clean() and not self.mfile.pictures
46
47 def get_meta(self):
48 """ Return the content of the metadata block if present
49 """
50 metadata = super(FlacStripper, self).get_meta()
51 if self.mfile.pictures:
52 metadata['picture:'] = 'yes'
53 return metadata