mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add option to metadata plugin tester to ignore failed fields
This commit is contained in:
parent
bba964e903
commit
bef20cf124
@ -167,7 +167,8 @@ def test_identify(tests): # {{{
|
|||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
def test_identify_plugin(name, tests, modify_plugin=lambda plugin:None): # {{{
|
def test_identify_plugin(name, tests, modify_plugin=lambda plugin:None,
|
||||||
|
fail_missing_meta=True): # {{{
|
||||||
'''
|
'''
|
||||||
:param name: Plugin name
|
:param name: Plugin name
|
||||||
:param tests: List of 2-tuples. Each two tuple is of the form (args,
|
:param tests: List of 2-tuples. Each two tuple is of the form (args,
|
||||||
@ -246,6 +247,7 @@ def test_identify_plugin(name, tests, modify_plugin=lambda plugin:None): # {{{
|
|||||||
None]
|
None]
|
||||||
if not good:
|
if not good:
|
||||||
prints('Failed to find', plugin.test_fields(possibles[0]))
|
prints('Failed to find', plugin.test_fields(possibles[0]))
|
||||||
|
if fail_missing_meta:
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
||||||
if results[0] is not possibles[0]:
|
if results[0] is not possibles[0]:
|
||||||
@ -263,9 +265,10 @@ def test_identify_plugin(name, tests, modify_plugin=lambda plugin:None): # {{{
|
|||||||
results.append(rq.get_nowait())
|
results.append(rq.get_nowait())
|
||||||
except Empty:
|
except Empty:
|
||||||
break
|
break
|
||||||
if not results:
|
if not results and fail_missing_meta:
|
||||||
prints('Cover download failed')
|
prints('Cover download failed')
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
elif results:
|
||||||
cdata = results[0]
|
cdata = results[0]
|
||||||
cover = os.path.join(tdir, plugin.name.replace(' ',
|
cover = os.path.join(tdir, plugin.name.replace(' ',
|
||||||
'')+'-%s-cover.jpg'%sanitize_file_name2(mi.title.replace(' ',
|
'')+'-%s-cover.jpg'%sanitize_file_name2(mi.title.replace(' ',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user