add series info to title, speed up author and price handling

This commit is contained in:
Tomasz Długosz 2012-11-28 21:54:16 +01:00
parent c3ae59451b
commit 505e72035f

View File

@ -53,10 +53,15 @@ class PublioStore(BasicStoreConfig, StorePlugin):
continue
cover_url = ''.join(data.xpath('.//div[@class="img"]/a/img/@data-original'))
# TODO: fix highlight handling
title = ''.join(data.xpath('.//div[@class="desc"]/h4/a/text()'))
title2 = ''.join(data.xpath('.//div[@class="desc"]/h5/a/text()'))
if title2:
title = title + '. ' + title2
if (''.join(data.xpath('./div[@class="desc"]/div[@class="detailShortList"]/div[last()]/span/text()')).strip() == "Seria:"):
# TODO: fix highlight handling
series = ''.join(data.xpath('./div[@class="desc"]/div[@class="detailShortList"]/div[last()]/a/@title'))
title = title + ' (seria ' + series + ')'
author = ', '.join(data.xpath('./div[@class="desc"]/div[@class="detailShortList"]/div[@class="row"][1]/a/@title'))
price = ''.join(data.xpath('.//div[@class="priceBoxContener "]/div/ins/text()'))
if not price:
@ -68,8 +73,8 @@ class PublioStore(BasicStoreConfig, StorePlugin):
s = SearchResult()
s.cover_url = 'http://www.publio.pl' + cover_url
s.title = title.strip()
s.author = author.strip()
s.price = price.strip()
s.author = author
s.price = price
s.detail_item = 'http://www.publio.pl' + id.strip()
s.drm = SearchResult.DRM_LOCKED if 'DRM' in formats else SearchResult.DRM_UNLOCKED
s.formats = formats.replace(' DRM','').strip()