ISBN query
Could you please modify the plugin to find a book just by ISBN?
I made some stupid test changes in _init_.py to prepare search page with ISBN:
def create_query(self, log, title=None, authors=None, isbn=None):
if title is not None:
search_title = title.replace(' ', '+')
elif isbn is not None:
search_title = isbn.replace(' ', '+')
else:
search_title = ''
if authors is not None:
search_author = authors[0].replace(' ', '+')
elif isbn is not None:
search_author = isbn.replace(' ', '+')
else:
search_author = ''
search_page = 'https://www.martinus.sk/?uMod=list&uTyp=search&c=čšťď&uQ=%s+%s' % (search_title,search_author)
log.info('URl> %s' %search_page)
return search_page[/FONT]
And also in:
def identify(self, log, result_queue, abort, title, authors,
identifiers={}, timeout=30):
'''
Note this method will retry without identifiers automatically if no
match is found with identifiers.
'''
matches = []
martinussk_id = identifiers.get('martinussk', None)
isbn = check_isbn(identifiers.get('isbn', None))
log.info(u'\nTitle:%s\nAuthors:%s\nISBN:%s\n'%(tit le, authors, isbn))
br = browser()
if martinussk_id:
matches.append(martinussk.BASE_URL + '?uItem=' + martinussk_id)
else:
query = self.create_query(log, title=title, authors=authors, isbn=isbn)
But I've got trouble with:
def _parse_search_results(self, log, orig_title, orig_authors, root, matches, timeout):
especially in:
if self.match(title,orig_title) or (author in orig_authors) or (self.match(author,oauthor) for oauthor in orig_authors):
When I replaced mentioned IF statement with "if author is None:" it returns the correct book if such exists in martinus.sk or the list with several books with similar ISBN books.
Can somebody modify code the professional way?
Thank you in advance.
|