mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix regression that was causing metadata to not be properly restored from books that were saved to disk
This commit is contained in:
parent
790abb0b2f
commit
4564cd4c95
@ -383,11 +383,8 @@ class OPF(MetaInformation):
|
||||
return ans
|
||||
|
||||
def get_series(self):
|
||||
xm = self.soup.package.metadata.find('x-metadata')
|
||||
if not xm:
|
||||
return None
|
||||
s = xm.find('series')
|
||||
if s:
|
||||
s = self.soup.package.metadata.find('series')
|
||||
if s is not None:
|
||||
return str(s.string).strip()
|
||||
return None
|
||||
|
||||
@ -397,10 +394,7 @@ class OPF(MetaInformation):
|
||||
self._set_metadata_element('series', val, type='x-metadata')
|
||||
|
||||
def get_series_index(self):
|
||||
xm = self.soup.package.metadata.find('x-metadata')
|
||||
if not xm:
|
||||
return None
|
||||
s = xm.find('series-index')
|
||||
s = self.soup.package.metadata.find('series-index')
|
||||
if s:
|
||||
try:
|
||||
return int(str(s.string).strip())
|
||||
@ -623,7 +617,6 @@ def main(args=sys.argv):
|
||||
mi.category = opts.category.replace('&', '&').replace('<', '<').replace('>', '>')
|
||||
if opts.comment is not None:
|
||||
mi.comments = opts.comment.replace('&', '&').replace('<', '<').replace('>', '>')
|
||||
print mi
|
||||
mo = OPFCreator(os.getcwd(), mi)
|
||||
mo.render(open(args[1], 'wb'))
|
||||
return 0
|
||||
|
@ -1404,7 +1404,7 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE;
|
||||
cpath = os.path.join(base, cname)
|
||||
open(cpath, 'wb').write(cover)
|
||||
mi.cover = cname
|
||||
f = open(os.path.join(base, name+'.opf'), 'wb')
|
||||
f = open(os.path.join(base, sanitize_file_name(name)+'.opf'), 'wb')
|
||||
mi.render(f)
|
||||
f.close()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user