This commit is contained in:
Kovid Goyal 2013-10-07 12:38:44 +05:30
parent 214e252f98
commit 980ecc2e12

View File

@ -78,7 +78,6 @@ class xISBN(Thread):
self.tb = traceback.format_exception()
class ISBNMerge(object):
def __init__(self, log):
@ -361,7 +360,7 @@ def merge_identify_results(result_map, log):
# }}}
def identify(log, abort, # {{{
def identify(log, abort, # {{{
title=None, authors=None, identifiers={}, timeout=30):
if title == _('Unknown'):
title = None
@ -492,7 +491,6 @@ def identify(log, abort, # {{{
log('We have %d merged results, merging took: %.2f seconds' %
(len(results), time.time() - start_time))
max_tags = msprefs['max_tags']
for r in results:
r.tags = r.tags[:max_tags]
@ -514,7 +512,7 @@ def identify(log, abort, # {{{
return results
# }}}
def urls_from_identifiers(identifiers): # {{{
def urls_from_identifiers(identifiers): # {{{
identifiers = dict([(k.lower(), v) for k, v in identifiers.iteritems()])
ans = []
for plugin in all_metadata_plugins():
@ -550,7 +548,7 @@ def urls_from_identifiers(identifiers): # {{{
return ans
# }}}
if __name__ == '__main__': # tests {{{
if __name__ == '__main__': # tests {{{
# To run these test use: calibre-debug -e
# src/calibre/ebooks/metadata/sources/identify.py
from calibre.ebooks.metadata.sources.test import (test_identify,
@ -563,7 +561,7 @@ if __name__ == '__main__': # tests {{{
),
( # An e-book ISBN not on Amazon, one of the authors is
( # An e-book ISBN not on Amazon, one of the authors is
# unknown to Amazon
{'identifiers':{'isbn': '9780307459671'},
'title':'Invisible Gorilla', 'authors':['Christopher Chabris']},
@ -580,7 +578,7 @@ if __name__ == '__main__': # tests {{{
),
( # Sophisticated comment formatting
( # Sophisticated comment formatting
{'identifiers':{'isbn': '9781416580829'}},
[title_test('Angels & Demons',
exact=True), authors_test(['Dan Brown'])]
@ -594,7 +592,7 @@ if __name__ == '__main__': # tests {{{
),
]
#test_identify(tests[1:2])
# test_identify(tests[1:2])
test_identify(tests)
# }}}