mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
commit
b074e24acb
@ -22,6 +22,7 @@ from calibre.utils.icu import sort_key
|
|||||||
from calibre.utils.search_query_parser import SearchQueryParser
|
from calibre.utils.search_query_parser import SearchQueryParser
|
||||||
|
|
||||||
def comparable_price(text):
|
def comparable_price(text):
|
||||||
|
text = re.sub(r'[^0-9.,]', '', text)
|
||||||
if len(text) < 3 or text[-3] not in ('.', ','):
|
if len(text) < 3 or text[-3] not in ('.', ','):
|
||||||
text += '00'
|
text += '00'
|
||||||
text = re.sub(r'\D', '', text)
|
text = re.sub(r'\D', '', text)
|
||||||
@ -293,6 +294,7 @@ class SearchFilter(SearchQueryParser):
|
|||||||
return self.srs
|
return self.srs
|
||||||
|
|
||||||
def get_matches(self, location, query):
|
def get_matches(self, location, query):
|
||||||
|
query = query.strip()
|
||||||
location = location.lower().strip()
|
location = location.lower().strip()
|
||||||
if location == 'authors':
|
if location == 'authors':
|
||||||
location = 'author'
|
location = 'author'
|
||||||
|
@ -22,6 +22,7 @@ from calibre.gui2.store.search.adv_search_builder import AdvSearchBuilderDialog
|
|||||||
from calibre.gui2.store.search.download_thread import SearchThreadPool, \
|
from calibre.gui2.store.search.download_thread import SearchThreadPool, \
|
||||||
CacheUpdateThreadPool
|
CacheUpdateThreadPool
|
||||||
from calibre.gui2.store.search.search_ui import Ui_Dialog
|
from calibre.gui2.store.search.search_ui import Ui_Dialog
|
||||||
|
from calibre.utils.filenames import ascii_filename
|
||||||
|
|
||||||
class SearchDialog(QDialog, Ui_Dialog):
|
class SearchDialog(QDialog, Ui_Dialog):
|
||||||
|
|
||||||
@ -350,6 +351,7 @@ class SearchDialog(QDialog, Ui_Dialog):
|
|||||||
if d.exec_() == d.Accepted:
|
if d.exec_() == d.Accepted:
|
||||||
ext = d.format()
|
ext = d.format()
|
||||||
fname = result.title + '.' + ext.lower()
|
fname = result.title + '.' + ext.lower()
|
||||||
|
fname = ascii_filename(fname)
|
||||||
self.gui.download_ebook(result.downloads[ext], filename=fname)
|
self.gui.download_ebook(result.downloads[ext], filename=fname)
|
||||||
|
|
||||||
def open_store(self, result):
|
def open_store(self, result):
|
||||||
|
@ -77,9 +77,12 @@ class SmashwordsStore(BasicStoreConfig, StorePlugin):
|
|||||||
title = ''.join(data.xpath('//a[@class="bookTitle"]/text()'))
|
title = ''.join(data.xpath('//a[@class="bookTitle"]/text()'))
|
||||||
subnote = ''.join(data.xpath('//span[@class="subnote"]/text()'))
|
subnote = ''.join(data.xpath('//span[@class="subnote"]/text()'))
|
||||||
author = ''.join(data.xpath('//span[@class="subnote"]/a/text()'))
|
author = ''.join(data.xpath('//span[@class="subnote"]/a/text()'))
|
||||||
price = subnote.partition('$')[2]
|
if '$' in subnote:
|
||||||
price = price.split(u'\xa0')[0]
|
price = subnote.partition('$')[2]
|
||||||
price = '$' + price
|
price = price.split(u'\xa0')[0]
|
||||||
|
price = '$' + price
|
||||||
|
else:
|
||||||
|
price = '$0.00'
|
||||||
|
|
||||||
counter -= 1
|
counter -= 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user