def test(self): global searchItems searchItems = curData[b"i"] show = TVShow(1, tvdbdid) show.name = show_name show.quality = curData[b"q"] show.saveToDB() show.loadFromDB(skipNFO=True) sickrage.srCore.SHOWLIST.append(show) episode = None for epNumber in curData[b"e"]: episode = TVEpisode(show, curData[b"s"], epNumber) episode.status = WANTED episode.saveToDB() bestResult = searchProviders(show, episode.episode, forceSearch) if not bestResult: self.assertEqual(curData[b"b"], bestResult) self.assertEqual(curData[b"b"], bestResult.name) # first is expected, second is choosen one
def test(self): global searchItems searchItems = curData[b"i"] show = TVShow(1, tvdbdid) show.name = show_name show.quality = curData[b"q"] show.saveToDB() show.loadFromDB(skipNFO=True) sickrage.srCore.SHOWLIST.append(show) episode = None for epNumber in curData[b"e"]: episode = TVEpisode(show, curData[b"s"], epNumber) episode.status = WANTED episode.saveToDB() bestResult = searchProviders(show, episode.episode, forceSearch) if not bestResult: self.assertEqual(curData[b"b"], bestResult) self.assertEqual( curData[b"b"], bestResult.name) # first is expected, second is choosen one
def test(self): show = TVShow(1, int(curData[b"tvdbid"])) show.name = name show.quality = ANY | Quality.UNKNOWN | Quality.RAWHDTV show.saveToDB() show.loadFromDB(skipNFO=True) sickrage.srCore.SHOWLIST.append(show) for epNumber in curData[b"e"]: episode = TVEpisode(show, curData[b"s"], epNumber) episode.status = WANTED # We arent updating scene numbers, so fake it here episode.scene_season = curData[b"s"] episode.scene_episode = epNumber episode.saveToDB() provider.show = show season_strings = provider._get_season_search_strings(episode) episode_strings = provider._get_episode_search_strings(episode) fail = False for cur_string in season_strings, episode_strings: if not all([isinstance(cur_string, list), isinstance(cur_string[0], dict)]): print(" %s is using a wrong string format!" % provider.name) print(cur_string) fail = True continue if fail: continue try: assert (season_strings == curData[b"s_strings"]) assert (episode_strings == curData[b"e_strings"]) except AssertionError: continue search_strings = episode_strings[0] # search_strings.update(season_strings[0]) # search_strings.update({"RSS":['']}) # print search_strings if not provider.public: continue items = provider._doSearch(search_strings) if not items: print("No results from provider?") continue title, url = provider._get_title_and_url(items[0]) for word in show.name.split(" "): if not word.lower() in title.lower(): print("Show name not in title: %s. URL: %s" % (title, url)) continue if not url: print("url is empty") continue quality = provider.getQuality(items[0]) size = provider._get_size(items[0]) if not show.quality & quality: print("Quality not in ANY, %r" % quality) continue