EPUB metadata: Fix book producer not being set when updating EPUB metadata

This commit is contained in:
Kovid Goyal 2012-09-26 18:28:26 +05:30
parent 5399e417da
commit 13e29a05a3

View File

@ -1017,9 +1017,8 @@ class OPF(object): # {{{
def fset(self, val): def fset(self, val):
matches = self.bkp_path(self.metadata) matches = self.bkp_path(self.metadata)
if not matches: if not matches:
attrib = {'{%s}role'%self.NAMESPACES['opf']: 'bkp'} matches = [self.create_metadata_element('contributor')]
matches = [self.create_metadata_element('contributor', matches[0].set('{%s}role'%self.NAMESPACES['opf'], 'bkp')
attrib=attrib)]
self.set_text(matches[0], unicode(val)) self.set_text(matches[0], unicode(val))
return property(fget=fget, fset=fset) return property(fget=fget, fset=fset)
@ -1152,7 +1151,7 @@ class OPF(object): # {{{
def smart_update(self, mi, replace_metadata=False): def smart_update(self, mi, replace_metadata=False):
for attr in ('title', 'authors', 'author_sort', 'title_sort', for attr in ('title', 'authors', 'author_sort', 'title_sort',
'publisher', 'series', 'series_index', 'rating', 'publisher', 'series', 'series_index', 'rating',
'isbn', 'tags', 'category', 'comments', 'isbn', 'tags', 'category', 'comments', 'book_producer',
'pubdate', 'user_categories', 'author_link_map'): 'pubdate', 'user_categories', 'author_link_map'):
val = getattr(mi, attr, None) val = getattr(mi, attr, None)
if val is not None and val != [] and val != (None, None): if val is not None and val != [] and val != (None, None):