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