Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-04-2014, 06:48 AM   #1
ZioNemo
Enthusiast
ZioNemo began at the beginning.
 
Posts: 48
Karma: 10
Join Date: Mar 2008
Device: HTC-p3000
calibredb exception

Hi,
I'm writing a tool to automate lib management & transfer between different databases (BookCAT, in my case).
As directed I'm using calibredb to interact with Calibre database.
Basic creation of books in Calibre works
To handle updating I need to query what books are already there and their ID.
To have a better matching I wanted to use optional fields (e.g.: ISBN), but it seems calibredb chokes when one requested field is empty.


Code:
$ calibredb list  --separator='|' --fields=title,authors,isbn
id|title                   |authors      |isbn|
Traceback (most recent call last):
  File "site.py", line 58, in main
  File "site-packages/calibre/library/cli.py", line 1475, in main
  File "site-packages/calibre/library/cli.py", line 221, in command_list
  File "site-packages/calibre/library/cli.py", line 138, in do_list
  File "textwrap.py", line 329, in wrap
  File "textwrap.py", line 258, in _wrap_chunks
ValueError: invalid width 0 (must be > 0)
$ calibredb list  --separator='|' --fields=title,authors
id|title                    |authors      |
1|Calibre Quick Start Guide|John Schember|
Is this intentional? If so: how can I work around this?
I'm currently using "calibredb (calibre 1.20)" on Debian Linux (wheezy).
I know it's not the latest, but it should be recent enough, isn't it?

TiA
ZioNemo is offline   Reply With Quote
Old 02-04-2014, 06:52 AM   #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: 45,251
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you want machine parseable output use calibredb catalog not calibredb list. The latter is meant for useage by humans.

calibredb catalog t.csv -h

That error happens not when one of the requested fields is empty, but when it si empty for *all* the requested books.
kovidgoyal is offline   Reply With Quote
Advert
Old 02-04-2014, 03:32 PM   #3
ZioNemo
Enthusiast
ZioNemo began at the beginning.
 
Posts: 48
Karma: 10
Join Date: Mar 2008
Device: HTC-p3000
reverse catalog

Nice, Thanks.
I have been using "calibredb catalog /tmp/catalog.xml --with-library=/..." which, if i'm right, dumps all non-null fields.
Is there some way to use the same format to input data?
It would be very handy to dump the catalog, modify/add to it and then reload it.
IMHO "calibredb set-metadata" format isn't as strightforward.
ZioNemo is offline   Reply With Quote
Old 02-04-2014, 09:10 PM   #4
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: 45,251
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No, the only way is to scriipt it via set_metadata.
kovidgoyal is offline   Reply With Quote
Reply

Tags
calibredb, exception, traceback


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
subseries_index does not appear in calibredb reup Library Management 4 12-16-2011 05:46 AM
calibredb remove ... BerlinerKindl Library Management 6 11-25-2011 09:24 PM
calibredb bugged? Mar2zz Library Management 10 11-23-2011 09:28 AM
calibredb list iomari Calibre 9 10-12-2011 11:30 AM
calibredb iomari Calibre 6 10-10-2011 08:35 AM


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


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