diff --git a/libmat2/abstract.py b/libmat2/abstract.py index c531fbd..adf384a 100644 --- a/libmat2/abstract.py +++ b/libmat2/abstract.py @@ -34,7 +34,10 @@ class AbstractParser(abc.ABC): @abc.abstractmethod def get_meta(self) -> Dict[str, Union[str, Dict]]: - """Return all the metadata of the current file""" + """Return all the metadata of the current file + + :raises RuntimeError: Raised if the cleaning process went wrong. + """ @abc.abstractmethod def remove_all(self) -> bool: diff --git a/libmat2/audio.py b/libmat2/audio.py index 4e447c5..2029d9c 100644 --- a/libmat2/audio.py +++ b/libmat2/audio.py @@ -82,6 +82,8 @@ class FLACParser(MutagenParser): with open(fname, 'wb') as f: f.write(picture.data) p, _ = parser_factory.get_parser(fname) # type: ignore + if p is None: + raise ValueError p.sandbox = self.sandbox # Mypy chokes on ternaries :/ meta[name] = p.get_meta() if p else 'harmful data' # type: ignore