papermerge-core icon indicating copy to clipboard operation
papermerge-core copied to clipboard

Importer does not import files in directories.

Open dvonessen opened this issue 3 years ago • 5 comments

Hey @ciur, thank you for your awesome project. I found that if I am using Papermerge's importer for local files, I only can import files and not folder within files.

As a better example, I do have a folder structure like this

Bank/Sparkasse/Kontoauszug/Kontoauszug.pdf

It would be awesome if Papermerge is able to import this structure into Papermerge's internal structure. What do you think about this feature? I am not a fully fledged python dev, but maybe with some assistance, I can try to add this to the local importer function.

Thanks!

dvonessen avatar Jan 20 '22 06:01 dvonessen

What you are asking is part of the plan in long term. However, this "feature" will not be part of the papermerge-core, instead it will be integrated as 3rd party application via REST API.

Let me explain: The papermerge-core is fully RESTful API (to be exact, it is being changed to be fully RESTful). This means, basically, that all operations like creating folders, uploading documents, adding tags, triggering automates, creating users - all could be performed via HTTP requests. See for example the latest update to the preferences endpoint and search endpoint.

As result of RESTful-ness of the papermerge-core, any person would be able to create 3rd party applications that will do whatever sort of import you/he/she likes :). Regarding to your particular request, if not me, I think there will be other persons with minimal knowledge of python (curl, bash, any sort of HTTP client), who will create small command line application/utility/desktop/mobile app which will help you import documents preserving their folder structure - all thanks to REST API.

Here is an easy to understand explanation of what REST API is.

ciur avatar Jan 21 '22 20:01 ciur

Yes, you are right. But right now, there is an importer function in the papermerge-core. Does that mean you will delete the current importer function from papermerge core and add it to an app? I think if there is a function inside papermerge-core, it could be extended by this feature, so that there is no duplicate app that has to be maintained.

Thank you.

dvonessen avatar Jan 28 '22 12:01 dvonessen

Does that mean you will delete the current importer function from papermerge core and add it to an app?

Yes. The plan is to move Importer into another app (or to be exact into an external command line utility). There are multiple reasons to do so:

  1. this will simplify PapermergeCore code.
  2. this ease maintainability of the importer - for example of there is a bug specifically for the importer, you won't need to recreate the whole development environment of Papermerge, instead you will need to setup dev environment for little command line utility (which means you need to have just python installed)
  3. Importer(s) is/are entires independent of PapermergeCore internals, they are only dependent on well defined REST API.

ciur avatar Jan 29 '22 06:01 ciur

Sounds great! Thank you for clarifying things.

Last question, is 2.1.0-alpha1 from hub.docker.com working? I know the term alpha, but to help finding issues, I think I could be a early adopter.

Maybe I will write the cli to recursive upload documents to papermerge. Right now I have about > 4k of files in a deeply directory structure.

dvonessen avatar Jan 30 '22 10:01 dvonessen

Version tagged with 2.1.0-alpha1 is my first attempt to see how to start all dependent services with docker-compose. Obviously you can try it, but the REST API documented here won't work in that docker image. Besides I did not document yet (for 2.1) how to play around with docker-compose. I need two more weeks time to complete 'alpha-2' and document how o experiment (very early version) of what's done so far.

ciur avatar Feb 01 '22 13:02 ciur

Recursive folder import is available via papermerge-cli import /path/to/some/folder command line utility.

ciur avatar Jan 01 '23 13:01 ciur