Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 11-12-2011, 02:54 PM   #1
Mar2zz
{insert custom title}
Mar2zz began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Sep 2010
Location: North of Ned'r Landum
Device: Bebook Reader 2010
Unhappy calibredb bugged?

I am having trouble listing using the calibredb commandline interface on a headless server (no X so can't start gui there).

I can add books with calibredb add --with-library=$HOME/Ebooks -r "Philip Kerr" for example. That works.

But I want to list them right after that. calibredb isn't verbose when it's adding books, so I don't know which titles were added when I didn't know which books of Philip Kerr I have in that folder.

calibredb list doesn't work, not even calibredb list --help which should give syntax on how to use it according to the output of calibredb --help.
Code:
Traceback (most recent call last):
  File "site.py", line 58, in main
  File "site-packages/calibre/library/cli.py", line 1192, in main
  File "site-packages/calibre/library/cli.py", line 159, in command_list
  File "site-packages/calibre/library/cli.py", line 51, in get_db
ValueError: No saved library path, either run the GUI or use the --with-library option
As I cannot run calibre GUI on my server I always specify --with-library=/path/to/library (or do I have to set it like /path/to/metadata.db?)

2 questions:
1. Can I set calibredb add to a more verbose output (like what books are added to the db for example? like author - title output, or filelocation perhaps)

2. How do I use the list option to find the books just added? (after that I want to use other commands on them, like fetch metadata for it for example).

edit:
ubuntu server 10.04 32bit, calibre 0.8.26

Last edited by Mar2zz; 11-12-2011 at 02:57 PM. Reason: systemspecs
Mar2zz is offline   Reply With Quote
Old 11-12-2011, 10:04 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 24,837
Karma: 4370273
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibredb list --with-library /whatever

works perfectly.
kovidgoyal is offline   Reply With Quote
 
Enthusiast
Old 11-13-2011, 04:16 AM   #3
Mar2zz
{insert custom title}
Mar2zz began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Sep 2010
Location: North of Ned'r Landum
Device: Bebook Reader 2010
Thx, the / at the end did the trick. Though, /--help doesn't provide syntax, it just lists my books...

With pipes, tail and grep and sed I can fight my way through this and get the results I need.
Mar2zz is offline   Reply With Quote
Old 11-20-2011, 09:49 AM   #4
Mar2zz
{insert custom title}
Mar2zz began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Sep 2010
Location: North of Ned'r Landum
Device: Bebook Reader 2010
I succeeded in writing a bash script that does the following:
- import all ebooks from a folder to a calibredatabase
- list all new imported books
- fetch ebook metadata and cover.jpg for all those new books and save it in the right location
- restart my calibre-server (or else new books aren't listed)

But, I used a lot of workarounds because of lack of documentation on calibredb add/list and fetch-ebook-metadata's options. Or maybe it's lack of features?

For example, listing all new books in a library is done easier with a "find -mindepth 2 -newer /tmp/checkfile -type d" command than calibredb list. (it's a lot faster, that's for sure)
Also, for running fetch-ebook-metadata to fetch correct data and cover, I need to specify author, title and location where to save it, and echo found metadata into that location into a metadata.opf file. If no metadata is found it will save an empty metadata file. So I needed to create all kinds of workarounds to get what I want. But I keep thinking there maybe is an easier way.

So I have those questions:
1. listing all new books in the db with calibredb list is impossible if they are imported in the last 5 minutes?
2. fetch-ebook-metadata cannot be linked to existing books in a db and fetch for those?
3. Savepaths for metadata.opf and cover.jpg need to specified all the time.
4. option: Savepath for metadata.opf does not exist, it just prints to console?
5. calibre-server isn't aware of new books until restarted, can it be made to check itself once in a while and update without restarting? like calibre-server --ctime=1h or --ctime=30m?
Mar2zz is offline   Reply With Quote
Old 11-20-2011, 10:25 AM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 24,837
Karma: 4370273
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
1. calibredb list --sort-by=timestamp --fields title,timestamp which is documented in calibredb list -h
2. No
3. That's what scripting is for. The command line tools are meant to be used from scripts
4. > is your friend
5. I don't care about this feature, it's trivial to restart the server. But feel free to submit a patch.
kovidgoyal is offline   Reply With Quote
Old 11-20-2011, 10:52 AM   #6
Mar2zz
{insert custom title}
Mar2zz began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Sep 2010
Location: North of Ned'r Landum
Device: Bebook Reader 2010
Wow that's fast thx!
One more question.
Restarting the server doesn't seem to pick up metadata from newer opf files (those I created with my friend >

So I also updated the db after creating it with calibredb set-metadata id metadata.opf.
That doesn't update info on server either it seems after a restart, but it says it notified calibre of the changes.

What is the fasted way to import new and unknown books from a folder, grab metadata and a cover for it and add this new info to the db or book so the server can display it, with calibrecli-commands only?

(running everything with --with-library option because it's on a headless server.)

ps:
My python skills are to little to be taken seriously, so I can't submit a patch, but I can workaround with a cronjob, thanks.


edit:
Wait a minute. I am grabbing covers, then changing metadata, reimporting, this changes paths and also overwrites existing covers... Need two runs, one for meta, one for covers

Last edited by Mar2zz; 11-20-2011 at 11:21 AM. Reason: I see what happens
Mar2zz is offline   Reply With Quote
Old 11-20-2011, 09:25 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 24,837
Karma: 4370273
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The server reads metadata from the db not from opf files. If you want to update metadata/covers, you need to use calibredb set_metadata
kovidgoyal is offline   Reply With Quote
Old 11-22-2011, 02:05 PM   #8
Mar2zz
{insert custom title}
Mar2zz began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Sep 2010
Location: North of Ned'r Landum
Device: Bebook Reader 2010
Thank you, that works. These cli-tools are really complete, thanks for putting much effort in them, most software-devs tend to give no attention to cli at all.

Is there any way to see if a default cover was set by Calibre? (the white cover with colored books on it?)... Now my script is dumb and tries to fetch a cover for all books. It also failes lots of times fetching a cover, also when it succeeds to find metadata, a cover is most of the times not found.
All my searches are with ISBN if isbn is found in metadata, else it searches with author and title specified.

Also, sometimes it failes fetching a coverwith this log:
Code:
<calibre.utils.logging.ThreadSafeLog object at 0x985762c>
No results found
and sometimes a plain and simple:
Code:
No cover found
What's the difference between those two?
My syntax is this:
Code:
fetch-ebook-metadata -a "$author" -t "$title" -c "$book/new_cover.jpg"
Mar2zz is offline   Reply With Quote
Old 11-22-2011, 09:15 PM   #9
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 24,837
Karma: 4370273
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No, there's no way to tell if a cover is a calibre cover or not. That's just a stray print statement somewhere.
kovidgoyal is offline   Reply With Quote
Old 11-23-2011, 07:49 AM   #10
Mar2zz
{insert custom title}
Mar2zz began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Sep 2010
Location: North of Ned'r Landum
Device: Bebook Reader 2010
Well thank you for all your help. My script is working quite good now. And I was wrong, I don't need to restart the server, the server reads all added books instantly.

So, the topictile is wrong, feel free to fix it to: calibredb works like a charm
Mar2zz is offline   Reply With Quote
Old 11-23-2011, 09:28 AM   #11
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 24,837
Karma: 4370273
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Glad to hear it.
kovidgoyal is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
calibredb remove ... BerlinerKindl Library Management 6 11-25-2011 09:24 PM
calibredb list iomari Calibre 9 10-12-2011 11:30 AM
calibredb iomari Calibre 6 10-10-2011 08:35 AM
kbooksourceicon(?) bugged seajewel Sony Reader Dev Corner 10 08-03-2008 07:55 AM
Severely bugged off: Riocaz iRex 7 08-23-2006 09:09 AM


All times are GMT -4. The time now is 09:59 AM.


MobileRead.com is a privately owned, operated and funded community.