diff options
Diffstat (limited to 'src/parsers/audio.py')
| -rw-r--r-- | src/parsers/audio.py | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/parsers/audio.py b/src/parsers/audio.py deleted file mode 100644 index 4da298c..0000000 --- a/src/parsers/audio.py +++ /dev/null | |||
| @@ -1,37 +0,0 @@ | |||
| 1 | import subprocess | ||
| 2 | import shutil | ||
| 3 | import json | ||
| 4 | |||
| 5 | import mutagen | ||
| 6 | |||
| 7 | from . import abstract | ||
| 8 | |||
| 9 | class MutagenParser(abstract.AbstractParser): | ||
| 10 | def get_meta(self): | ||
| 11 | f = mutagen.File(self.filename) | ||
| 12 | if f.tags: | ||
| 13 | return f.tags | ||
| 14 | return {} | ||
| 15 | |||
| 16 | def remove_all(self): | ||
| 17 | shutil.copy(self.filename, self.output_filename) | ||
| 18 | f = mutagen.File(self.output_filename) | ||
| 19 | f.delete() | ||
| 20 | f.save() | ||
| 21 | return True | ||
| 22 | |||
| 23 | class MP3Parser(MutagenParser): | ||
| 24 | mimetypes = {'audio/mpeg', } | ||
| 25 | |||
| 26 | def get_meta(self): | ||
| 27 | meta = super().get_meta() | ||
| 28 | metadata = {} | ||
| 29 | for key in meta: | ||
| 30 | metadata[key] = meta[key].text | ||
| 31 | return metadata | ||
| 32 | |||
| 33 | class OGGParser(MutagenParser): | ||
| 34 | mimetypes = {'audio/ogg', } | ||
| 35 | |||
| 36 | class FLACParser(MutagenParser): | ||
| 37 | mimetypes = {'audio/flac', } | ||
