mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Get Books: Woblink return separate search results for epub vs. mobi
This commit is contained in:
commit
4148aae6d6
@ -29,4 +29,4 @@ class SearchResult(object):
|
|||||||
self.plugin_author = ''
|
self.plugin_author = ''
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.title == other.title and self.author == other.author and self.store_name == other.store_name
|
return self.title == other.title and self.author == other.author and self.store_name == other.store_name and self.formats == other.formats
|
||||||
|
@ -43,9 +43,9 @@ class WoblinkStore(BasicStoreConfig, StorePlugin):
|
|||||||
url = 'http://woblink.com/publication?query=' + urllib.quote_plus(query.encode('utf-8'))
|
url = 'http://woblink.com/publication?query=' + urllib.quote_plus(query.encode('utf-8'))
|
||||||
if max_results > 10:
|
if max_results > 10:
|
||||||
if max_results > 20:
|
if max_results > 20:
|
||||||
url += '&limit=' + str(30)
|
url += '&limit=30'
|
||||||
else:
|
else:
|
||||||
url += '&limit=' + str(20)
|
url += '&limit=20'
|
||||||
|
|
||||||
br = browser()
|
br = browser()
|
||||||
|
|
||||||
@ -74,15 +74,40 @@ class WoblinkStore(BasicStoreConfig, StorePlugin):
|
|||||||
if 'pdf' in formats:
|
if 'pdf' in formats:
|
||||||
formats[formats.index('pdf')] = 'PDF'
|
formats[formats.index('pdf')] = 'PDF'
|
||||||
|
|
||||||
counter -= 1
|
|
||||||
|
|
||||||
s = SearchResult()
|
s = SearchResult()
|
||||||
s.cover_url = 'http://woblink.com' + cover_url
|
s.cover_url = 'http://woblink.com' + cover_url
|
||||||
s.title = title.strip()
|
s.title = title.strip()
|
||||||
s.author = author.strip()
|
s.author = author.strip()
|
||||||
s.price = price + ' zł'
|
s.price = price + ' zł'
|
||||||
s.detail_item = id.strip()
|
s.detail_item = id.strip()
|
||||||
s.drm = SearchResult.DRM_UNKNOWN if 'MOBI' in formats else SearchResult.DRM_LOCKED
|
|
||||||
s.formats = ', '.join(formats)
|
# MOBI should be send first,
|
||||||
|
if 'MOBI' in formats:
|
||||||
yield s
|
s = SearchResult()
|
||||||
|
s.cover_url = 'http://woblink.com' + cover_url
|
||||||
|
s.title = title.strip()
|
||||||
|
s.author = author.strip()
|
||||||
|
s.price = price + ' zł'
|
||||||
|
s.detail_item = id.strip()
|
||||||
|
|
||||||
|
s.drm = SearchResult.DRM_UNLOCKED
|
||||||
|
s.formats = 'MOBI'
|
||||||
|
formats.remove('MOBI')
|
||||||
|
|
||||||
|
counter -= 1
|
||||||
|
yield s
|
||||||
|
|
||||||
|
# and the remaining formats (if any) next
|
||||||
|
if formats:
|
||||||
|
s = SearchResult()
|
||||||
|
s.cover_url = 'http://woblink.com' + cover_url
|
||||||
|
s.title = title.strip()
|
||||||
|
s.author = author.strip()
|
||||||
|
s.price = price + ' zł'
|
||||||
|
s.detail_item = id.strip()
|
||||||
|
|
||||||
|
s.drm = SearchResult.DRM_LOCKED
|
||||||
|
s.formats = ', '.join(formats)
|
||||||
|
|
||||||
|
counter -= 1
|
||||||
|
yield s
|
||||||
|
Loading…
x
Reference in New Issue
Block a user