View Single Post
Old 08-06-2010, 07:14 AM   #1
bazu
Junior Member
bazu began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Aug 2010
Location: Treviso, Italy
Device: none
[solved] Massive import batch process

Hy Guys,

I need to import 800 books' titles from a csv file. I've developed a routine that read this list and print ino a file (addBooks.py) a list of python commands blocks like the following one:


Code:
# coding:utf-8
from calibre.library.database2 import LibraryDatabase2
from calibre.ebooks.metadata import MetaInformation

db      = LibraryDatabase2("G:/dloads/Ebooks")


#BLOCK repeated
m1 = MetaInformation("Memoria delle mie puttane tristi", ["Garcia Marquéz Gabriel"])
m1.tags = ["BlueBook"]
m1.series = "BlueBook(49)"
db.add_books(["C:/fake.doc"], ["doc"], [m1], add_duplicates=True)
#END OF BLOCK repeated

I try to feed Calibre with the following command:

Code:
calibre-debug -e c:\addBooks.py
But it fails because of the “é” accent in the author's name:

Code:
[...]You must not use 8-bit bytestrings unless you use a text_factory that[ecc.]
If I remove that accent and I add it to the book's title, no errors are presents but the accent in the sqllite db is borken.

How can I solve the problem? Have I other ways to import from my csv list?

Thanks
bazu

Last edited by bazu; 08-07-2010 at 12:47 AM.
bazu is offline   Reply With Quote