mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-12 17:47:08 +01:00
24 lines
469 B
Python
24 lines
469 B
Python
|
|
import re
|
||
|
|
|
||
|
|
from .parsers import RasterisedDocumentParser
|
||
|
|
|
||
|
|
|
||
|
|
class ConsumerDeclaration(object):
|
||
|
|
|
||
|
|
MATCHING_FILES = re.compile("^.*\.(pdf|jpg|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):
|
||
|
|
return {
|
||
|
|
"parser": RasterisedDocumentParser,
|
||
|
|
"weight": 0
|
||
|
|
}
|
||
|
|
|
||
|
|
return None
|