def createListing(episodes, showname): # TODO maybe localize
	listing = []
	for item in episodes:
		status = item[len(item)-1]
		statusstring = ''
		if status == 0:
			statusstring = localize(30301)
		elif status == 1:
			statusstring = localize(30302)
		elif status == 2:
			statusstring = localize(30303)
		if(item[0] == 0):
			episode = localize(30304) + " " + ('%02d' % item[1])
		else:
			episode = "S" + ('%02d' % item[0]) + "E" + ('%02d' % item[1])
		if item[3]:
			airedstring = "(" + item[3] + ")"
		else:
			airedstring = "(" + localize(30305) + ")"
		title = episode + " [" + statusstring + "]" + ": " + unicode(item[2], "utf-8") + " " + airedstring
		mode = util.getMode()
		mode.mode = "episode"
		mode.episode = Episode(int(item[0]), int(item[1]), str(item[2]), str(item[3]))
		listitem = xbmcgui.ListItem(title, statusstring, path="file", thumbnailImage="thumb.png", iconImage="iconimage.png")
		# Add manual search to context menu
		mode2 = ModeClass("manualsearch")
		mode2.show = mode.show
		mode2.episode = Episode(int(item[0]), int(item[1]), str(item[2]), str(item[3]))
		contextmenuitem = (localize(30004),"XBMC.Container.Update(%s)" % (sys.argv[0] + urllib.quote_plus(pickle.dumps(mode2)) + '/'))
		listitem.addContextMenuItems([contextmenuitem])
		listing.append([pickle.dumps(mode), listitem, True])
	return listing
def createShowList():
	json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties": ["title", "file", "thumbnail", "art"], "sort": { "method": "title" } }, "id": 1}')
	json_query = unicode(json_query, 'utf-8', errors='ignore')
	json_response = simplejson.loads(json_query)
	listing = []
	shows = json_response['result']['tvshows']
	for items in shows:
		mode = util.getMode()
		mode.mode = "tvshow"
		mode.show = TvShow(items["title"], int(items["tvshowid"]))
		title = items['title']
		listitem = xbmcgui.ListItem(title)
		listitem.setIconImage("")
		listitem.setThumbnailImage(items['thumbnail'])
		if database.getScraperId(items["tvshowid"]) != -1:
			mode2 = ModeClass("changetvshow")
			mode2.show = TvShow(items["title"], int(items["tvshowid"]))
			contextmenuitem = (localize(30003),"XBMC.Container.Update(%s)" % (sys.argv[0] + pickle.dumps(mode2) + '/'))
			listitem.addContextMenuItems([contextmenuitem])
		listing.append([pickle.dumps(mode) , listitem, True])
	return listing