Quote:
Originally Posted by kovidgoyal
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><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>
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...