mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-05 18:58:34 -05:00
24 lines
472 B
Python
24 lines
472 B
Python
import re
|
|
|
|
from .parsers import RasterisedDocumentParser
|
|
|
|
|
|
class ConsumerDeclaration:
|
|
|
|
MATCHING_FILES = re.compile("^.*\.(pdf|jpe?g|gif|png|tiff?|pnm|bmp)$")
|
|
|
|
@classmethod
|
|
def handle(cls, sender, **kwargs):
|
|
return cls.test
|
|
|
|
@classmethod
|
|
def test(cls, doc):
|
|
|
|
if cls.MATCHING_FILES.match(doc.lower()):
|
|
return {
|
|
"parser": RasterisedDocumentParser,
|
|
"weight": 0
|
|
}
|
|
|
|
return None
|