04-15-2011, 09:53 AM | #1 |
Member
Posts: 20
Karma: 10
Join Date: Feb 2011
Device: Kindle DX
|
batch updating metadata
Hello everyone.
I'm trying to add a thousand books to a library. My problem i as follows: 1: I have about 500 jpeg covers files and I need to associate each one to the related book 2: I created two custom columns, year of publication and original title. Both information are stored in a text delimited file. Now, everything can be made at hand, but since I'm talking of hundreds of books, I'd like to do it with a batch program, so my question is: is there any command line utility that allows to: a) Specify a jpeg file as a cover for each book and b) set the values of both principal and custom metadata ? I checked for the CLU actually available with calibre, but they doesn't seem to do the job. I was trying to automate XML parsing and editing with VB, but it looks to be quite complicated. Any suggestion ? Thanks Paul |
04-15-2011, 10:02 AM | #2 |
creator of calibre
Posts: 43,856
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibredb set_metadata
will do it for you, provided you can create the OPF files correctly. |
Advert | |
|
04-15-2011, 12:44 PM | #3 | |
Member
Posts: 20
Karma: 10
Join Date: Feb 2011
Device: Kindle DX
|
Quote:
it would be much easier for me if I can create an XML file including ONLY the items I have to add, such as: Code:
<?xml version='1.0' encoding='utf-8'?> <package xmlns="http://www.idpf.org/2007/opf" unique-identifier="uuid_id"> <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf"> <dc:description><p>here goes the test description</p></dc:description> <meta name="calibre:user_metadata:#originale" content="{"#value#": "here goes the original title"}"/> <meta name="calibre:user_metadata:#anno" content="{"#value#": "1984"}"/> </metadata> <guide> <reference href="1197.jpg" type="cover" title="Copertina"/> </guide> </package> Code:
U:\BdB>calibredb set_metadata 7 x.xml Python function terminated unexpectedly 'datatype' (Error Code: 1) Traceback (most recent call last): File "site.py", line 103, in main File "site.py", line 85, in run_entry_point File "site-packages\calibre\library\cli.py", line 1183, in main File "site-packages\calibre\library\cli.py", line 483, in command_set_metadata File "site-packages\calibre\library\cli.py", line 457, in do_set_metadata File "site-packages\calibre\library\database2.py", line 1842, in set_metadata KeyError: 'datatype' Do I have to pass the complete OPF structure to calibredb ? In that case, it's not much help since I need to parse every file anyway... |
|
04-15-2011, 12:57 PM | #4 |
creator of calibre
Posts: 43,856
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You can use calibredb to get the OPF and then modify it as needed.
calibredb show_metadata -h |
04-15-2011, 01:46 PM | #5 | |
Member
Posts: 20
Karma: 10
Join Date: Feb 2011
Device: Kindle DX
|
Quote:
Thanks anyway for your help. Bye Paul |
|
Advert | |
|
04-15-2011, 04:40 PM | #6 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
If you're talking about the metadata.opf inside the books' folder, that is for backup purposes only and will be overwritten the next time the metadata changes. As far as I know, it's never read, and you'll need to update the database, so there's no way around calling calibredb to update the metadata, I think.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Updating Metadata in Bulk | Turt99 | Calibre | 5 | 06-07-2010 03:19 PM |
DR800 updating metadata externally | Mr. X | iRex | 7 | 04-10-2010 12:14 PM |
Error on updating metadata in 0.6.44 | jomaweb | Calibre | 3 | 03-06-2010 12:05 PM |
batch metadata editing possible from filenames? | caponesan | Reading and Management | 3 | 09-03-2009 12:50 PM |
Searching for a way to batch-update PDFs metadata | Pulp | 2 | 01-13-2009 06:40 AM |