mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Metadata download: Do not auto trim downloaded covers
Trimming can sometimes have undesirable effects.
This commit is contained in:
parent
e138fde8ac
commit
8f8e5ac6be
@ -208,10 +208,12 @@ class Source(Plugin):
|
|||||||
#: If True this source can return multiple covers for a given query
|
#: If True this source can return multiple covers for a given query
|
||||||
can_get_multiple_covers = False
|
can_get_multiple_covers = False
|
||||||
|
|
||||||
|
#: If set to True covers downloaded by this plugin are automatically trimmed.
|
||||||
|
auto_trim_covers = False
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
Plugin.__init__(self, *args, **kwargs)
|
Plugin.__init__(self, *args, **kwargs)
|
||||||
self.running_a_test = False # Set to True when using identify_test()
|
self.running_a_test = False # Set to True when using identify_test()
|
||||||
self._isbn_to_identifier_cache = {}
|
self._isbn_to_identifier_cache = {}
|
||||||
self._identifier_to_cover_url_cache = {}
|
self._identifier_to_cover_url_cache = {}
|
||||||
self.cache_lock = threading.RLock()
|
self.cache_lock = threading.RLock()
|
||||||
@ -446,11 +448,8 @@ class Source(Plugin):
|
|||||||
except Exception:
|
except Exception:
|
||||||
self.log.exception('Failed to download cover from: %r'%url)
|
self.log.exception('Failed to download cover from: %r'%url)
|
||||||
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# Metadata API {{{
|
# Metadata API {{{
|
||||||
|
|
||||||
def get_book_url(self, identifiers):
|
def get_book_url(self, identifiers):
|
||||||
'''
|
'''
|
||||||
Return a 3-tuple or None. The 3-tuple is of the form:
|
Return a 3-tuple or None. The 3-tuple is of the form:
|
||||||
|
@ -61,7 +61,8 @@ def process_result(log, result):
|
|||||||
try:
|
try:
|
||||||
im = Image()
|
im = Image()
|
||||||
im.load(data)
|
im.load(data)
|
||||||
im.trim(10)
|
if getattr(plugin, 'auto_trim_covers', False):
|
||||||
|
im.trim(10)
|
||||||
width, height = im.size
|
width, height = im.size
|
||||||
fmt = im.format
|
fmt = im.format
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user