version 0.4.96

This commit is contained in:
Kovid Goyal 2008-10-15 15:54:24 -07:00
parent 1cf0d3e029
commit 9970c08214
4 changed files with 17 additions and 5 deletions

View File

@ -2,7 +2,7 @@ __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
__appname__ = 'calibre'
__version__ = '0.4.95'
__version__ = '0.4.96'
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
'''
Various run time constants.

View File

@ -245,7 +245,7 @@ class MetaInformation(object):
self.cover_data = mi.cover_data
def __str__(self):
def __unicode__(self):
ans = u''
ans += u'Title : ' + unicode(self.title) + u'\n'
if self.authors:
@ -262,12 +262,15 @@ class MetaInformation(object):
if self.isbn:
ans += u'ISBN : ' + unicode(self.isbn) + u'\n'
if self.tags:
ans += u'Tags : ' +unicode(self.tags) + '\n'
ans += u'Tags : ' + u', '.join([unicode(t) for t in self.tags]) + '\n'
if self.series:
ans += u'Series : '+unicode(self.series) + ' #%d\n'%self.series_index
if self.language:
ans += u'Language : ' + unicode(self.language) + u'\n'
return ans.strip()
def __str__(self):
return self.__unicode__().encode('utf-8')
def __nonzero__(self):
return bool(self.title or self.author or self.comments or self.category)

View File

@ -137,7 +137,7 @@ class Metadata(QLabel):
def show_opf(self, opf):
mi = MetaInformation(opf)
raw = str(mi)
raw = unicode(mi)
ans = []
for line in raw.splitlines():
i = line.find(':')

View File

@ -1573,7 +1573,16 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE;
au = _('Unknown')
fname = '%s - %s.%s'%(title, au, format.lower())
fname = sanitize_file_name(fname)
open(os.path.join(dir, fname), 'wb').write(data)
f = open(os.path.join(dir, fname), 'r+b')
f.seek(0)
f.truncate()
f.write(data)
f.seek(0)
try:
set_metadata(f, self.get_metadata(id, index_is_id=True), stream_type=format.lower())
except:
pass
f.close()
return failures