summaryrefslogtreecommitdiffstats
path: root/ocrloader.py
diff options
context:
space:
mode:
Diffstat (limited to 'ocrloader.py')
-rw-r--r--ocrloader.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/ocrloader.py b/ocrloader.py
index 160a71e..e71c849 100644
--- a/ocrloader.py
+++ b/ocrloader.py
@@ -1,6 +1,7 @@
#! /usr/bin/env python
import ConfigParser
+import datetime
import email
import email.parser
import imaplib
@@ -50,18 +51,22 @@ def process(cfg, filename, payload, enable_ocr=True):
return True
else:
print ' uploading file'
+ now = datetime.datetime.now()
+ title = cfg.get('title') % {'date': now.strftime('%d/%m/%Y'), 'time': now.strftime('%H:%M')}
t = os.system('curl -v --insecure -X POST '\
'--form "form.widgets.file=@%s;filename=%s;type=application/pdf" '\
'-F "form.buttons.import=Import" '\
'-F "form.widgets.portal_type=%s" '\
'-F "form.widgets.location=%s" '\
'-F "form.widgets.owner=%s" '\
+ '-F "form.widgets.title=%s" '\
'-u admin:admin '\
'%s/@@fileimport' % (
ocr_filename, filename,
cfg.get('default_type'),
cfg.get('default_directory'),
cfg.get('user'),
+ urllib.quote(title),
cfg.get('ged_base_url')))
return (t == 0)