View Single Post
Old 03-18-2010, 06:26 AM   #1
sariel2413
Junior Member
sariel2413 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Mar 2010
Device: Stanza/iPhone 3G
Manually add/delete ebooks to a database

Hello all,

I'm trying to make something that will let my little server serve me ebooks. Calibre-server is terrific in that it lets me connect Stanza to it and download ebooks.
However, I want to do it standalone, without gui, without screen on Linux. That is where I'm starting to have some issues I am searching for ways to convert PDF/pub/txt/rtf ebooks to epub and have them added to the Calibre database.

How can I convert ebooks to epub using the command-line tools and how can I add them to the database?

I'm using ebook-convert to convert between pdf and epub (for now) but that fails because it tries to run a GUI:

Code:
host-shelf:/opt/calibre# /opt/calibre/ebook-convert /srv/Library/Anthony\,\ Piers/Anthony\,\ Piers\ -\ Adept\ 1\ -\ Split\ Infinity.pdf /srv/Library/Anthony\,\ Piers/Anthony\,\ Piers\ -\ Adept\ 1\ -\ Split\ Infinity.epub --no-default-epub-cover --line-height=16 --base-font-size=12 --margin-top=15 --margin-left=15 --margin-right=15 --margin-bottom=10 --remove-paragraph-spacing --use-auto-toc
1% Converting input to HTML...
InputFormatPlugin: PDF Input running
on /srv/Library/Anthony, Piers/Anthony, Piers - Adept 1 - Split Infinity.pdf
pdftohtml log:

Parsing all content...
Initial parse failed:
Parsing file 'index.html' as HTML
Forcing index.html into XHTML namespace
Generating default TOC from spine...
34% Running transforms on ebook...
Merging user specified metadata...
Detecting structure...
Auto generated TOC with 0 entries.
Flattening CSS and remapping font sizes...
Source base font size is 12.00000pt
Cleaning up manifest...
Trimming unused files from manifest...
Creating EPUB Output...
67% Creating EPUB Output
: cannot connect to X server localhost:10.0
To make this command, I've created a PHP script which will run through the directory structure on a regular basis (cron-job, probably) and convert the PDF files to epub. My PDF's are very regular and I therefore I can get the authors, series, series index and title of the books. Hopefully I can use this info to get the covers using the ebook-meta-command.

I have yet to find a way to add ebooks to the database, which I have placed in /srv/Library. Also, will the books be visible immediately?

Summary:
- How can I convert ebooks without having a GUI? * Solved
- Can I download covers and other meta-info using author/series/seriesindex/title?
- How can I add ebooks to the database (I prefer not to use SQL due to possible future compatability issues, but if needed, it's an option)? *Solved
- If I add ebooks to the database, will the Calibre-server automatically see the updates or will I have to restart it? * Solved

Sar

Small PS to Kovid: I LOVE your program, it ROCKS


Update: Disabled X forwarding, now conversion seems to work nicely.
Update: Can convert, can add to Calibre, Calibre-server hosts it. Last thing left is getting
the covers from the net.

Last edited by sariel2413; 03-18-2010 at 10:51 AM.
sariel2413 is offline   Reply With Quote