Page 1 of 1
[Linux] Ebooks; fetch metadata, covers and add to library
Posted: November 24th, 2011, 2:36 pm
by Mar2zz
I wrote a script that processes ebooks. It tries to find metadata en covers for them and imports them into a Calibre database. This works great with the optional calibre-server. If sabnzbd downloads ebooks and the script has processed them they are instantly shown online if you set up a library with calibreserver. They can also be imported to your calibregui database, the librarylocation can be set in the script, and calibre-server and Gui can use the same database if you want to. I use a headless ubuntu-server myself, this works great on it.
In this topic I will explain how to set up the calibre-server and the postprocessing.
INSTALLATION:
Install calibre with:
Code: Select all
sudo python -c "import urllib2; exec urllib2.urlopen('http://status.calibre-ebook.com/linux_installer').read(); main()"
It's recommended to use the default values when questions are asked (just hit enter).
Install calibre-server daemon:
Code: Select all
sudo wget -O /etc/init.d/calibre-server http://dl.dropbox.com/u/18712538/calibre/calibre-init
sudo wget -O /etc/default/calibre-server http://dl.dropbox.com/u/18712538/calibre/calibre-default
sudo chmod +x /etc/init.d/calibre-server
sudo update-rc.d calibre-server defaults
# edit settings
sudo nano /etc/default/calibre-server
sudo /etc/init.d/calibre-server start
Download postprocessing script:
Code: Select all
cd /path/to/postprocessing/scripts
wget http://dl.dropbox.com/u/18712538/calibre/sabtocalibre.sh
sudo chmod +x sabtocalibre.sh
# edit settings
nano sabtocalibre.sh
Set this script for category ebooks or whatever and make sure it fires off when ebooks are downloaded.
Re: [Linux] Ebooks; fetch metadata, covers and add to librar
Posted: December 29th, 2011, 3:52 pm
by agentgreen
Really nice work on this!
Thanks!
Re: [Linux] Ebooks; fetch metadata, covers and add to librar
Posted: January 4th, 2012, 8:53 am
by innerspace
Hi,
I came across your thread here while searching for an autoprocess script for sabnzbd/calibre.
I already had sabnzbd+ installed and fully functioning prior, calibre-server is also installed on the same machine and functional.
So, I grabbed your script and made appropriate edits, then placed it in my predefined sabnzbd+ scripts folder.
Sadly, I cannot get sabnzbd+ to include the script in the drop down menu and therefore cannot get sabnzbd+ to trigger the script after a successful download.
Any ideas? The script is marked executable, permissions match those assigned to working scripts (SabtoSickbeard.py for instance), I'd really benefit from automating this process and your script sounds perfect.
Thanks for your time and any advice you may be able to offer me.
[innerspace]
Re: [Linux] Ebooks; fetch metadata, covers and add to librar
Posted: January 4th, 2012, 9:05 am
by Mar2zz
Is it executable for the user that runs Sabnzbd?
Could you post the output of ls -l /path/to/scriptsfolder?
Re: [Linux] Ebooks; fetch metadata, covers and add to librar
Posted: January 4th, 2012, 12:49 pm
by innerspace
Hi!
Thanks for your speedy reply!
Here's the output of my scripts folder:
Code: Select all
innerspace@teevee:~/.sickbeard$ ls -la
total 7120
drwxr-xr-x 10 innerspace innerspace 4096 2012-01-04 12:39 .
drwxr-xr-x 63 innerspace innerspace 4096 2012-01-03 23:52 ..
drwxr-xr-x 2 innerspace innerspace 4096 2012-01-04 08:27 autoProcessTV
drwxr-xr-x 4 innerspace innerspace 4096 2011-01-19 03:07 cache
-rw-r--r-- 1 innerspace innerspace 167936 2012-01-04 12:39 cache.db
drwxr-xr-x 5 innerspace innerspace 4096 2012-01-04 08:07 cherrypy
-rw-r--r-- 1 innerspace innerspace 3770 2012-01-04 08:05 config.ini
-rw-rw-r-- 1 innerspace innerspace 35132 2012-01-04 03:17 COPYING.txt
drwxr-xr-x 6 innerspace innerspace 4096 2010-12-05 23:20 data
-rw-rw-r-- 1 innerspace innerspace 426 2012-01-04 03:17 .gitignore
-rwxrwxr-x 1 innerspace innerspace 1990 2012-01-04 03:17 init.fedora
-rwxrwxr-x 1 innerspace innerspace 2551 2012-01-04 03:17 init.freebsd
-rwxrwxr-x 1 innerspace innerspace 1442 2011-03-24 01:08 initscript
-rw-rw-r-- 1 innerspace innerspace 2334 2012-01-04 03:17 init.solaris11
-rwxrwxr-x 1 innerspace innerspace 1691 2012-01-04 03:17 init.ubuntu
drwxr-xr-x 15 innerspace innerspace 4096 2012-01-04 08:06 lib
drwxr-xr-x 2 innerspace innerspace 4096 2012-01-04 10:38 Logs
-rw-rw-r-- 1 innerspace innerspace 2461 2012-01-04 03:17 readme.md
-rwxrwxr-x 1 innerspace innerspace 7316 2012-01-03 08:03 sabtocalibre.sh
-rwxrwxr-x 1 innerspace innerspace 7316 2012-01-03 08:47 sabtocalibre.sh.py
drwxr-xr-x 7 innerspace innerspace 4096 2012-01-04 08:06 sickbeard
-rw-r--r-- 1 innerspace innerspace 6959104 2012-01-04 08:37 sickbeard.db
-rw-r--r-- 1 innerspace innerspace 9216 2010-12-05 23:22 sickbeard.db.v0
-rwxrwxr-x 1 innerspace innerspace 10461 2012-01-04 03:17 SickBeard.py
drwxr-xr-x 2 innerspace innerspace 4096 2012-01-04 08:00 tests
-rw-r--r-- 1 innerspace innerspace 40 2012-01-04 08:00 version.txt
You'll notice that I copied it and named it .py but hey, that didn't do a thing lol.
I'm wondering if maybe Sabnzbd+ runs as user nobody? I can't remember, and am honestly not really sure how to tell...
Advice? I log on and install everything with user innerspace, what you see above is ls -la as that user.
Thank you again for your help, I think you're onto something...
Re: [Linux] Ebooks; fetch metadata, covers and add to librar
Posted: January 4th, 2012, 1:29 pm
by Mar2zz
Well, its executable bit is set correct, and you see the other scripts I assume, so I dunno why sabnzbd misses the script.
Why do you save your scripts inside the sickbeardfolder? copy only the scripts you run in sabnzbd to another folder on its own and try?
worth a try:
sudo service sabnzbdplus restart
or
sudo apt-get update sabnzbdplus
Re: [Linux] Ebooks; fetch metadata, covers and add to librar
Posted: January 8th, 2012, 4:00 pm
by akuiraz
Very nice... maybe someone who knows howto program a Windows batch/cmd file could convert this script? Would love to see this working on my windows pc
Re: [Linux] Ebooks; fetch metadata, covers and add to librar
Posted: March 30th, 2012, 7:47 pm
by kcallis
I am using NZBMatrix, NZB.su, and Newzbin for my indexers. On NZBMatrix, I just click on the sab button and my book is downloaded. I do have a slight problem with the process. If the book is relatively small, I don't have the time to switch to the script to autoprocess the book. Is there any trick that I can set up so that when I an epub book is coming down, it will automatically set the category to ebook, so that is will auto-process correctly. Or any other process to properly and automagically categorize and process the e-books. On the small books, I find myself having to go back to the command line and process the book using fat finger mode.
I know there has to be a way to auto categorize..
Re: [Linux] Ebooks; fetch metadata, covers and add to librar
Posted: August 2nd, 2012, 10:18 pm
by innerspace
Hey there,
I've returned to your script (after a long distraction) and am attempting to get it to run again but my setup has changed...
I now host calibre on another machine, would it be possible to remotely mount the calibre-database?
Within the script I've edited my Library path to reflect Calibre's Library directory (hosted on machine B, mounted via CIFS), and I see where calibredb is referenced ("which calibredb"), I assume the script hangs because it is looking for calibre's database locally (on machine A)?
Please advise, and thank you for your time.
innerspace