def _test_allPossibleShowNames(self, name, indexerid=0, expected=[]): s = TVShow(1, indexerid) s.name = name result = show_names.allPossibleShowNames(s) self.assertTrue( len(set(expected).intersection(set(result))) == len(expected))
def test_process(self): show = TVShow(3, 1) show.name = self.SHOWNAME show.location = self.SHOWDIR sickrage.app.showlist = [show] self.post_processor = PostProcessor(self.FILEPATH, process_method='move') self.post_processor._log = _log self.assertTrue(self.post_processor.process)
def _test_allPossibleShowNames(self, name, indexerid=0, expected=[]): s = TVShow(1, indexerid) s.name = name s.saveToDB() s.loadFromDB(skipNFO=True) result = show_names.allPossibleShowNames(s) self.assertTrue( len(set(expected).intersection(set(result))) == len(expected))
def _test_allPossibleShowNames(self, name, indexerid=0, expected=[]): s = TVShow(1, indexerid) s.name = name s.saveToDB() s.loadFromDB(skipNFO=True) result = show_names.allPossibleShowNames(s) self.assertTrue(len(set(expected).intersection(set(result))) == len(expected))
def _test_allPossibleShowNames(self, name, indexerid=0, expected=None): if expected is None: expected = [] s = TVShow(1, indexerid) s.name = name s.save_to_db() result = show_names.allPossibleShowNames(s) self.assertTrue(len(set(expected).intersection(set(result))) == len(expected))
def _test_allPossibleShowNames(self, name, indexer_id=0, expected=None): if expected is None: expected = [] s = TVShow(indexer_id, 1) s.name = name result = show_names.all_possible_show_names(s) self.assertTrue( len(set(expected).intersection(set(result))) == len(expected))
def _test_allPossibleShowNames(self, name, indexerid=0, expected=None): if expected is None: expected = [] s = TVShow(1, indexerid) s.name = name s.save_to_db() result = show_names.allPossibleShowNames(s) self.assertTrue( len(set(expected).intersection(set(result))) == len(expected))
def test_process(self): show = TVShow(1, 3) show.name = self.SHOWNAME show.location = self.SHOWDIR show.save_to_db() sickrage.app.showlist = [show] sickrage.app.name_cache.put('show name', 3) self.post_processor = PostProcessor(self.FILEPATH, process_method='move') self.post_processor._log = _log self.assertTrue(self.post_processor.process)
def test_getEpisode(self): show = TVShow(0o001, 1) show.name = "show name" show.network = "cbs" show.genre = "crime" show.runtime = 40 show.status = "Ended" show.default_ep_status = "5" show.airs = "monday" show.startyear = 1987 sickrage.app.showlist = [show]
def test_getEpisode(self): show = TVShow(1, 0001, "en") show.name = "show name" show.network = "cbs" show.genre = "crime" show.runtime = 40 show.status = "Ended" show.default_ep_status = "5" show.airs = "monday" show.startyear = 1987 show.saveToDB() sickrage.showList = [show]
def test_process(self): show = TVShow(3, 1) show.name = self.SHOWNAME show.location = self.SHOWDIR sickrage.app.showlist = [show] ep = TVEpisode(show, self.SEASON, self.EPISODE) ep.name = "some ep name" ep.save() self.post_processor = PostProcessor(self.FILEPATH, process_method='move') self.post_processor._log = _log self.assertTrue(self.post_processor.process)
def test_change_indexer_id(self): show = TVShow(0o001, 1) show.name = "show name" show.network = "cbs" show.genre = "crime" show.runtime = 40 show.status = "Ended" show.default_ep_status = "5" show.airs = "monday" show.startyear = 1987 show.indexer_id = 0o002 self.assertEqual(show.indexer_id, 0o002)
def test_getEpisode(self): show = TVShow(1, 0001, "en") show.name = "show name" show.network = "cbs" show.genre = "crime" show.runtime = 40 show.status = "Ended" show.default_ep_status = "5" show.airs = "monday" show.startyear = 1987 show.saveToDB() show.loadFromDB(skipNFO=True) sickrage.srCore.SHOWLIST = [show]
def test_process(self): show = TVShow(1, 3) show.name = self.SHOWNAME show.location = self.SHOWDIR show.saveToDB() sickrage.app.showlist = [show] ep = TVEpisode(show, self.SEASON, self.EPISODE) ep.name = "some ep name" ep.saveToDB() sickrage.app.name_cache.put('show name', 3) self.pp = PostProcessor(self.FILEPATH, process_method='move') self.assertTrue(self.pp.process)
def test_process(self): show = TVShow(1, 3) show.name = SHOWNAME show.location = SHOWDIR show.saveToDB() sickrage.showList = [show] ep = TVEpisode(show, SEASON, EPISODE) ep.name = "some ep name" ep.saveToDB() sickrage.NAMECACHE.addNameToCache("show name", 3) self.pp = PostProcessor(FILEPATH, process_method="move") self.assertTrue(self.pp.process)
def test_process(self): show = TVShow(1, 3) show.name = SHOWNAME show.location = SHOWDIR show.saveToDB() show.loadFromDB(skipNFO=True) sickrage.srCore.SHOWLIST = [show] ep = TVEpisode(show, SEASON, EPISODE) ep.name = "some ep name" ep.saveToDB() sickrage.srCore.NAMECACHE.put('show name', 3) self.pp = PostProcessor(FILEPATH, process_method='move') self.assertTrue(self.pp.process)
def test_process(self): show = TVShow(1, 3) show.name = SHOWNAME show.location = SHOWDIR show.saveToDB() show.loadFromDB(skipNFO=True) sickrage.srCore.SHOWLIST = [show] ep = TVEpisode(show, SEASON, EPISODE) ep.name = "some ep name" ep.saveToDB() sickrage.srCore.NAMECACHE.addNameToCache('show name', 3) self.pp = PostProcessor(FILEPATH, process_method='move') self.assertTrue(self.pp.process)
def test_change_indexerid(self): show = TVShow(1, 0001, "en") show.name = "show name" show.network = "cbs" show.genre = "crime" show.runtime = 40 show.status = "Ended" show.default_ep_status = "5" show.airs = "monday" show.startyear = 1987 show.indexerid = 0002 show.saveToDB() show.loadFromDB(skipNFO=True) self.assertEqual(show.indexerid, 0002)
def test_isGoodName(self): list_of_cases = [('Show.Name.S01E02.Test-Test', 'Show/Name'), ('Show.Name.S01E02.Test-Test', 'Show. Name'), ('Show.Name.S01E02.Test-Test', 'Show- Name'), ('Show.Name.Part.IV.Test-Test', 'Show Name'), ('Show.Name.S01.Test-Test', 'Show Name'), ('Show.Name.E02.Test-Test', 'Show: Name'), ('Show Name Season 2 Test', 'Show: Name')] for testCase in list_of_cases: scene_name, show_name = testCase s = TVShow(1, 0) s.name = show_name s.save_to_db() self._test_isGoodName(scene_name, s)
def test_isGoodName(self): list_of_cases = [('Show.Name.S01E02.Test-Test', 'Show/Name'), ('Show.Name.S01E02.Test-Test', 'Show. Name'), ('Show.Name.S01E02.Test-Test', 'Show- Name'), ('Show.Name.Part.IV.Test-Test', 'Show Name'), ('Show.Name.S01.Test-Test', 'Show Name'), ('Show.Name.E02.Test-Test', 'Show: Name'), ('Show Name Season 2 Test', 'Show: Name')] for testCase in list_of_cases: scene_name, show_name = testCase s = TVShow(1, 0) s.name = show_name s.saveToDB() self._test_isGoodName(scene_name, s)
def test_isGoodName(self): listOfcases = [('Show.Name.S01E02.Test-Test', 'Show/Name'), ('Show.Name.S01E02.Test-Test', 'Show. Name'), ('Show.Name.S01E02.Test-Test', 'Show- Name'), ('Show.Name.Part.IV.Test-Test', 'Show Name'), ('Show.Name.S01.Test-Test', 'Show Name'), ('Show.Name.E02.Test-Test', 'Show: Name'), ('Show Name Season 2 Test', 'Show: Name'), ] for testCase in listOfcases: scene_name, show_name = testCase s = TVShow(1, 0) s.name = show_name s.saveToDB() s.loadFromDB(skipNFO=True) self._test_isGoodName(scene_name, s) del s
def test_isGoodName(self): listOfcases = [('Show.Name.S01E02.Test-Test', 'Show/Name'), ('Show.Name.S01E02.Test-Test', 'Show. Name'), ('Show.Name.S01E02.Test-Test', 'Show- Name'), ('Show.Name.Part.IV.Test-Test', 'Show Name'), ('Show.Name.S01.Test-Test', 'Show Name'), ('Show.Name.E02.Test-Test', 'Show: Name'), ('Show Name Season 2 Test', 'Show: Name'), ] for testCase in listOfcases: scene_name, show_name = testCase s = TVShow(1, 0) s.name = show_name s.saveToDB() s.loadFromDB(skipNFO=True) self._test_isGoodName(scene_name, s) del s
def test(self): global searchItems searchItems = curData[b"i"] show = TVShow(1, tvdbdid) show.name = show_name show.quality = curData[b"q"] show.saveToDB() sickrage.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["i"] show = TVShow(1, tvdbdid) show.name = show_name show.quality = curData["q"] show.saveToDB() show.loadFromDB(skipNFO=True) sickrage.srCore.SHOWLIST.append(show) episode = None for epNumber in curData["e"]: episode = TVEpisode(show, curData["s"], epNumber) episode.status = WANTED episode.saveToDB() bestResult = searchProviders(show, episode.episode, forceSearch) if not bestResult: self.assertEqual(curData["b"], bestResult) self.assertEqual(curData["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() sickrage.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
def test_set_name(self): show = TVShow(0o001, 1) show.name = "newName" self.assertEqual(show.name, "newName")
def test_set_name(self): show = TVShow(1, 0001, "en") show.name = "newName" show.saveToDB() show.loadFromDB(skipNFO=True) self.assertEqual(show.name, "newName")
def test(self): show = TVShow(1, int(curData["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["e"]: episode = TVEpisode(show, curData["s"], epNumber) episode.status = WANTED # We arent updating scene numbers, so fake it here episode.scene_season = curData["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["s_strings"]) assert (episode_strings == curData["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.search(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
def _test_allPossibleShowNames(self, name, indexerid=0, expected=[]): s = TVShow(1, indexerid) s.name = name result = show_names.allPossibleShowNames(s) self.assertTrue(len(set(expected).intersection(set(result))) == len(expected))