diff options
| author | jvoisin | 2021-12-18 19:43:21 +0100 |
|---|---|---|
| committer | jvoisin | 2021-12-18 19:43:21 +0100 |
| commit | 143bb0a5f327d97403a37cc0a166ec7100bba3de (patch) | |
| tree | ed5471116c8900a120cb2d83898157ec4a46d1be | |
| parent | a1a7c76dc94c6ae65cd2394b03762db93e1762b7 (diff) | |
Add a check for weird audio files, instead of crashing
| -rw-r--r-- | libmat2/audio.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libmat2/audio.py b/libmat2/audio.py index 09e1146..16b86f0 100644 --- a/libmat2/audio.py +++ b/libmat2/audio.py | |||
| @@ -41,6 +41,9 @@ class MP3Parser(MutagenParser): | |||
| 41 | if not meta: | 41 | if not meta: |
| 42 | return metadata | 42 | return metadata |
| 43 | for key in meta: | 43 | for key in meta: |
| 44 | if isinstance(key, tuple): | ||
| 45 | metadata[key[0]] = key[1] | ||
| 46 | continue | ||
| 44 | if not hasattr(meta[key], 'text'): # pragma: no cover | 47 | if not hasattr(meta[key], 'text'): # pragma: no cover |
| 45 | continue | 48 | continue |
| 46 | metadata[key.rstrip(' \t\r\n\0')] = ', '.join(map(str, meta[key].text)) | 49 | metadata[key.rstrip(' \t\r\n\0')] = ', '.join(map(str, meta[key].text)) |
