Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
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
Old 08-06-2010, 09:43 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: 44,353
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Stick a u before each string

so use:

u"Garcia Marquéz Gabriel"

or safer replace non ascii chars with their unicode code points

u'Garcia Marqu\xe9z Gabriel'
kovidgoyal is offline   Reply With Quote
Advert
Old 08-07-2010, 12:46 AM   #3
bazu
Junior Member
bazu began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Aug 2010
Location: Treviso, Italy
Device: none
Goog shot Kovid! All works!

Thank you very much
bazu is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Massive wave of ebook piracy? fjtorres News 608 11-10-2010 11:52 AM
Massive Kindle load questions kcallis Calibre 1 09-26-2010 08:29 AM
massive eReader coversion failure Nate the great Calibre 2 02-20-2010 08:48 PM
Massive thumbs up to Diesel EBooks PDS Reading and Management 9 03-18-2009 06:48 PM
Massive conversion in .prc idum Kindle Formats 2 11-10-2008 08:22 AM


All times are GMT -4. The time now is 10:12 PM.


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