mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Minor modifications
This commit is contained in:
parent
a469a02ce7
commit
08eb0e1a59
@ -233,7 +233,7 @@ class ResultList(list):
|
||||
description = self.reimg.sub('', description.group("desc"))
|
||||
description = self.recomment.sub('', description)
|
||||
description = self.resanitize.sub('', sanitize_comments_html(description))
|
||||
return _('SUMMARY:\n %s') % re.sub(r'\n\s+</p>','\n</p>', description)
|
||||
return _('SUMMARY:\n%s') % re.sub(r'\n\s+</p>','\n</p>', description)
|
||||
|
||||
def get_publisher(self, entry):
|
||||
publisher = self.output_entry(entry.xpath('./p')[1])
|
||||
|
@ -146,7 +146,7 @@ class Query(object):
|
||||
|
||||
# print etree.tostring(feed, pretty_print=True)
|
||||
total = int(total_results(feed)[0].text)
|
||||
nbresultstoget = total if total<self.maxresults else self.maxresults
|
||||
nbresultstoget = total if total < self.maxresults else self.maxresults
|
||||
|
||||
start = int(start_index(feed)[0].text)
|
||||
entries = entry(feed)
|
||||
@ -156,7 +156,7 @@ class Query(object):
|
||||
if feed is None:
|
||||
break
|
||||
entries.extend(entry(feed))
|
||||
return entries
|
||||
return entries[:nbresultstoget]
|
||||
|
||||
class ResultList(list):
|
||||
|
||||
@ -164,7 +164,7 @@ class ResultList(list):
|
||||
try:
|
||||
desc = description(entry)
|
||||
if desc:
|
||||
return _('SUMMARY:\n %s') % desc[0].text
|
||||
return _('SUMMARY:\n%s') % desc[0].text
|
||||
except:
|
||||
report(verbose)
|
||||
|
||||
@ -183,7 +183,7 @@ class ResultList(list):
|
||||
m = creator(entry)
|
||||
return [x.text for x in m] if m else []
|
||||
|
||||
def get_author_sort(self, entry, verbose):
|
||||
def get_author_sort(self, entry):
|
||||
for x in creator(entry):
|
||||
for key, val in x.attrib.iteritems():
|
||||
if key.endswith('file-as'):
|
||||
@ -216,6 +216,7 @@ class ResultList(list):
|
||||
try:
|
||||
return publisher(entry)[0].text
|
||||
except:
|
||||
report(verbose)
|
||||
return None
|
||||
|
||||
def get_date(self, entry, verbose):
|
||||
@ -241,7 +242,7 @@ class ResultList(list):
|
||||
print e
|
||||
authors = self.get_authors(x)
|
||||
mi = MetaInformation(title, authors)
|
||||
tmpautsort = self.get_author_sort(x, verbose)
|
||||
tmpautsort = self.get_author_sort(x)
|
||||
mi.author_sort = tmpautsort if tmpautsort \
|
||||
else authors_to_sort_string(authors)
|
||||
mi.comments = self.get_description(x, verbose)
|
||||
|
@ -203,7 +203,7 @@ class ResultList(list):
|
||||
|
||||
def get_description(self, entry, verbose):
|
||||
try:
|
||||
return u'RESUME:\n' + unicode(entry.getparent().xpath("//p[@id='book-description']")[0].text)
|
||||
return _(u'SUMMARY:\n%s') % unicode(entry.getparent().xpath("//p[@id='book-description']")[0].text)
|
||||
except:
|
||||
report(verbose)
|
||||
return None
|
||||
|
Loading…
x
Reference in New Issue
Block a user