From 6efa5beb330518b3d8a8d1fd117134f72a5c3783 Mon Sep 17 00:00:00 2001 From: bassdart Date: Thu, 14 Feb 2019 16:54:34 +0100 Subject: [PATCH] add page counter for sorted folders --- default.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/default.py b/default.py index 49437f6..247c592 100644 --- a/default.py +++ b/default.py @@ -776,14 +776,14 @@ def sortTitlesBy(limit, sort, start): result = result[:filesinlists] start = 0 end = filesinlists - maximum = filesinlists - 1 +# maximum = filesinlists - 1 if sort != "" and sort == "date": if channel != "": modus = channel else: modus = 'all' result = result - maximum = len(result) +# maximum = len(result) if sort != "" and sort == "count": if channel != "": modus = channel @@ -798,9 +798,9 @@ def sortTitlesBy(limit, sort, start): #from operator import itemgetter #result = sorted(result, key=itemgetter((float(mycount), 'title'),reverse = True)) - maximum = len(result) - else: - maximum = len(result) +# maximum = len(result) +# else: +# maximum = len(result) # play all (TODO) # addDir(translation(30109), '', '', fanart) # back to VIDFLTR (only useful if the back history would be cleared) @@ -811,12 +811,17 @@ def sortTitlesBy(limit, sort, start): # playlist.clear() for entry in result[start:end]: addVideo(entry, mycount) + maximum = len(result) if maximum > end and sort != "random" and channel != "year": + pagemax = (float(maximum) / float(filesinlists)) + pagenext = (float(nextstart) / float(filesinlists)) # next page link 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: - 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()