the-paperless-project / paperless

Scan, index, and archive all of your paper documents
GNU General Public License v3.0
7.85k stars 498 forks source link

Usage of tags in PAPERLESS_FILENAME_FORMAT #650

Open totti4ever opened 4 years ago

totti4ever commented 4 years ago

Hey guys and maybe @BastianPoe,

I love the new feature with templating the naming convention of the files, thanks @BastianPoe !!

Though, I was wondering how exactly to use the {tags[KEY/INDEX]} feature. I tried to use {tags[2]} and also {tags[Bills]}, because I do have a tag called Bills-Water for example and hoped this somehow would work. But in both cases the result is none :-/

totti4ever commented 4 years ago

Okay, I figured out a bit..

  1. using the key-method one has to use the slugified key, i.e. especially lower case, which was my fault with {tags[Bills]}
  2. the index method actually goes back to the order of the tags of the document, i.e. if the tag B is assigned first it'll be used for {tags[0]} even if tag A has the id 0 system-wide. I was wondering what this is the use case for, specially when one cannot change the order and has no influence (?!) on the automatically assigned tags

What I would derive as change propositions from this is

  1. let the user change the order of the assigned tags
  2. make an option to set a default if no value is found (currently none is used. This would help if one doesn't know how many tags documents have assigned to not have none in the name quite often. Maybe one could use {correspondent|unknown}?
  3. I still cannot really work with subdirectories as I would need at least the key available as folder as well, e.g. Bills-Water, Bills-Electricity, Work-Tax, Work-Other, Insurance-Life, ... I might be able to achieve this by using technical tags like 1-Bills, 2-Water and 1-Work, 2-Tax. Combining this with 2, one could set .\ as default, to not add any subdirectory if tag resolves to none
  4. Please make it possible or better remove by default that the minutes, seconds and even more are used for the created field!
totti4ever commented 4 years ago

I played a bit around and came to a solution which works for me so far. I am using a custom dockerfile:

FROM pitkley/paperless
RUN \
  sed -i -e "s/slugify(None)/'\.'/" /usr/src/paperless/src/documents/models.py && \
  sed -i -e "s/slugify(self\.created)/slugify(self\.created)\[:10\]/" /usr/src/paperless/src/documents/models.py

This solves 4. and 2. & 3., the latter one for tags only though.