add pagination for artists on main and countries
This commit is contained in:
parent
c02b950902
commit
92415d39d4
1 changed files with 20 additions and 10 deletions
30
default.py
30
default.py
|
@ -127,7 +127,7 @@ def main():
|
|||
|
||||
def artists():
|
||||
for alpha in alphabet():
|
||||
addDir(alpha, '&style=artists&limit=' + alpha, 'showArtist', fanart)
|
||||
addDir(alpha, '&style=artists&limit=' + alpha + '&start=0', 'showArtist', fanart)
|
||||
endOfDirectory()
|
||||
|
||||
def countrycodes():
|
||||
|
@ -141,7 +141,7 @@ def countrycodes():
|
|||
result.append('unknown')
|
||||
result.sort()
|
||||
for entry in result:
|
||||
addDir(entry, '&style=country&limit=' + entry, 'showArtist', fanart, len(result))
|
||||
addDir(entry, '&style=country&limit=' + entry + '&start=0', 'showArtist', fanart, len(result))
|
||||
endOfDirectory()
|
||||
|
||||
def mainrandom():
|
||||
|
@ -407,15 +407,16 @@ def sortTitles(channelInitial=""):
|
|||
addVideo(entry)
|
||||
endOfDirectory()
|
||||
|
||||
|
||||
def showArtist(url):
|
||||
def showArtist(style, limit, start):
|
||||
# limit artists by first letter or country
|
||||
data = getArtists()
|
||||
result = []
|
||||
# xbmc.log(msg=url, level=xbmc.LOGNOTICE)
|
||||
# xbmc.log(msg=style, level=xbmc.LOGNOTICE)
|
||||
# xbmc.log(msg=limit, level=xbmc.LOGNOTICE)
|
||||
|
||||
start = int(start)
|
||||
end = start + filesinlists
|
||||
nextstart = end + 1
|
||||
if style == 'artists':
|
||||
for entry in data:
|
||||
i = unidecode(entry['artist'])[0].upper()
|
||||
|
@ -425,18 +426,23 @@ def showArtist(url):
|
|||
else:
|
||||
if limit == i:
|
||||
result.append(entry)
|
||||
elif style == 'country':
|
||||
|
||||
elif style == 'country':
|
||||
for entry in data:
|
||||
i = entry['countrycode']
|
||||
if limit == i:
|
||||
result.append(entry)
|
||||
elif limit == 'unknown':
|
||||
result.append(entry)
|
||||
|
||||
for entry in result:
|
||||
maximum = len(result)
|
||||
for entry in result[start:end]:
|
||||
artist = entry['artist']
|
||||
fanart = entry['thumbnail']
|
||||
if entry['fanart'] != "":
|
||||
fanart = entry['fanart']
|
||||
elif entry['thumbnail'] != "":
|
||||
fanart = entry['thumbnail']
|
||||
else:
|
||||
fanart = ""
|
||||
|
||||
if videoselection == "0":
|
||||
if entry['official'] >= "1":
|
||||
|
@ -446,8 +452,12 @@ def showArtist(url):
|
|||
addDir(artist, unidecode(artist.upper()), 'sortArtists', fanart, len(result))
|
||||
elif videoselection == "2":
|
||||
addDir(artist, unidecode(artist.upper()), 'sortArtists', fanart, len(result))
|
||||
if maximum > end:
|
||||
fanart = 'DefaultFolder.png'
|
||||
addDir(translation(30036), '&style=' + style + '&limit=' + limit + '&start=' + str(nextstart), 'showArtist', fanart)
|
||||
endOfDirectory()
|
||||
|
||||
|
||||
def sortArtists(channel=""):
|
||||
# get videos for individual artist
|
||||
xbmcplugin.setContent(pluginhandle, 'musicvideos')
|
||||
|
@ -1048,7 +1058,7 @@ elif mode == 'sortTitles':
|
|||
elif mode == 'sortArtists':
|
||||
sortArtists(url)
|
||||
elif mode == 'showArtist':
|
||||
showArtist(url)
|
||||
showArtist(style, limit, start)
|
||||
elif mode == 'sortTitlesBy':
|
||||
sortTitlesBy(limit, sort, start)
|
||||
elif mode == 'searchDate':
|
||||
|
|
Loading…
Reference in a new issue