Community edition massive operations bypass trick

We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules
Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
Post Reply
wgerven
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: Thu Jul 18, 2013 11:19 am

Community edition massive operations bypass trick

Post by wgerven » Fri Jul 26, 2013 8:30 am

Hello everybody,

Reading this post (http://forum.openkm.com/viewtopic.php?f=5&t=8305) and being faced with the same problem, I thought up a trick how to do massive operations on files in the community edition (6.2.4). I posted it as a reply to given post, but thought to copy paste it into a new thread as perhaps many other users have the same problem. One does need some basic understanding of pyhton to do it though... The trick is as follows:
Suppose you have in your file system a folder with books in pdf, that you wish to add to OpenKM and massively add keywords and/or categories.
1) For a moment, don't upload them yet to OpenKM, but prepare the (if you haven't already) categories you wish to add to them in OpenKM. (You don't have to think about keywords yet.)
2) Create a seperate empty folder /temp in OpenKM.
3) Upload 1 random pdf document to /temp, to which you assign those categories you want to massive add to the pdf's in your local folder of books.
4) Go to administration/export tab. Chose here to export the folder /temp to some folder on your local hard disk, and select to also export "metadata".
5) Navigate to this folder, it should contain the random pdf and a file named like the pdf +.okm
6) Basically the trick is that you can copy the contents of this .okm file for every book, keeping in mind to change filenames in the content appropriately.
7) That's what you need a python script for to do that "massively". I.e., run trough the pdf filenames, create for them *.okm files, copy in those files the metadata of the random file you exported & make the right adjustments within this content.
8 ) Then after running such script, you can go to the administration/import tab, and upload the whole folder with books and metadata. Make sure here to tick "Metadata" and to upload the books to /temp. As you don't tick "Restore UUIDs" there will be no file corruption as the file UUIDs will be newly generated by OpenKM.
9) All uploaded files should now have the categories attached to them. Keywords can be done massively by including them in the python script, but didn't have to be considered before the python step as OpenKM doesn't need UUIDs for them.
I agree it's not so neet, but it saves a lot of mouseclicks!! :|

Best regards,
Willem.

edit: Make also sure that the python script fetches the file size and put it in the *.okm file.

Post Reply