Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidapi for processor #197

Open
boredland opened this issue Jun 12, 2015 · 5 comments
Open

Hidapi for processor #197

boredland opened this issue Jun 12, 2015 · 5 comments

Comments

@boredland
Copy link
Contributor

Hi there,
when handing over a scanjob from spreadpi to processor, somehow the processor calls for the hidtrigger-plugin and therefor hidapi. I'll now try installing that one to get this out of my way, but why does it call for it? If I'm right its quite unnecessary...
Yours

spreads.plugin: Looking for extension "hidtrigger"
tornado.application: Uncaught exception POST /api/workflow/upload (192.168.0.107)
HTTPServerRequest(protocol='http', host='192.168.0.127:2060', method='POST', uri='/api/workflow/upload', version='HTTP/1.1', remote_ip='192.168.0.107', headers={'Content-Length': '2401643', 'Host': '192.168.0.127:2060', 'Accept-Encoding': 'gzip, deflate', 'Content-Type': 'application/zip', 'Connection': 'keep-alive', 'Accept': '*/*', 'User-Agent': 'python-requests/2.4.3 CPython/2.7.9 Linux/3.18.14+'})
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1413, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/spreadsplug/web/handlers.py", line 173, in post
    workflow = Workflow(path=os.path.join(self.base_path, wfname))
  File "/usr/local/lib/python2.7/dist-packages/spreads/workflow.py", line 478, in __init__
    for name, cls in plugin.get_plugins(*self.config["plugins"]
  File "/usr/local/lib/python2.7/dist-packages/spreads/plugin.py", line 421, in get_plugins
    .format(name, message, name))
ExtensionException: Missing Python dependency for extension 'hidtrigger': hidapi
tornado.access: 500 POST /api/workflow/upload (192.168.0.107) 1560.72ms
@adongy
Copy link
Contributor

adongy commented Jun 12, 2015

Remove hidtrigger from your config in the processor.

@boredland
Copy link
Contributor Author

Well.. that would be to easy. It isn't in my config:

    logfile: ~/.config/spreads/spreads.log
    convert_old: yes
    verbose: yes
web:
    mode: processor
    standalone_device: no
    debug: yes
    postprocessing_server:
    project_dir: ~/scans
    port: 2060
driver: dummy
plugins:
- scantailor
- tesseract
- djvubind
- pdfbeads
- web
device:
    upside_down: no
    flip_target_pages: no
    focus_mode: autofocus_all
    single: no
    depends: 0
    parallel_capture: yes
    test: 1337
    super: foo
tesseract:
    language: deu

@adongy
Copy link
Contributor

adongy commented Jun 12, 2015

Are you sure it's not on the spreadpi instance that there is hidtrigger ?

@boredland
Copy link
Contributor Author

Yes I'm sure:

spreadsplug.web: Starting scanning station server in "processor" mode
spreadsplug.web: Starting server in debugging mode
huey.consumer.ConsumerThread: 1 worker threads
huey.consumer.ConsumerThread: Setting signal handler
huey.consumer.ConsumerThread: Huey consumer initialized with following commands
+ process_workflow
+ upload_workflow
+ transfer_to_stick
+ output_workflow
huey.consumer.ConsumerThread: Starting scheduler thread
huey.consumer.ConsumerThread: Starting worker threads
huey.consumer.ConsumerThread: Starting periodic task scheduler thread
spreadsplug.web.discovery: Starting discovery listener
root: Cache missed, instantiating workflow from /home/spreads/scans/test.
Workflow: Initializing workflow /home/spreads/scans/test
root: Adding setting upside_down from device
root: Adding setting flip_target_pages from device
root: Adding setting single from device
root: Adding setting depends from device
root: Adding setting parallel_capture from device
root: Adding setting test from device
root: Adding setting super from device
root: Adding setting loglevel from core
root: Adding setting capture_keys from core
root: Adding setting logfile from core
root: Adding setting convert_old from core
root: Adding setting verbose from core
root: Adding setting content from scantailor
root: Adding setting detection from scantailor
root: Adding setting rotate from scantailor
root: Adding setting deskew from scantailor
root: Adding setting split_pages from scantailor
root: Adding setting autopilot from scantailor
root: Adding setting auto_margins from scantailor
root: Adding setting margins from scantailor
root: Adding setting language from tesseract
root: Adding setting mode from web
root: Adding setting standalone_device from web
root: Adding setting debug from web
root: Adding setting postprocessing_server from web
root: Adding setting project_dir from web
root: Adding setting port from web
spreads.plugin: Looking for extension "hidtrigger"
spreadsplug.web: Missing Python dependency for extension 'hidtrigger': hidapi
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/dist-packages/spreadsplug/web/endpoints.py", line 522, in list_workflows
    workflows = Workflow.find_all(app.config['base_path'])
  File "/usr/local/lib/python2.7/dist-packages/spreads/workflow.py", line 356, in find_all
    workflow = cls(candidate)
  File "/usr/local/lib/python2.7/dist-packages/spreads/workflow.py", line 478, in __init__
    for name, cls in plugin.get_plugins(*self.config["plugins"]
  File "/usr/local/lib/python2.7/dist-packages/spreads/plugin.py", line 421, in get_plugins
    .format(name, message, name))
ExtensionException: Missing Python dependency for extension 'hidtrigger': hidapi
tornado.access: 500 GET /api/workflow (192.168.0.123) 179.18ms
...

@boredland
Copy link
Contributor Author

I installed hidapi, now it's mocking me with a warning

spreadsplug.hidtrigger: Initializing HidTrigger plugin
spreadsplug.hidtrigger: Could not find any HID devices.

followed by doing nothing. The Scanjob arrives a the processor, where I can trigger postprocessing again, followed by the following output:

huey.consumer.ConsumerThread: Executing <spreadsplug.web.tasks.queuecmd_process_workflow object at 0xb52f0ed0>
spreadsplug.web.tasks: Initiating processing for workflow test
Workflow: Starting postprocessing...
Workflow: Running 'process' hooks
spreadsplug.scantailor: Generating ScanTailor configuration
spreadsplug.scantailor: /usr/local/bin/scantailor-cli --start-filter=2 --end-filter=5 --layout=1.5 -o=/tmp/tmpMei1J8.ScanTailor --margins-top=2.5 --margins-right=2.5 --margins-bottom=2.5 --margins-left=2.5 /home/spreads/scans/test/data/raw/000.jpg /tmp/st-outcDD9Pw
spreadsplug.scantailor: Generating output images from ScanTailor configuration.
spreadsplug.scantailor: Generating output...
spreadsplug.scantailor: Launching those subprocesses!
Workflow: Done with postprocessing!
spreadsplug.web.util: Generating thumbnail for /home/spreads/scans/test/data/done/000.tif
huey.consumer.ConsumerThread: Executing <spreadsplug.web.tasks.queuecmd_output_workflow object at 0xb278c1f0>
spreadsplug.web.tasks: Initiating output generation for workflow test
Workflow: Generating output files...
Workflow: Running 'output' hooks
spreadsplug.pdfbeads: Assembling PDF.
spreadsplug.pdfbeads: Running /usr/local/bin/pdfbeads -d -M /tmp/tmpbfBQaV/metadata.txt /tmp/tmpbfBQaV/000.tif -o /home/spreads/scans/test/data/out/book.pdf
spreadsplug.pdfbeads: pdfbeads stdout:

spreadsplug.pdfbeads: pdfbeads stderr:

[DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead

Prepared data for processing /tmp/tmpbfBQaV/000.tif

JBIG2 compression complete. pages:1 symbols:242 log2:8

Processed /tmp/tmpbfBQaV/000.tif

Cleaning up temporary files for /tmp/tmpbfBQaV/000.tif


Workflow: Done generating output files!

When viewing the scantailored files, everything seems fine. Sadly no generated pdf (perhaps the rmagick thingy pdfbeads is telling me?).

EDIT: the pdfbeads rmagick-thing has no effect, the book.pdf in the "out" folder in the working directory is working fine. Seems to me there are two problems:
1st: The Button for pdf-download on the webinterface of the processor has no effect.
spreads- details
link: http://192.168.0.127:2060/api/workflow/31a2da46-58c0-410b-85c8-c8f42a107e1f/output/undefined
2nd: I always thought at least the output-file(s) get delivered back to the shooting-devices interface, since thats the one users are facing after they started a postprocessing job. Am I wrong and this isn't implemented or is it just not working for me? Or do I need to start the raspberrys spreads not in "standalone", but just in scanner mode?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants