jgillula / paperless-ngx-postprocessor Goto Github PK
View Code? Open in Web Editor NEWA powerful and customizable postprocessing script for paperless-ngx
License: GNU Affero General Public License v3.0
A powerful and customizable postprocessing script for paperless-ngx
License: GNU Affero General Public License v3.0
It'd be grand if the filename could be treated just like the document's content. This comes in handy if there is some sort of naming convention with the filenames and things like doc type, asn, correspondent and even tags are stored in the filename. Especially if coming from a legacy type of working without a DMS like paperless-ngx.
You provided a workaround, info to be found here paperless-ngx/paperless-ngx#1935
Hello,
at first id like to thank you very much for your work. Ive gone into Paperless thinking that renaming the title of the document was a very important feature, since my scanner saves everything as Image_001.pdf.
After lots of experimenting i found out, it can´t do that :D
So here is my problem: I installed it on my Synology Nas with Portainer and as an absolute noob to docker, i don´t understand how to get step 2 of your description to work.
Do i connect inside the Container, navigate to the Script and execute it, or do use a custom command via the console?
Thx in advance!
Hi there,
To automate this part https://github.com/jgillula/paperless-ngx-postprocessor#2-run-the-one-time-setup-script-inside-the-paperless-ngx-docker-container
I think it's better to use https://docs.paperless-ngx.com/advanced_usage/#custom-container-initialization
With this script:
#!/usr/bin/env bash
gosu 1000 /usr/src/paperless/postprocessor/setup_venv.sh
Path to adapt.
Have a nice day,
Hi,
just tring to test the postprocessor. I set it up as described on a fresh docker-compose setup of paperless-ngx.
When I try --help from host commandline I get :
paperless@paperless:~/paperless-ngx-postprocessor$ ./paperlessngx_postprocessor.py --help
Traceback (most recent call last):
File "/home/paperless/paperless-ngx-postprocessor/./paperlessngx_postprocessor.py", line 8, in <module>
from paperlessngx_postprocessor import Config, PaperlessAPI, Postprocessor
File "/home/paperless/paperless-ngx-postprocessor/paperlessngx_postprocessor/__init__.py", line 3, in <module>
from .paperless_api import PaperlessAPI
File "/home/paperless/paperless-ngx-postprocessor/paperlessngx_postprocessor/paperless_api.py", line 1, in <module>
import dateutil.parser
ModuleNotFoundError: No module named 'dateutil'
Seems that there is/are some python modules missing on host level. Since I'm not familiar with python can anybody tell me what ? ... and may be fix this in the docs
I created a rule in rulesets.d/mycustomrule.yml
:
Set owner:
match: True
metadata_postprocessing:
owner: 'myusername'
I successfully verified the rule is processed.
Expectation: For any uploaded document the owner is set to myusername
(which is an existing user).
Actual behavior: The owner is not modified.
Hi,
I want to use regex_sub to extract time information from filenames.
But this function is not working for me, same for example.yml.
I tried in the metadata_postprocessing section:
yy: '{{ "2099-05-4-kaese" | regex_sub(".(\d{4}).","\1") }}'
title: 'test-{{yy}}-end'
There's no error in webserver's log but document arrves in paperless as 'test--end'
I also tried to use re.sub directly, as far as I understood jinja this could be feasible?!?
Any idea?
Best regards
Rüdiger
Originally posted by @cookyr in #3 (comment)
paperless-ngx-postprocessor
should probably give log errors if there's an unsupported field. See, e.g., #10
Hey,
I'm struggling with the installation on my bare metal-installation on raspberry pi OS aarch64.
There is no docker-compose.env, but I am pretty sure the equivalent in my system is "paperless.conf". However, I have not found out what could be the corresponding file to docker-compose.yml and how to get the one time setup script going. Any help is appreciated.
Would be great if we could have negative selectors, e.g. excluding a specific tag on the ./paperlessngx_postprocessor.py process
command, like:
./paperlessngx_postprocessor.py process --exclude_tags "DoNotInclude"
Best regards
Encountered a JSONDecodeError while running the post_consume_script.sh script. The script seems to be having trouble decoding an expected JSON response from the Paperless API.
Steps to Reproduce:
Execute the post_consume_script.sh script.
Monitor the log outputs.
Expected Behavior:
The script should run without errors and be able to correctly fetch document information.
Actual Behavior:
The script throws a JSONDecodeError and exits.
Log Outputs:
[2023-08-30 10:47:44,441] [INFO] [paperless.consumer] Executing post-consume script /usr/src/paperless-ngx-postprocessor/post_consume_script.sh
[2023-08-30 10:47:44,866] [INFO] [paperless.consumer] /usr/src/paperless-ngx-postprocessor/post_consume_script.sh exited 0
[2023-08-30 10:47:44,867] [WARNING] [paperless.consumer] Script stderr:
[2023-08-30 10:47:44,867] [WARNING] [paperless.consumer] Traceback (most recent call last):
[2023-08-30 10:47:44,867] [WARNING] [paperless.consumer] File "/usr/src/paperless-ngx-postprocessor/venv/lib/python3.9/site-packages/requests/models.py", line 971, in json
[2023-08-30 10:47:44,867] [WARNING] [paperless.consumer] return complexjson.loads(self.text, **kwargs)
[2023-08-30 10:47:44,867] [WARNING] [paperless.consumer] File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
[2023-08-30 10:47:44,867] [WARNING] [paperless.consumer] return _default_decoder.decode(s)
[2023-08-30 10:47:44,868] [WARNING] [paperless.consumer] File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
[2023-08-30 10:47:44,868] [WARNING] [paperless.consumer] obj, end = self.raw_decode(s, idx=_w(s, 0).end())
[2023-08-30 10:47:44,868] [WARNING] [paperless.consumer] File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
[2023-08-30 10:47:44,868] [WARNING] [paperless.consumer] raise JSONDecodeError("Expecting value", s, err.value) from None
[2023-08-30 10:47:44,868] [WARNING] [paperless.consumer] json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[2023-08-30 10:47:44,868] [WARNING] [paperless.consumer]
[2023-08-30 10:47:44,869] [WARNING] [paperless.consumer] During handling of the above exception, another exception occurred:
[2023-08-30 10:47:44,869] [WARNING] [paperless.consumer]
[2023-08-30 10:47:44,869] [WARNING] [paperless.consumer] Traceback (most recent call last):
[2023-08-30 10:47:44,869] [WARNING] [paperless.consumer] File "/usr/src/paperless-ngx-postprocessor/paperlessngx_postprocessor.py", line 101, in <module>
[2023-08-30 10:47:44,869] [WARNING] [paperless.consumer] documents.append(api.get_document_by_id(selector_config.get("document_id")))
[2023-08-30 10:47:44,869] [WARNING] [paperless.consumer] File "/usr/src/paperless-ngx-postprocessor/paperlessngx_postprocessor/paperless_api.py", line 150, in get_document_by_id
[2023-08-30 10:47:44,869] [WARNING] [paperless.consumer] return self._get_item_by_id("documents", document_id)
[2023-08-30 10:47:44,870] [WARNING] [paperless.consumer] File "/usr/src/paperless-ngx-postprocessor/paperlessngx_postprocessor/paperless_api.py", line 49, in _get_item_by_id
[2023-08-30 10:47:44,870] [WARNING] [paperless.consumer] return response.json()
[2023-08-30 10:47:44,870] [WARNING] [paperless.consumer] File "/usr/src/paperless-ngx-postprocessor/venv/lib/python3.9/site-packages/requests/models.py", line 975, in json
[2023-08-30 10:47:44,870] [WARNING] [paperless.consumer] raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
[2023-08-30 10:47:44,870] [WARNING] [paperless.consumer] requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
For my title, I want sometimes to use the month of the document. But when I format it, it is in English. Would it be possible to change it through an environment variable or even a variable in the ruleset?
Stating in the docs, added_date_object should be a python date.
But it seems that it does not return a date object, instead a datetime.
The match clause:
match: "{{ added_date_object > date.today() - timedelta(days=2) }}"
results in the following error:
[2023-11-24 09:28:19,163] [WARNING] [paperless.consumer] TypeError: can't compare datetime.datetime to datetime.date
Unfortunately, we can't use datetime as it's not known:
match: "{{ added_date_object > datetime.now() - timedelta(days=2) }}"
gives:
[2023-11-24 09:30:31,962] [WARNING] [paperless.consumer] jinja2.exceptions.UndefinedError: 'datetime' is undefined
I'm not very talented in python, maybe i'm missing something?
Best regards
Hi,
I have able to setup and configure the postprocessor successful and would like to write a ruleset that will read a sequence number from a file and assign it to the title. Is this possible via the ruleset and are there any examples readily available.
Thanks
Hi,
i wanted to ask in regards to custom fields because I could not find any mention of custom fields in the postprocessor (wether or not supported in any way).
My vision:
I'm writing two dates on documents regarding when they got to me and if the document is an invoice when i payed it (if i have to pay manually).
The OCR can already recognize my handwriting today. In my mind i would have written a postprocessor rule which detects this text and copies it into custom fields. Sadly the last part is just not documented if supported and how to do it.
I'm slowly figuring PaperlessNGX and this post-processing script out but I can't seem to figure out why when I manually run this script, the PaperlessNGX logs show this error: [WARNING] [django.request] Not Found: /api/storage_paths/None/
Not sure if I overlooked something, any insight that might point me in the right direction? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.