Code Monkey home page Code Monkey logo

paperless-ngx-postprocessor's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

paperless-ngx-postprocessor's Issues

py issue running management help

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

Cannot set owner

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.

Add capability to extract metadata directly from the filename

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

How to set document title to next sequence number

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

Portainer

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?
image

Thx in advance!

added_date_object is not a python date?

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

[Discussion] Custom Fields

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.

Negative selectors?

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

JSONDecodeError When Retrieving Document Information

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:

  1. Execute the post_consume_script.sh script.

  2. 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)

Define locale for templating

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.