Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def artistSearching():
- loginAndSearch()
- results = (doWork(request.form['artist']))
- map1 = {'torrents_ep': 0,'torrents_compilation': 1, 'torrents_single': 2,'torrents_remix': 3,'torrents_mixtape': 4,'torrents_guest_appearance': 5, 'torrents_remixed_by': 6}
- results.sort(key=lambda x: map1[x[1]])
- #return "hi"
- html = """<html><head>
- <script language="JavaScript" type="text/javascript">
- function getsupport ( selectedtype )
- {
- document.supportform.supporttype.value = selectedtype ;
- document.supportform.submit() ;
- }
- </script>
- </head>
- <body>
- """
- x=0
- entry_length = len(results)-1
- while x<=entry_length:
- print x
- if (x==0 or results[x][1] != results[x-1][1]): # EP, Album, Mixes, Complication code is fine
- html+="<b>%s</b><br>\n" % results[x][1]
- if(x==0 or results[x][2] != results[x-1][2]): # If album changes
- html+=" Album - <b>%s</b><br>\n" % results[x][2]
- if(x==0 or results[x][4].decode("utf8") != results[x-1][4].decode("utf8")): # If relase changes
- print "Release = %s" % results[x][4]
- html+=" Release - <b>%s</b><br>\n" % (results[x][4])
- html+="<table border='1'\n<tr>"
- while True: # should go over all releses
- html+="""<tr><td><FORM METHOD="POST" ACTION="add/">\n
- <INPUT TYPE="submit" VALUE="%s">\n
- <input type="hidden" name='url' value='%s'>\n
- </FORM></td></tr>\n""" % (results[x][3][0],results[x][0])
- print "This is x: %s" % x
- if(x+1 >= entry_length):
- x+=1
- break
- if results[x][4] != results[x+1][4]: # if release is going to change again
- x+=1
- break
- x+=1
- html+="</tr></table>\n</body></html>"
- return Markup(html)
Add Comment
Please, Sign In to add comment