Add some comments
This commit is contained in:
parent
b5a5535e3f
commit
04a0032e9f
@ -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):
|
||||||
|
@ -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]
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user