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
28
default.py
28
default.py
|
@ -127,7 +127,7 @@ def main():
|
||||||
|
|
||||||
def artists():
|
def artists():
|
||||||
for alpha in alphabet():
|
for alpha in alphabet():
|
||||||
addDir(alpha, '&style=artists&limit=' + alpha, 'showArtist', fanart)
|
addDir(alpha, '&style=artists&limit=' + alpha + '&start=0', 'showArtist', fanart)
|
||||||
endOfDirectory()
|
endOfDirectory()
|
||||||
|
|
||||||
def countrycodes():
|
def countrycodes():
|
||||||
|
@ -141,7 +141,7 @@ def countrycodes():
|
||||||
result.append('unknown')
|
result.append('unknown')
|
||||||
result.sort()
|
result.sort()
|
||||||
for entry in result:
|
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()
|
endOfDirectory()
|
||||||
|
|
||||||
def mainrandom():
|
def mainrandom():
|
||||||
|
@ -407,15 +407,16 @@ def sortTitles(channelInitial=""):
|
||||||
addVideo(entry)
|
addVideo(entry)
|
||||||
endOfDirectory()
|
endOfDirectory()
|
||||||
|
|
||||||
|
def showArtist(style, limit, start):
|
||||||
def showArtist(url):
|
|
||||||
# limit artists by first letter or country
|
# limit artists by first letter or country
|
||||||
data = getArtists()
|
data = getArtists()
|
||||||
result = []
|
result = []
|
||||||
# xbmc.log(msg=url, level=xbmc.LOGNOTICE)
|
# xbmc.log(msg=url, level=xbmc.LOGNOTICE)
|
||||||
# xbmc.log(msg=style, level=xbmc.LOGNOTICE)
|
# xbmc.log(msg=style, level=xbmc.LOGNOTICE)
|
||||||
# xbmc.log(msg=limit, level=xbmc.LOGNOTICE)
|
# xbmc.log(msg=limit, level=xbmc.LOGNOTICE)
|
||||||
|
start = int(start)
|
||||||
|
end = start + filesinlists
|
||||||
|
nextstart = end + 1
|
||||||
if style == 'artists':
|
if style == 'artists':
|
||||||
for entry in data:
|
for entry in data:
|
||||||
i = unidecode(entry['artist'])[0].upper()
|
i = unidecode(entry['artist'])[0].upper()
|
||||||
|
@ -425,18 +426,23 @@ def showArtist(url):
|
||||||
else:
|
else:
|
||||||
if limit == i:
|
if limit == i:
|
||||||
result.append(entry)
|
result.append(entry)
|
||||||
|
|
||||||
elif style == 'country':
|
elif style == 'country':
|
||||||
|
|
||||||
for entry in data:
|
for entry in data:
|
||||||
i = entry['countrycode']
|
i = entry['countrycode']
|
||||||
if limit == i:
|
if limit == i:
|
||||||
result.append(entry)
|
result.append(entry)
|
||||||
elif limit == 'unknown':
|
elif limit == 'unknown':
|
||||||
result.append(entry)
|
result.append(entry)
|
||||||
|
maximum = len(result)
|
||||||
for entry in result:
|
for entry in result[start:end]:
|
||||||
artist = entry['artist']
|
artist = entry['artist']
|
||||||
|
if entry['fanart'] != "":
|
||||||
|
fanart = entry['fanart']
|
||||||
|
elif entry['thumbnail'] != "":
|
||||||
fanart = entry['thumbnail']
|
fanart = entry['thumbnail']
|
||||||
|
else:
|
||||||
|
fanart = ""
|
||||||
|
|
||||||
if videoselection == "0":
|
if videoselection == "0":
|
||||||
if entry['official'] >= "1":
|
if entry['official'] >= "1":
|
||||||
|
@ -446,8 +452,12 @@ def showArtist(url):
|
||||||
addDir(artist, unidecode(artist.upper()), 'sortArtists', fanart, len(result))
|
addDir(artist, unidecode(artist.upper()), 'sortArtists', fanart, len(result))
|
||||||
elif videoselection == "2":
|
elif videoselection == "2":
|
||||||
addDir(artist, unidecode(artist.upper()), 'sortArtists', fanart, len(result))
|
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()
|
endOfDirectory()
|
||||||
|
|
||||||
|
|
||||||
def sortArtists(channel=""):
|
def sortArtists(channel=""):
|
||||||
# get videos for individual artist
|
# get videos for individual artist
|
||||||
xbmcplugin.setContent(pluginhandle, 'musicvideos')
|
xbmcplugin.setContent(pluginhandle, 'musicvideos')
|
||||||
|
@ -1048,7 +1058,7 @@ elif mode == 'sortTitles':
|
||||||
elif mode == 'sortArtists':
|
elif mode == 'sortArtists':
|
||||||
sortArtists(url)
|
sortArtists(url)
|
||||||
elif mode == 'showArtist':
|
elif mode == 'showArtist':
|
||||||
showArtist(url)
|
showArtist(style, limit, start)
|
||||||
elif mode == 'sortTitlesBy':
|
elif mode == 'sortTitlesBy':
|
||||||
sortTitlesBy(limit, sort, start)
|
sortTitlesBy(limit, sort, start)
|
||||||
elif mode == 'searchDate':
|
elif mode == 'searchDate':
|
||||||
|
|
Loading…
Reference in a new issue