mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement ignore_fields for individual plugins (I'd forgotten to do this earlier).
This commit is contained in:
parent
1e246c89d3
commit
dae6dcaa38
@ -382,7 +382,11 @@ def identify(log, abort, # {{{
|
|||||||
log(plog)
|
log(plog)
|
||||||
log('\n'+'*'*80)
|
log('\n'+'*'*80)
|
||||||
|
|
||||||
|
dummy = Metadata(_('Unknown'))
|
||||||
for i, result in enumerate(presults):
|
for i, result in enumerate(presults):
|
||||||
|
for f in plugin.prefs['ignore_fields']:
|
||||||
|
if ':' not in f:
|
||||||
|
setattr(result, f, getattr(dummy, f))
|
||||||
result.relevance_in_source = i
|
result.relevance_in_source = i
|
||||||
result.has_cached_cover_url = (plugin.cached_cover_url_is_reliable
|
result.has_cached_cover_url = (plugin.cached_cover_url_is_reliable
|
||||||
and plugin.get_cached_cover_url(result.identifiers) is not
|
and plugin.get_cached_cover_url(result.identifiers) is not
|
||||||
|
@ -41,10 +41,6 @@ class OverDrive(Source):
|
|||||||
supports_gzip_transfer_encoding = False
|
supports_gzip_transfer_encoding = False
|
||||||
cached_cover_url_is_reliable = True
|
cached_cover_url_is_reliable = True
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
Source.__init__(self, *args, **kwargs)
|
|
||||||
self.prefs.defaults['ignore_fields'] =['tags', 'pubdate', 'comments']
|
|
||||||
|
|
||||||
def identify(self, log, result_queue, abort, title=None, authors=None, # {{{
|
def identify(self, log, result_queue, abort, title=None, authors=None, # {{{
|
||||||
identifiers={}, timeout=30):
|
identifiers={}, timeout=30):
|
||||||
ovrdrv_id = identifiers.get('overdrive', None)
|
ovrdrv_id = identifiers.get('overdrive', None)
|
||||||
@ -390,7 +386,10 @@ class OverDrive(Source):
|
|||||||
|
|
||||||
if pub_date:
|
if pub_date:
|
||||||
from calibre.utils.date import parse_date
|
from calibre.utils.date import parse_date
|
||||||
|
try:
|
||||||
mi.pubdate = parse_date(pub_date[0].strip())
|
mi.pubdate = parse_date(pub_date[0].strip())
|
||||||
|
except:
|
||||||
|
pass
|
||||||
if lang:
|
if lang:
|
||||||
lang = lang[0].strip().lower()
|
lang = lang[0].strip().lower()
|
||||||
mi.language = {'english':'en', 'french':'fr', 'german':'de',
|
mi.language = {'english':'en', 'french':'fr', 'german':'de',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user