diff options
| author | jvoisin | 2020-01-01 17:34:42 +0100 |
|---|---|---|
| committer | jvoisin | 2020-01-01 19:47:46 +0100 |
| commit | ee704db2ffa416c14965ba4bdba7d0842ca2e285 (patch) | |
| tree | 1cef747315e6160043d080e5fd8bcab6fc586244 /libmat2 | |
| parent | 693408f1a6ec6b41c9c60548a06b21af1e302647 (diff) | |
Add support for wav files
Diffstat (limited to '')
| -rw-r--r-- | libmat2/audio.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libmat2/audio.py b/libmat2/audio.py index 1fd58fc..5f0c765 100644 --- a/libmat2/audio.py +++ b/libmat2/audio.py | |||
| @@ -6,7 +6,7 @@ from typing import Dict, Union | |||
| 6 | 6 | ||
| 7 | import mutagen | 7 | import mutagen |
| 8 | 8 | ||
| 9 | from . import abstract, parser_factory | 9 | from . import abstract, parser_factory, video |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | class MutagenParser(abstract.AbstractParser): | 12 | class MutagenParser(abstract.AbstractParser): |
| @@ -77,3 +77,14 @@ class FLACParser(MutagenParser): | |||
| 77 | meta[name] = p.get_meta() if p else 'harmful data' # type: ignore | 77 | meta[name] = p.get_meta() if p else 'harmful data' # type: ignore |
| 78 | os.remove(fname) | 78 | os.remove(fname) |
| 79 | return meta | 79 | return meta |
| 80 | |||
| 81 | |||
| 82 | class WAVParser(video.AbstractFFmpegParser): | ||
| 83 | mimetypes = {'audio/x-wav', } | ||
| 84 | meta_allowlist = {'AvgBytesPerSec', 'BitsPerSample', 'Directory', | ||
| 85 | 'Duration', 'Encoding', 'ExifToolVersion', | ||
| 86 | 'FileAccessDate', 'FileInodeChangeDate', | ||
| 87 | 'FileModifyDate', 'FileName', 'FilePermissions', | ||
| 88 | 'FileSize', 'FileType', 'FileTypeExtension', | ||
| 89 | 'MIMEType', 'NumChannels', 'SampleRate', 'SourceFile', | ||
| 90 | } | ||
