2012-08-23, 20:06
I fixed the ampersand in the title issue and also sorted the shows initially in alphabetical order. Try this (just copy over your existing CATEGORIES function)
Code:
def CATEGORIES():
strUrl = 'http://' + __settings__.getSetting("sage_user") + ':' + __settings__.getSetting("sage_pass") + '@' + __settings__.getSetting("sage_ip") + ':' + __settings__.getSetting("sage_port")
addDir('All Shows', strUrl + '/sage/Recordings?xml=yes',2,'icon.png')
req = urllib.urlopen(strUrl + '/sage/Recordings?xml=yes')
content = parse(req)
uniqueListOfShowTitles = []
for showlist in content.getElementsByTagName('show'):
strTitle = ''
for shownode in showlist.childNodes:
# Get the title of the show
if shownode.nodeName == 'title':
strTitle = shownode.toxml()
strTitle = strTitle.replace('<title>','')
strTitle = strTitle.replace('</title>','')
strTitle = strTitle.replace('&','&')
if strTitle not in uniqueListOfShowTitles:
uniqueListOfShowTitles.append(strTitle)
uniqueListOfShowTitles.sort()
for strTitle in uniqueListOfShowTitles:
urlToShowEpisodes = strUrl + '/sage/Search?searchType=TVFiles&SearchString=' + urllib2.quote(strTitle.encode("utf8")) + '&DVD=on&sort2=airdate_asc&TimeRange=0&pagelen=100&sort1=title_asc&filename=&Video=on&search_fields=title&xml=yes'
print "ADDING strTitle=" + strTitle + "; urlToShowEpisodes=" + urlToShowEpisodes
addDir(strTitle, urlToShowEpisodes,2,'icon.png')