mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Get Books: Fix price information for Sony store incorrect
This commit is contained in:
parent
13f057cd99
commit
4438ed4d39
@ -2,7 +2,7 @@
|
|||||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
|
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
|
||||||
from __future__ import (unicode_literals, division, absolute_import,
|
from __future__ import (unicode_literals, division, absolute_import,
|
||||||
print_function)
|
print_function)
|
||||||
store_version = 1 # Needed for dynamic plugin loading
|
store_version = 2 # Needed for dynamic plugin loading
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
@ -50,23 +50,27 @@ class SonyStore(BasicStoreConfig, StorePlugin):
|
|||||||
if counter <= 0:
|
if counter <= 0:
|
||||||
break
|
break
|
||||||
|
|
||||||
curr = ''.join(item.xpath('descendant::div[@class="pricing"]/descendant::*[@class="currency"]/@title')).strip()
|
curr = ''.join(item.xpath('descendant::div[@class="pricing"]/p[@class="price money"]/descendant::*[@class="currency"]/@title')).strip()
|
||||||
amt = ''.join(item.xpath('descendant::div[@class="pricing"]/descendant::*[@class="amount"]/text()')).strip()
|
amt = ''.join(item.xpath('descendant::div[@class="pricing"]/p[@class="price money"]/descendant::*[@class="amount"]/text()')).strip()
|
||||||
s = SearchResult()
|
s = SearchResult()
|
||||||
s.price = (curr+' '+amt) if (curr and amt) else _('Not Available')
|
s.price = (curr+' '+amt) if (curr and amt) else _('Not Available')
|
||||||
title = item.xpath('descendant::h3[@class="item"]')
|
title = item.xpath('descendant::h3[@class="item"]')
|
||||||
if not title: continue
|
if not title:
|
||||||
|
continue
|
||||||
title = etree.tostring(title[0], method='text',
|
title = etree.tostring(title[0], method='text',
|
||||||
encoding=unicode)
|
encoding=unicode)
|
||||||
if not title: continue
|
if not title:
|
||||||
|
continue
|
||||||
s.title = title.strip()
|
s.title = title.strip()
|
||||||
s.author = ''.join(item.xpath(
|
s.author = ''.join(item.xpath(
|
||||||
'descendant::li[contains(@class, "author")]/'
|
'descendant::li[contains(@class, "author")]/'
|
||||||
'a[@class="fn"]/text()')).strip()
|
'a[@class="fn"]/text()')).strip()
|
||||||
if not s.author: continue
|
if not s.author:
|
||||||
|
continue
|
||||||
detail_url = ''.join(item.xpath('descendant::h3[@class="item"]'
|
detail_url = ''.join(item.xpath('descendant::h3[@class="item"]'
|
||||||
'/descendant::a[@class="fn" and @href]/@href'))
|
'/descendant::a[@class="fn" and @href]/@href'))
|
||||||
if not detail_url: continue
|
if not detail_url:
|
||||||
|
continue
|
||||||
if detail_url.startswith('/'):
|
if detail_url.startswith('/'):
|
||||||
detail_url = 'http:'+detail_url
|
detail_url = 'http:'+detail_url
|
||||||
s.detail_item = detail_url
|
s.detail_item = detail_url
|
||||||
@ -87,3 +91,4 @@ class SonyStore(BasicStoreConfig, StorePlugin):
|
|||||||
s.formats = 'Sony'
|
s.formats = 'Sony'
|
||||||
|
|
||||||
yield s
|
yield s
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user