diff --git a/src/harmless.py b/src/harmless.py index dc543f2..235dabe 100644 --- a/src/harmless.py +++ b/src/harmless.py @@ -1,6 +1,7 @@ from . import abstract class HarmlessParser(abstract.AbstractParser): + """ This is the parser for filetypes that do not contain metadata. """ mimetypes = {'application/xml', 'text/plain', 'application/rdf+xml'} def __init__(self, filename: str): diff --git a/src/images.py b/src/images.py index 560886a..93f3ec2 100644 --- a/src/images.py +++ b/src/images.py @@ -32,6 +32,9 @@ class PNGParser(abstract.AbstractParser): return True class GdkPixbufAbstractParser(abstract.AbstractParser): + """ GdkPixbuf can handle a lot of surfaces, so we're rending images on it, + this has the side-effect of removing metadata completely. + """ def get_meta(self): out = subprocess.check_output(['exiftool', '-json', self.filename]) meta = json.loads(out.decode('utf-8'))[0] diff --git a/src/parser_factory.py b/src/parser_factory.py index 812d95c..7fd42d7 100644 --- a/src/parser_factory.py +++ b/src/parser_factory.py @@ -8,6 +8,7 @@ from typing import Type, TypeVar T = TypeVar('T', bound='abstract.AbstractParser') +# This loads every parser in a dynamic way for module_loader, name, ispkg in pkgutil.walk_packages('.src'): if not name.startswith('src.'): continue