mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pep8
This commit is contained in:
parent
e1ed5f679f
commit
2da2657345
@ -80,7 +80,7 @@ class Metadata(object):
|
||||
self.title = title
|
||||
if authors:
|
||||
# List of strings or []
|
||||
self.author = list(authors) if authors else []# Needed for backward compatibility
|
||||
self.author = list(authors) if authors else [] # Needed for backward compatibility
|
||||
self.authors = list(authors) if authors else []
|
||||
from calibre.ebooks.metadata.book.formatter import SafeFormat
|
||||
self.formatter = SafeFormat()
|
||||
@ -429,8 +429,7 @@ class Metadata(object):
|
||||
try:
|
||||
src = op[0]
|
||||
dest = op[1]
|
||||
val = formatter.safe_format\
|
||||
(src, other, 'PLUGBOARD TEMPLATE ERROR', other)
|
||||
val = formatter.safe_format(src, other, 'PLUGBOARD TEMPLATE ERROR', other)
|
||||
if dest == 'tags':
|
||||
self.set(dest, [f.strip() for f in val.split(',') if f.strip()])
|
||||
elif dest == 'authors':
|
||||
@ -476,7 +475,7 @@ class Metadata(object):
|
||||
if replace_metadata:
|
||||
# SPECIAL_FIELDS = frozenset(['lpath', 'size', 'comments', 'thumbnail'])
|
||||
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))
|
||||
self.tags = other.tags
|
||||
self.cover_data = getattr(other, 'cover_data',
|
||||
@ -507,8 +506,10 @@ class Metadata(object):
|
||||
if getattr(other, 'cover_data', False):
|
||||
other_cover = other.cover_data[-1]
|
||||
self_cover = self.cover_data[-1] if self.cover_data else ''
|
||||
if not self_cover: self_cover = ''
|
||||
if not other_cover: other_cover = ''
|
||||
if not self_cover:
|
||||
self_cover = ''
|
||||
if not other_cover:
|
||||
other_cover = ''
|
||||
if len(other_cover) > len(self_cover):
|
||||
self.cover_data = other.cover_data
|
||||
|
||||
@ -517,7 +518,7 @@ class Metadata(object):
|
||||
meta = other.get_user_metadata(x, make_copy=True)
|
||||
if meta is not None:
|
||||
self_tags = self.get(x, [])
|
||||
self.set_user_metadata(x, meta) # get... did the deepcopy
|
||||
self.set_user_metadata(x, meta) # get... did the deepcopy
|
||||
other_tags = other.get(x, [])
|
||||
if meta['datatype'] == 'text' and meta['is_multiple']:
|
||||
# Case-insensitive but case preserving merging
|
||||
@ -607,7 +608,7 @@ class Metadata(object):
|
||||
|
||||
# Handle custom series index
|
||||
if key.startswith('#') and key.endswith('_index'):
|
||||
tkey = key[:-6] # strip the _index
|
||||
tkey = key[:-6] # strip the _index
|
||||
cmeta = self.get_user_metadata(tkey, make_copy=False)
|
||||
if cmeta and cmeta['datatype'] == 'series':
|
||||
if self.get(tkey):
|
||||
@ -698,7 +699,7 @@ class Metadata(object):
|
||||
if self.title_sort:
|
||||
fmt('Title sort', self.title_sort)
|
||||
if self.authors:
|
||||
fmt('Author(s)', authors_to_string(self.authors) + \
|
||||
fmt('Author(s)', authors_to_string(self.authors) +
|
||||
((' [' + self.author_sort + ']')
|
||||
if self.author_sort and self.author_sort != _('Unknown') else ''))
|
||||
if self.publisher:
|
||||
@ -805,3 +806,4 @@ def field_from_string(field, raw, field_metadata):
|
||||
return val
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user