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 04-15-2011, 09:53 AM   #1
webwizard
Member
webwizard began at the beginning.
 
webwizard's Avatar
 
Posts: 14
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
webwizard is offline   Reply With Quote
Old 04-15-2011, 10:02 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: 24,834
Karma: 4370273
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.
kovidgoyal is offline   Reply With Quote
 
Enthusiast
Old 04-15-2011, 12:44 PM   #3
webwizard
Member
webwizard began at the beginning.
 
webwizard's Avatar
 
Posts: 14
Karma: 10
Join Date: Feb 2011
Device: Kindle DX
Quote:
Originally Posted by kovidgoyal View Post
calibredb set_metadata

will do it for you, provided you can create the OPF files correctly.
Probably I'm missing something, but as soon as I can make an OPF file structured as needed by calibredb, the only thing I have to do next is a simple file replacement.

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>&lt;p&gt;here goes the test description&lt;/p&gt;</dc:description>
		<meta name="calibre:user_metadata:#originale" content="{&quot;#value#&quot;: &quot;here goes the original title&quot;}"/>
        <meta name="calibre:user_metadata:#anno" content="{&quot;#value#&quot;: &quot;1984&quot;}"/>       
    </metadata>
    <guide>
        <reference href="1197.jpg" type="cover" title="Copertina"/>
    </guide>
</package>
but if I use something like it, the answer is:

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'
then the folders are renamed to "unknown" and the metadata.opf file disappears.

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...
webwizard is offline   Reply With Quote
Old 04-15-2011, 12:57 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: 24,834
Karma: 4370273
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
kovidgoyal is offline   Reply With Quote
Old 04-15-2011, 01:46 PM   #5
webwizard
Member
webwizard began at the beginning.
 
webwizard's Avatar
 
Posts: 14
Karma: 10
Join Date: Feb 2011
Device: Kindle DX
Quote:
Originally Posted by kovidgoyal View Post
You can use calibredb to get the OPF and then modify it as needed.

calibredb show_metadata -h
Well, it seems that modifying the original OPF works. I'll have to make up some sort of XML parser to scan and modify all the metadata.opf files. I hoped there was an easier way, but it seems there isn't

Thanks anyway for your help.

Bye

Paul
webwizard is offline   Reply With Quote
Old 04-15-2011, 04:40 PM   #6
Manichean
Wizard
Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!
 
Manichean's Avatar
 
Posts: 3,130
Karma: 80446
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by webwizard View Post
Probably I'm missing something, but as soon as I can make an OPF file structured as needed by calibredb, the only thing I have to do next is a simple file replacement.
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.
Manichean 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
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 PDF 2 01-13-2009 06:40 AM


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


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