1
0
mirror of synced 2024-11-25 18:54:22 +01:00

Add some comments

This commit is contained in:
jvoisin 2018-04-02 23:40:08 +02:00
parent b5a5535e3f
commit 04a0032e9f
3 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,7 @@
from . import abstract from . import abstract
class HarmlessParser(abstract.AbstractParser): class HarmlessParser(abstract.AbstractParser):
""" This is the parser for filetypes that do not contain metadata. """
mimetypes = {'application/xml', 'text/plain', 'application/rdf+xml'} mimetypes = {'application/xml', 'text/plain', 'application/rdf+xml'}
def __init__(self, filename: str): def __init__(self, filename: str):

View File

@ -32,6 +32,9 @@ class PNGParser(abstract.AbstractParser):
return True return True
class GdkPixbufAbstractParser(abstract.AbstractParser): 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): def get_meta(self):
out = subprocess.check_output(['exiftool', '-json', self.filename]) out = subprocess.check_output(['exiftool', '-json', self.filename])
meta = json.loads(out.decode('utf-8'))[0] meta = json.loads(out.decode('utf-8'))[0]

View File

@ -8,6 +8,7 @@ from typing import Type, TypeVar
T = TypeVar('T', bound='abstract.AbstractParser') T = TypeVar('T', bound='abstract.AbstractParser')
# This loads every parser in a dynamic way
for module_loader, name, ispkg in pkgutil.walk_packages('.src'): for module_loader, name, ispkg in pkgutil.walk_packages('.src'):
if not name.startswith('src.'): if not name.startswith('src.'):
continue continue