This commit is contained in:
Kovid Goyal 2013-07-23 08:57:10 +05:30
parent e1ed5f679f
commit 2da2657345

View File

@ -429,8 +429,7 @@ class Metadata(object):
try: try:
src = op[0] src = op[0]
dest = op[1] dest = op[1]
val = formatter.safe_format\ val = formatter.safe_format(src, other, 'PLUGBOARD TEMPLATE ERROR', other)
(src, other, 'PLUGBOARD TEMPLATE ERROR', other)
if dest == 'tags': if dest == 'tags':
self.set(dest, [f.strip() for f in val.split(',') if f.strip()]) self.set(dest, [f.strip() for f in val.split(',') if f.strip()])
elif dest == 'authors': elif dest == 'authors':
@ -476,7 +475,7 @@ class Metadata(object):
if replace_metadata: if replace_metadata:
# SPECIAL_FIELDS = frozenset(['lpath', 'size', 'comments', 'thumbnail']) # SPECIAL_FIELDS = frozenset(['lpath', 'size', 'comments', 'thumbnail'])
for attr in SC_COPYABLE_FIELDS: for attr in SC_COPYABLE_FIELDS:
setattr(self, attr, getattr(other, attr, 1.0 if \ setattr(self, attr, getattr(other, attr, 1.0 if
attr == 'series_index' else None)) attr == 'series_index' else None))
self.tags = other.tags self.tags = other.tags
self.cover_data = getattr(other, 'cover_data', self.cover_data = getattr(other, 'cover_data',
@ -507,8 +506,10 @@ class Metadata(object):
if getattr(other, 'cover_data', False): if getattr(other, 'cover_data', False):
other_cover = other.cover_data[-1] other_cover = other.cover_data[-1]
self_cover = self.cover_data[-1] if self.cover_data else '' self_cover = self.cover_data[-1] if self.cover_data else ''
if not self_cover: self_cover = '' if not self_cover:
if not other_cover: other_cover = '' self_cover = ''
if not other_cover:
other_cover = ''
if len(other_cover) > len(self_cover): if len(other_cover) > len(self_cover):
self.cover_data = other.cover_data self.cover_data = other.cover_data
@ -698,7 +699,7 @@ class Metadata(object):
if self.title_sort: if self.title_sort:
fmt('Title sort', self.title_sort) fmt('Title sort', self.title_sort)
if self.authors: if self.authors:
fmt('Author(s)', authors_to_string(self.authors) + \ fmt('Author(s)', authors_to_string(self.authors) +
((' [' + self.author_sort + ']') ((' [' + self.author_sort + ']')
if self.author_sort and self.author_sort != _('Unknown') else '')) if self.author_sort and self.author_sort != _('Unknown') else ''))
if self.publisher: if self.publisher:
@ -805,3 +806,4 @@ def field_from_string(field, raw, field_metadata):
return val return val