add page counter for sorted folders

This commit is contained in:
bassdart 2019-02-14 16:54:34 +01:00
parent 32a8310491
commit 6efa5beb33

View file

@ -776,14 +776,14 @@ def sortTitlesBy(limit, sort, start):
result = result[:filesinlists] result = result[:filesinlists]
start = 0 start = 0
end = filesinlists end = filesinlists
maximum = filesinlists - 1 # maximum = filesinlists - 1
if sort != "" and sort == "date": if sort != "" and sort == "date":
if channel != "": if channel != "":
modus = channel modus = channel
else: else:
modus = 'all' modus = 'all'
result = result result = result
maximum = len(result) # maximum = len(result)
if sort != "" and sort == "count": if sort != "" and sort == "count":
if channel != "": if channel != "":
modus = channel modus = channel
@ -798,9 +798,9 @@ def sortTitlesBy(limit, sort, start):
#from operator import itemgetter #from operator import itemgetter
#result = sorted(result, key=itemgetter((float(mycount), 'title'),reverse = True)) #result = sorted(result, key=itemgetter((float(mycount), 'title'),reverse = True))
maximum = len(result) # maximum = len(result)
else: # else:
maximum = len(result) # maximum = len(result)
# play all (TODO) # play all (TODO)
# addDir(translation(30109), '', '', fanart) # addDir(translation(30109), '', '', fanart)
# back to VIDFLTR (only useful if the back history would be cleared) # back to VIDFLTR (only useful if the back history would be cleared)
@ -811,12 +811,17 @@ def sortTitlesBy(limit, sort, start):
# playlist.clear() # playlist.clear()
for entry in result[start:end]: for entry in result[start:end]:
addVideo(entry, mycount) addVideo(entry, mycount)
maximum = len(result)
if maximum > end and sort != "random" and channel != "year": if maximum > end and sort != "random" and channel != "year":
pagemax = (float(maximum) / float(filesinlists))
pagenext = (float(nextstart) / float(filesinlists))
# next page link # next page link
if sort != "" and sort == "count": if sort != "" and sort == "count":
addDir(translation(30036), '&limit=' + modus + '&sort=count&start=' + str(nextstart) + '&count=' + mycount, 'sortTitlesBy', fanart) addDir("%s: %s/%s" % (translation(30036), str(int(math.ceil(pagenext))), str(int(math.ceil(pagemax)))), '&limit=' + modus + '&sort=count&start=' + str(nextstart) + '&count=' + mycount, 'sortTitlesBy', fanart)
elif hit != "" and hit == "true":
addDir("%s: %s/%s" % (translation(30036), str(int(math.ceil(pagenext))), str(int(math.ceil(pagemax)))), '&limit=' + modus + '&sort=date&start=' + str(nextstart) + '&hit=true', 'sortTitlesBy', fanart)
else: else:
addDir(translation(30036), '&limit=' + modus + '&sort=date&start=' + str(nextstart), 'sortTitlesBy', fanart) addDir("%s: %s/%s" % (translation(30036), str(int(math.ceil(pagenext))), str(int(math.ceil(pagemax)))), '&limit=' + modus + '&sort=date&start=' + str(nextstart), 'sortTitlesBy', fanart)
endOfDirectory() endOfDirectory()