mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Revert changes from browse.py
This commit is contained in:
parent
7b61c80aa0
commit
20d7b486e4
@ -373,18 +373,13 @@ class BrowseServer(object):
|
|||||||
script='toplevel();', main=main)
|
script='toplevel();', main=main)
|
||||||
|
|
||||||
def browse_sort_categories(self, items, sort):
|
def browse_sort_categories(self, items, sort):
|
||||||
def keyg(x):
|
if sort not in ('rating', 'name', 'popularity'):
|
||||||
x = getattr(x, 'sort', x.name)
|
sort = 'name'
|
||||||
if isinstance(x, unicode):
|
items.sort(key=lambda x: sort_key(getattr(x, 'sort', x.name)))
|
||||||
return sort_key(x)
|
|
||||||
return x
|
|
||||||
|
|
||||||
if sort == 'popularity':
|
if sort == 'popularity':
|
||||||
items.sort(key=operator.attrgetter('count'), reverse=True)
|
items.sort(key=operator.attrgetter('count'), reverse=True)
|
||||||
elif sort == 'rating':
|
elif sort == 'rating':
|
||||||
items.sort(key=operator.attrgetter('avg_rating'), reverse=True)
|
items.sort(key=operator.attrgetter('avg_rating'), reverse=True)
|
||||||
else:
|
|
||||||
items.sort(key=keyg)
|
|
||||||
return sort
|
return sort
|
||||||
|
|
||||||
def browse_category(self, category, sort):
|
def browse_category(self, category, sort):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user