本文整理汇总了Python中sickrage.core.tv.show.TVShow类的典型用法代码示例。如果您正苦于以下问题:Python TVShow类的具体用法?Python TVShow怎么用?Python TVShow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TVShow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_init_empty_db
def test_init_empty_db(self):
show = TVShow(1, 0001, "en")
show.saveToDB()
show.loadFromDB(skipNFO=True)
ep = TVEpisode(show, 1, 1)
ep.name = "asdasdasdajkaj"
ep.saveToDB()
ep.loadFromDB(1, 1)
self.assertEqual(ep.name, "asdasdasdajkaj")
示例2: _test_allPossibleShowNames
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))
示例3: test_process
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)
示例4: AnimeTests
class AnimeTests(tests.SiCKRAGETestDBCase):
def setUp(self):
super(AnimeTests, self).setUp()
self.show = TVShow(1, 1, 'en')
self.show.anime = True
self.show.save_to_db()
def _test_names(self, np, section, transform=None, verbose=False):
"""
Performs a test
:param name_parser: to use for test
:param section:
:param transform:
:param verbose:
:return:
"""
if VERBOSE or verbose:
print()
print('Running', section, 'tests')
for cur_test_base in anime_test_cases[section]:
if transform:
cur_test = transform(cur_test_base)
np.file_name = cur_test
else:
cur_test = cur_test_base
if VERBOSE or verbose:
print('Testing', cur_test)
result = anime_test_cases[section][cur_test_base]
np.showObj.name = result.series_name if result else None
if not result:
self.assertRaises(InvalidNameException, np.parse, cur_test)
return
else:
result.which_regex = {section}
test_result = np.parse(cur_test)
if DEBUG or verbose:
print('air_by_date:', test_result.is_air_by_date, 'air_date:', test_result.air_date)
print('anime:', test_result.is_anime, 'ab_episode_numbers:', test_result.ab_episode_numbers)
print(test_result)
print(result)
self.assertEqual(test_result.which_regex, {section},
'{} : {} != {}'.format(cur_test, test_result.which_regex, {section}))
self.assertEqual(test_result, result, '{} : {} != {}'.format(cur_test, test_result, result))
def test_anime_sxxexx_file_names(self):
"""
Test anime SxxExx file names
"""
np = NameParser(showObj=self.show, validate_show=False)
self._test_names(np, 'anime_SxxExx', lambda x: x + '.avi')
示例5: load_shows
def load_shows(self):
"""
Populates the showlist with shows from the database
"""
for dbData in [x['doc'] for x in self.main_db.db.all('tv_shows', with_doc=True)]:
try:
self.log.debug("Loading data for show: [{}]".format(dbData['show_name']))
show = TVShow(int(dbData['indexer']), int(dbData['indexer_id']))
show.nextEpisode()
self.showlist += [show]
except Exception as e:
self.log.error("Show error in [%s]: %s" % (dbData['location'], e.message))
示例6: loadFromDB
def loadFromDB(self):
"""
Populates the showList with shows from the database
"""
for s in [s['doc'] for s in sickrage.srCore.mainDB.db.all('tv_shows', with_doc=True)]:
try:
curShow = TVShow(int(s["indexer"]), int(s["indexer_id"]))
curShow.saveToDB()
curShow.loadFromDB(skipNFO=True)
sickrage.srCore.SHOWLIST.append(curShow)
except Exception as e:
print "There was an error creating the show"
示例7: test_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)
示例8: test_isGoodName
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)
示例9: loadFromDB
def loadFromDB(self):
"""
Populates the showList with shows from the database
"""
sqlResults = main_db.MainDB().select("SELECT * FROM tv_shows")
for sqlShow in sqlResults:
try:
curShow = TVShow(int(sqlShow["indexer"]), int(sqlShow["indexer_id"]))
curShow.saveToDB()
curShow.loadFromDB(skipNFO=True)
sickrage.srCore.SHOWLIST.append(curShow)
except Exception as e:
print "There was an error creating the show"
示例10: __init__
def __init__(self, something):
super(UnicodeTests, self).__init__(something)
self.setUp()
self.show = TVShow(1, 1, "en")
self.show.name = "The Big Bang Theory"
self.show.saveToDB()
self.show.loadFromDB(skipNFO=True)
示例11: load_shows
def load_shows(self):
"""
Populates the showlist with shows from the database
"""
for sqlShow in main_db.MainDB().select("SELECT * FROM tv_shows"):
try:
curshow = TVShow(int(sqlShow["indexer"]), int(sqlShow["indexer_id"]))
self.srLogger.debug("Loading data for show: [{}]".format(curshow.name))
#self.NAMECACHE.buildNameCache(curshow)
curshow.nextEpisode()
self.SHOWLIST += [curshow]
except Exception as e:
self.srLogger.error(
"There was an error creating the show in {}: {}".format(sqlShow["location"], e.message))
self.srLogger.debug(traceback.format_exc())
示例12: UnicodeTests
class UnicodeTests(tests.SiCKRAGETestDBCase):
def setUp(self):
super(UnicodeTests, self).setUp()
self.show = TVShow(1, 1, 'en')
self.show.name = "The Big Bang Theory"
self.show.save_to_db()
def _test_unicode(self, name, result):
np = NameParser(True, showObj=self.show, validate_show=False)
parse_result = np.parse(name)
# this shouldn't raise an exception
repr(str(parse_result))
self.assertEqual(parse_result.extra_info, result.extra_info)
def test_unicode(self):
for (name, result) in unicode_test_cases:
self._test_unicode(name, result)
示例13: test
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
示例14: load_shows
def load_shows():
"""
Populates the showlist with shows from the database
"""
showlist = []
for sqlShow in main_db.MainDB().select("SELECT * FROM tv_shows"):
try:
curshow = TVShow(int(sqlShow[b"indexer"]), int(sqlShow[b"indexer_id"]))
sickrage.LOGGER.debug("Loading data for show: [{}]".format(curshow.name))
sickrage.NAMECACHE.buildNameCache(curshow)
curshow.nextEpisode()
showlist += [curshow]
except Exception as e:
sickrage.LOGGER.error("There was an error creating the show in {}: {}".format(sqlShow[b"location"], e))
sickrage.LOGGER.debug(traceback.format_exc())
continue
return showlist
示例15: UnicodeTests
class UnicodeTests(SiCKRAGETestDBCase):
def __init__(self, something):
super(UnicodeTests, self).__init__(something)
self.setUp()
self.show = TVShow(1, 1, "en")
self.show.name = "The Big Bang Theory"
self.show.saveToDB()
self.show.loadFromDB(skipNFO=True)
def _test_unicode(self, name, result):
np = NameParser(True, showObj=self.show)
parse_result = np.parse(name)
# this shouldn't raise an exception
repr(str(parse_result))
self.assertEqual(parse_result.extra_info, result.extra_info)
def test_unicode(self):
for (name, result) in unicode_test_cases:
self._test_unicode(name, result)