diff options
Diffstat (limited to 'lib/audio.py')
| -rw-r--r-- | lib/audio.py | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/lib/audio.py b/lib/audio.py index 20cae6a..18daa7e 100644 --- a/lib/audio.py +++ b/lib/audio.py | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | ''' | 3 | ''' |
| 4 | try: | 4 | try: |
| 5 | from mutagen.flac import FLAC | 5 | from mutagen.flac import FLAC |
| 6 | from mutagen.apev2 import APEv2File | ||
| 7 | from mutagen.oggvorbis import OggVorbis | 6 | from mutagen.oggvorbis import OggVorbis |
| 8 | except ImportError: | 7 | except ImportError: |
| 9 | pass | 8 | pass |
| @@ -57,43 +56,6 @@ class OggStripper(parser.GenericParser): | |||
| 57 | metadata[key] = value | 56 | metadata[key] = value |
| 58 | return metadata | 57 | return metadata |
| 59 | 58 | ||
| 60 | class Apev2Stripper(parser.GenericParser): | ||
| 61 | ''' | ||
| 62 | Represent a Apev2 audio file | ||
| 63 | ''' | ||
| 64 | def remove_all(self): | ||
| 65 | ''' | ||
| 66 | Remove the "metadata" block from the file | ||
| 67 | ''' | ||
| 68 | if self.backup is True: | ||
| 69 | shutil.copy2(self.filename, self.output) | ||
| 70 | self.filename = self.output | ||
| 71 | |||
| 72 | mfile = APEv2File(self.filename) | ||
| 73 | mfile.delete() | ||
| 74 | mfile.save() | ||
| 75 | |||
| 76 | def is_clean(self): | ||
| 77 | ''' | ||
| 78 | Check if the "metadata" block is present in the file | ||
| 79 | ''' | ||
| 80 | mfile = APEv2File(self.filename) | ||
| 81 | if mfile.tags is None: | ||
| 82 | return True | ||
| 83 | else: | ||
| 84 | return False | ||
| 85 | |||
| 86 | def get_meta(self): | ||
| 87 | ''' | ||
| 88 | Return the content of the metadata block if present | ||
| 89 | ''' | ||
| 90 | metadata = {} | ||
| 91 | mfile = APEv2File(self.filename) | ||
| 92 | if mfile.tags is not None: | ||
| 93 | for key, value in mfile.tags: | ||
| 94 | metadata[key] = value | ||
| 95 | return metadata | ||
| 96 | |||
| 97 | 59 | ||
| 98 | class FlacStripper(parser.GenericParser): | 60 | class FlacStripper(parser.GenericParser): |
| 99 | ''' | 61 | ''' |
