because controversial is either 0 or 1 sort it by dislikes
This commit is contained in:
parent
75f286828e
commit
822f4faff2
1 changed files with 11 additions and 4 deletions
15
default.py
15
default.py
|
@ -706,10 +706,17 @@ def sortTitlesBy(limit, sort, start):
|
|||
modus = channel
|
||||
else:
|
||||
modus = 'all'
|
||||
# sort by negated count first and then by title in lexical order.
|
||||
# If count would'nt be negated one had to use reverse=true
|
||||
# But then the second sorting, by title would be reversed also
|
||||
result = sorted(result, key = lambda i: (-1*float(i[mycount]), i['title']))
|
||||
|
||||
if mycount != "" and mycount == "controversial":
|
||||
# controversial is either 0 or 1 so it does not makes sense to sort upon it
|
||||
# instead sort videos considered controversial by dislikes
|
||||
# change controversial in videos.json to a float?
|
||||
result = sorted(result, key = lambda i: (-1*float(i['dislikes']), i['title']))
|
||||
else:
|
||||
# If count would'nt be negated one had to use reverse=true
|
||||
# but then the second sorting, by title would be reversed also
|
||||
# sort by negated count first and then by title in lexical order.
|
||||
result = sorted(result, key = lambda i: (-1*float(i[mycount]), i['title']))
|
||||
# itemgetter, should be faster (hm, but does'nt work: ValueError: could not convert string to float: pcount)
|
||||
# importing "operator" for implementing itemgetter
|
||||
#from operator import itemgetter
|
||||
|
|
Loading…
Reference in a new issue