0

I have a Raspberry Pi (Debian/Wheezy) running Calibre (v 0.8.51) headless as a ebook server and Apache2. I want to ease the upload of ebooks to my calibre library creating a HTML form. The form submit button needs to tirgger a script doing the following:

  • Pass to a bash command variables containing authors, title, ISBN, tags;
  • Upload to a a specific location (/home) the file after renaming it to book.mobi;
  • Run the following bash command calibredb add --library-path=/home/calibre-library --authors "$authors" --title "$title" --tags "$tags" --isbn "$isbn" /home/book.mobi What would be the best method to proceed?
CptNemo
  • 6,455
  • 16
  • 58
  • 107

1 Answers1

1

You need server side scripting to handle the data from the form POST and further process it. So the answer would depend on your language preference.

  1. If you know/like PHP you can POST the form to a PHP page. The PHP script will then retrieve the POST parameters. Using exec, you can then call your custom scripts. This should be quick to do. You may refer to exec command documentation here.
  2. If you know Python, you could pick up any web framework. Ihad mentioned a few in another answer here
  3. Or you could use any other language

I am biased towards Python since it is inherently supported in RPi and also it is not too tough to do OS operations and bash script execution as you desire.

Community
  • 1
  • 1
Nipun Batra
  • 11,007
  • 11
  • 52
  • 77