本文整理汇总了Python中sickrage.core.tv.show.TVShow.loadFromDB方法的典型用法代码示例。如果您正苦于以下问题:Python TVShow.loadFromDB方法的具体用法?Python TVShow.loadFromDB怎么用?Python TVShow.loadFromDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sickrage.core.tv.show.TVShow
的用法示例。
在下文中一共展示了TVShow.loadFromDB方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _test_allPossibleShowNames
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import loadFromDB [as 别名]
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))
示例2: test_init_empty_db
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import loadFromDB [as 别名]
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")
示例3: test_getEpisode
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import loadFromDB [as 别名]
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.app.showlist = [show]
示例4: loadFromDB
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import loadFromDB [as 别名]
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"
示例5: test_process
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import loadFromDB [as 别名]
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)
示例6: test_change_indexerid
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import loadFromDB [as 别名]
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)
示例7: loadFromDB
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import loadFromDB [as 别名]
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"
示例8: test_isGoodName
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import loadFromDB [as 别名]
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
示例9: test
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import loadFromDB [as 别名]
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
示例10: UnicodeTests
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import loadFromDB [as 别名]
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)
示例11: test_set_name
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import loadFromDB [as 别名]
def test_set_name(self):
show = TVShow(1, 0001, "en")
show.name = "newName"
show.saveToDB()
show.loadFromDB(skipNFO=True)
self.assertEqual(show.name, "newName")
示例12: test_init_indexerid
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import loadFromDB [as 别名]
def test_init_indexerid(self):
show = TVShow(1, 0001, "en")
show.saveToDB()
show.loadFromDB(skipNFO=True)
self.assertEqual(show.indexerid, 0001)
示例13: test
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import loadFromDB [as 别名]
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