Add option to metadata plugin tester to ignore failed fields

This commit is contained in:
Kovid Goyal 2012-06-23 19:09:05 +05:30
parent bba964e903
commit bef20cf124

View File

@ -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 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]
if not good:
prints('Failed to find', plugin.test_fields(possibles[0]))
if fail_missing_meta:
raise SystemExit(1)
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())
except Empty:
break
if not results:
if not results and fail_missing_meta:
prints('Cover download failed')
raise SystemExit(1)
elif results:
cdata = results[0]
cover = os.path.join(tdir, plugin.name.replace(' ',
'')+'-%s-cover.jpg'%sanitize_file_name2(mi.title.replace(' ',