def createMissingEpisodeList(): ignoreskippedstring = xbmcplugin.getSetting(thisPlugin, "ignoreskipped") ignoreskipped = ignoreskippedstring == 'True' mode = util.getMode() showid = mode.show.xbmcId showname = mode.show.titel #check if showid exists in xmldatabase else scraperID = database.getScraperId(showid) if scraperID == -1: scraperID = util.matchSerie(showname) if scraperID == -1: return [] database.addSerie(scraperID) #rpdb2.start_embedded_debugger('pw') scraper_episodes = scraper.getEpisodeInfo(scraperID) # TODO write scraper episodes to disk xbmc_episodes = getExistingEpisodes(showid) episodes = [] if ignoreskipped: episodes = getNewEpisodes(xbmc_episodes, scraper_episodes) else: episodes = getMissingEpisodes(xbmc_episodes, scraper_episodes) listing = createListing(episodes, showname) if not listing: header = localize(30001) message = localize(30002) msg(header,message % showname) 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