mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Overdrive: handle unspecified author with exact title match
This commit is contained in:
parent
78734955d0
commit
e3fa34c0a2
@ -206,6 +206,7 @@ class OverDrive(Source):
|
|||||||
xref_q = '+'.join(title_tokens)
|
xref_q = '+'.join(title_tokens)
|
||||||
#log.error('Initial query is %s'%initial_q)
|
#log.error('Initial query is %s'%initial_q)
|
||||||
#log.error('Cross reference query is %s'%xref_q)
|
#log.error('Cross reference query is %s'%xref_q)
|
||||||
|
|
||||||
q_xref = q+'SearchResults.svc/GetResults?iDisplayLength=50&sSearch='+xref_q
|
q_xref = q+'SearchResults.svc/GetResults?iDisplayLength=50&sSearch='+xref_q
|
||||||
query = '{"szKeyword":"'+initial_q+'"}'
|
query = '{"szKeyword":"'+initial_q+'"}'
|
||||||
|
|
||||||
@ -233,8 +234,10 @@ class OverDrive(Source):
|
|||||||
if xref_q.find('+') != -1:
|
if xref_q.find('+') != -1:
|
||||||
xref_tokens = xref_q.split('+')
|
xref_tokens = xref_q.split('+')
|
||||||
xref_q = xref_tokens[0]
|
xref_q = xref_tokens[0]
|
||||||
|
#log.error('xref_q is '+xref_q)
|
||||||
else:
|
else:
|
||||||
xref_q = ''
|
xref_q = ''
|
||||||
|
xref_q = ''
|
||||||
q_xref = q+'SearchResults.svc/GetResults?iDisplayLength=50&sSearch='+xref_q
|
q_xref = q+'SearchResults.svc/GetResults?iDisplayLength=50&sSearch='+xref_q
|
||||||
elif int(m.group('totalrecords')) == 0:
|
elif int(m.group('totalrecords')) == 0:
|
||||||
return ''
|
return ''
|
||||||
@ -259,9 +262,10 @@ class OverDrive(Source):
|
|||||||
return self.format_results(reserveid, od_title, subtitle, series, publisher,
|
return self.format_results(reserveid, od_title, subtitle, series, publisher,
|
||||||
creators, thumbimage, worldcatlink, formatid)
|
creators, thumbimage, worldcatlink, formatid)
|
||||||
else:
|
else:
|
||||||
creators = creators.split(', ')
|
if creators:
|
||||||
|
creators = creators.split(', ')
|
||||||
# if an exact match in a preferred format occurs
|
# if an exact match in a preferred format occurs
|
||||||
if (author and creators[0] == author[0]) and od_title == title and int(formatid) in [1, 50, 410, 900] and thumbimage:
|
if ((author and creators[0] == author[0]) or (not author and not creators)) and od_title.lower() == title.lower() and int(formatid) in [1, 50, 410, 900] and thumbimage:
|
||||||
return self.format_results(reserveid, od_title, subtitle, series, publisher,
|
return self.format_results(reserveid, od_title, subtitle, series, publisher,
|
||||||
creators, thumbimage, worldcatlink, formatid)
|
creators, thumbimage, worldcatlink, formatid)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user