mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement sub-sorting. So if you want to sort by author and then sub sort by series, you can now click first on series and then on author to acheive this. Implement #1810 (Advanced Sorting?)
This commit is contained in:
parent
7e849659cd
commit
f967c00b9f
@ -275,8 +275,9 @@ class ResultCache(SearchQueryParser):
|
|||||||
cmp(self._data[x][loc], self._data[y][loc])
|
cmp(self._data[x][loc], self._data[y][loc])
|
||||||
except AttributeError: # Some entries may be None
|
except AttributeError: # Some entries may be None
|
||||||
ans = cmp(self._data[x][loc], self._data[y][loc])
|
ans = cmp(self._data[x][loc], self._data[y][loc])
|
||||||
if ans != 0: return ans
|
#if ans != 0: return ans
|
||||||
return cmp(self._data[x][11].lower(), self._data[y][11].lower())
|
#return cmp(self._data[x][11].lower(), self._data[y][11].lower())
|
||||||
|
return ans
|
||||||
|
|
||||||
def sort(self, field, ascending):
|
def sort(self, field, ascending):
|
||||||
field = field.lower().strip()
|
field = field.lower().strip()
|
||||||
|
@ -68,10 +68,9 @@ class Newsweek(BasicNewsRecipe):
|
|||||||
|
|
||||||
|
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
ci = self.get_current_issue()
|
soup = self.get_current_issue()
|
||||||
if not ci:
|
if not soup:
|
||||||
raise RuntimeError('Unable to connect to newsweek.com. Try again later.')
|
raise RuntimeError('Unable to connect to newsweek.com. Try again later.')
|
||||||
soup = self.index_to_soup(ci)
|
|
||||||
img = soup.find(alt='Cover')
|
img = soup.find(alt='Cover')
|
||||||
if img is not None and img.has_key('src'):
|
if img is not None and img.has_key('src'):
|
||||||
small = img['src']
|
small = img['src']
|
||||||
@ -119,10 +118,10 @@ class Newsweek(BasicNewsRecipe):
|
|||||||
return soup
|
return soup
|
||||||
|
|
||||||
def get_current_issue(self):
|
def get_current_issue(self):
|
||||||
from urllib2 import urlopen # For some reason mechanize fails
|
#from urllib2 import urlopen # For some reason mechanize fails
|
||||||
home = urlopen('http://www.newsweek.com').read()
|
#home = urlopen('http://www.newsweek.com').read()
|
||||||
soup = BeautifulSoup(home)
|
soup = self.index_to_soup('http://www.newsweek.com')#BeautifulSoup(home)
|
||||||
img = soup.find('img', alt='Current Magazine')
|
img = soup.find('img', alt='Current Magazine')
|
||||||
if img and img.parent.has_key('href'):
|
if img and img.parent.has_key('href'):
|
||||||
return urlopen(img.parent['href']).read()
|
return self.index_to_soup(img.parent['href'])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user