mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Store: opensearch fix showing price.
This commit is contained in:
parent
38364443a7
commit
e4adfb0440
@ -67,7 +67,7 @@ class OpenSearchStore(StorePlugin):
|
|||||||
|
|
||||||
s = SearchResult()
|
s = SearchResult()
|
||||||
|
|
||||||
s.detail_item = ''.join(data.xpath('./*[local-name() = "id"]/text()'))
|
s.detail_item = ''.join(data.xpath('./*[local-name() = "id"]/text()')).strip()
|
||||||
|
|
||||||
for link in data.xpath('./*[local-name() = "link"]'):
|
for link in data.xpath('./*[local-name() = "link"]'):
|
||||||
rel = link.get('rel')
|
rel = link.get('rel')
|
||||||
@ -83,12 +83,20 @@ class OpenSearchStore(StorePlugin):
|
|||||||
if type:
|
if type:
|
||||||
ext = mimetypes.guess_extension(type)
|
ext = mimetypes.guess_extension(type)
|
||||||
if ext:
|
if ext:
|
||||||
ext = ext[1:].upper()
|
ext = ext[1:].upper().strip()
|
||||||
s.downloads[ext] = href
|
s.downloads[ext] = href
|
||||||
s.formats = ', '.join(s.downloads.keys())
|
s.formats = ', '.join(s.downloads.keys()).strip()
|
||||||
|
|
||||||
|
s.title = ' '.join(data.xpath('./*[local-name() = "title"]//text()')).strip()
|
||||||
|
s.author = ', '.join(data.xpath('./*[local-name() = "author"]//*[local-name() = "name"]//text()')).strip()
|
||||||
|
|
||||||
|
price_e = data.xpath('.//*[local-name() = "price"][1]')
|
||||||
|
if price_e:
|
||||||
|
price_e = price_e[0]
|
||||||
|
currency_code = price_e.get('currencycode', '')
|
||||||
|
price = ''.join(price_e.xpath('.//text()')).strip()
|
||||||
|
s.price = currency_code + ' ' + price
|
||||||
|
s.price = s.price.strip()
|
||||||
|
|
||||||
s.title = ' '.join(data.xpath('./*[local-name() = "title"]//text()'))
|
|
||||||
s.author = ', '.join(data.xpath('./*[local-name() = "author"]//*[local-name() = "name"]//text()'))
|
|
||||||
s.price = ' '.join(data.xpath('.//*[local-name() = "price"]//text()'))
|
|
||||||
|
|
||||||
yield s
|
yield s
|
||||||
|
Loading…
x
Reference in New Issue
Block a user