Christophe Nowicki

May 24, 2009

Danbooru mass upload script

Danbooru, is a powerful image board system with tagging.
It is built on RubyOnRails.
The main propose of this application is hentai pictures management^W^W^Wnice pictures management ;-)

I use it for invoice management (I swear ;-) ).
I scan all my invoices with a scanner and upload them on my local Danbooru.
The tag system is very powerful and you can find pictures very quickly.
You can setup you own version of Danbooru, an howto is available on the Ubuntu wiki.

The big power of this software is his REST API, you can do everything remotely with it.
There is an Mozilla Firefox plugin for uploading pictures, but I need a mass upload script for my documents.

So I’ve wrote my own mass upload script in Python : http://svn.csquad.org/danbooru_upload/danbooru_upload.py.

Features

$ danbooru_upload.py
Usage:
danbooru_upload.py [flags] [options] directory
where valid flags are:
-v - verbose mode
-r - recursive mode
-s - use https
and valid options are:
-t keywords - image keywords (tagme)
-h host - hostname (danbooru.donmai.us)
-u user - username
-p pass - password
-k key_file - ssl key file
-c cert_file- ssl cert file

Exemple

$ python danbooru_upload.py -v -h danbooru.csquad.lan -u test -p xxxx "/sgoinfre/documents/A Trier"
Login on danbooru.csquad.lan with user test...
Uploading file /sgoinfre/documents/A Trier/img167.jpg with tag tagme.
Uploading file /sgoinfre/documents/A Trier/img097.jpg with tag tagme.
Uploading file /sgoinfre/documents/A Trier/img161.jpg with tag tagme.
Uploading file /sgoinfre/documents/A Trier/img117.jpg with tag tagme.
Uploading file /sgoinfre/documents/A Trier/img021.jpg with tag tagme.
Uploading file /sgoinfre/documents/A Trier/img151.jpg with tag tagme.
Uploading file /sgoinfre/documents/A Trier/img047.jpg with tag tagme.
Uploading file /sgoinfre/documents/A Trier/img169.jpg with tag tagme.
Uploading file /sgoinfre/documents/A Trier/img157.jpg with tag tagme.
Uploading file /sgoinfre/documents/A Trier/img119.jpg with tag tagme.
...

Bug reports

I’ve planned to add an Optical character recognition (OCR) feature to the script. In order to automaticaly tag my invoices.

Please feel free to ask any other feature. Patches and bug reports are welcome ;)

Filed under: Projects — Tags:, — cscm @ 19:06

Powered by WordPress