diff options
| author | jvoisin | 2018-04-02 23:40:08 +0200 |
|---|---|---|
| committer | jvoisin | 2018-04-02 23:40:08 +0200 |
| commit | 04a0032e9fef6453b293cbba1464125662eba776 (patch) | |
| tree | 48d95ee81687c108c16b19e00559acdbacc89039 /src | |
| parent | b5a5535e3fbad7abb6551655e8fe463fd7e0a09d (diff) | |
Add some comments
Diffstat (limited to 'src')
| -rw-r--r-- | src/harmless.py | 1 | ||||
| -rw-r--r-- | src/images.py | 3 | ||||
| -rw-r--r-- | src/parser_factory.py | 1 |
3 files changed, 5 insertions, 0 deletions
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 @@ | |||
| 1 | from . import abstract | 1 | from . import abstract |
| 2 | 2 | ||
| 3 | class HarmlessParser(abstract.AbstractParser): | 3 | class HarmlessParser(abstract.AbstractParser): |
| 4 | """ This is the parser for filetypes that do not contain metadata. """ | ||
| 4 | mimetypes = {'application/xml', 'text/plain', 'application/rdf+xml'} | 5 | mimetypes = {'application/xml', 'text/plain', 'application/rdf+xml'} |
| 5 | 6 | ||
| 6 | def __init__(self, filename: str): | 7 | 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): | |||
| 32 | return True | 32 | return True |
| 33 | 33 | ||
| 34 | class GdkPixbufAbstractParser(abstract.AbstractParser): | 34 | class GdkPixbufAbstractParser(abstract.AbstractParser): |
| 35 | """ GdkPixbuf can handle a lot of surfaces, so we're rending images on it, | ||
| 36 | this has the side-effect of removing metadata completely. | ||
| 37 | """ | ||
| 35 | def get_meta(self): | 38 | def get_meta(self): |
| 36 | out = subprocess.check_output(['exiftool', '-json', self.filename]) | 39 | out = subprocess.check_output(['exiftool', '-json', self.filename]) |
| 37 | meta = json.loads(out.decode('utf-8'))[0] | 40 | 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 | |||
| 8 | 8 | ||
| 9 | T = TypeVar('T', bound='abstract.AbstractParser') | 9 | T = TypeVar('T', bound='abstract.AbstractParser') |
| 10 | 10 | ||
| 11 | # This loads every parser in a dynamic way | ||
| 11 | for module_loader, name, ispkg in pkgutil.walk_packages('.src'): | 12 | for module_loader, name, ispkg in pkgutil.walk_packages('.src'): |
| 12 | if not name.startswith('src.'): | 13 | if not name.startswith('src.'): |
| 13 | continue | 14 | continue |
