本文整理汇总了Python中sickrage.core.tv.show.TVShow.saveToDB方法的典型用法代码示例。如果您正苦于以下问题:Python TVShow.saveToDB方法的具体用法?Python TVShow.saveToDB怎么用?Python TVShow.saveToDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sickrage.core.tv.show.TVShow
的用法示例。
在下文中一共展示了TVShow.saveToDB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _test_allPossibleShowNames
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import saveToDB [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 saveToDB [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 saveToDB [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()
sickrage.showList = [show]
示例4: loadFromDB
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import saveToDB [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_getEpisode
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import saveToDB [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.srCore.SHOWLIST = [show]
示例6: test_process
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import saveToDB [as 别名]
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)
示例7: test_process
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import saveToDB [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)
示例8: test_change_indexerid
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import saveToDB [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)
示例9: loadFromDB
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import saveToDB [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"
示例10: test_isGoodName
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import saveToDB [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
示例11: test
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import saveToDB [as 别名]
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
示例12: UnicodeTests
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import saveToDB [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)
示例13: QueueItemAdd
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import saveToDB [as 别名]
#.........这里部分代码省略.........
sickrage.srCore.srLogger.error(
"Unable to add show due to an error with " + srIndexerApi(
self.indexer).name + ": {}".format(e.message))
if self.show:
sickrage.srCore.srNotifications.error(
"Unable to add " + str(self.show.name) + " due to an error with " + srIndexerApi(
self.indexer).name + "")
else:
sickrage.srCore.srNotifications.error(
"Unable to add show due to an error with " + srIndexerApi(self.indexer).name + "")
return self._finishEarly()
except MultipleShowObjectsException:
sickrage.srCore.srLogger.warning("The show in " + self.showDir + " is already in your show list, skipping")
sickrage.srCore.srNotifications.error('Show skipped',
"The show in " + self.showDir + " is already in your show list")
return self._finishEarly()
except Exception as e:
sickrage.srCore.srLogger.error("Error trying to add show: {}".format(e.message))
sickrage.srCore.srLogger.debug(traceback.format_exc())
raise self._finishEarly()
sickrage.srCore.srLogger.debug("Retrieving show info from TMDb")
try:
self.show.loadTMDbInfo()
except Exception as e:
sickrage.srCore.srLogger.error("Error loading TMDb info: {}".format(e.message))
try:
sickrage.srCore.srLogger.debug("Attempting to retrieve show info from IMDb")
self.show.loadIMDbInfo()
except Exception as e:
sickrage.srCore.srLogger.error("Error loading IMDb info: {}".format(e.message))
# Load XEM data to DB for show
xem_refresh(self.show.indexerid, self.show.indexer, force=True)
# check if show has XEM mapping so we can determin if searches should go by scene numbering or indexer numbering.
if not self.scene and get_xem_numbering_for_show(self.show.indexerid, self.show.indexer):
self.show.scene = 1
try:
self.show.saveToDB()
except Exception as e:
sickrage.srCore.srLogger.error("Error saving the show to the database: {}".format(e.message))
sickrage.srCore.srLogger.debug(traceback.format_exc())
raise self._finishEarly()
# add it to the show list
sickrage.srCore.SHOWLIST.append(self.show)
try:
self.show.loadEpisodesFromIndexer()
except Exception as e:
sickrage.srCore.srLogger.error(
"Error with " + srIndexerApi(
self.show.indexer).name + ", not creating episode list: {}".format(e.message))
sickrage.srCore.srLogger.debug(traceback.format_exc())
try:
self.show.loadEpisodesFromDir()
except Exception as e:
sickrage.srCore.srLogger.debug("Error searching dir for episodes: {}".format(e.message))
sickrage.srCore.srLogger.debug(traceback.format_exc())
# if they set default ep status to WANTED then run the backlog to search for episodes
if self.show.default_ep_status == WANTED:
sickrage.srCore.srLogger.info("Launching backlog for this show since its episodes are WANTED")
sickrage.srCore.BACKLOGSEARCHER.searchBacklog([self.show])
self.show.writeMetadata()
self.show.updateMetadata()
self.show.populateCache()
if sickrage.srCore.srConfig.USE_TRAKT:
# if there are specific episodes that need to be added by trakt
sickrage.srCore.TRAKTSEARCHER.manageNewShow(self.show)
# add show to trakt.tv library
if sickrage.srCore.srConfig.TRAKT_SYNC:
sickrage.srCore.TRAKTSEARCHER.addShowToTraktLibrary(self.show)
if sickrage.srCore.srConfig.TRAKT_SYNC_WATCHLIST:
sickrage.srCore.srLogger.info("update watchlist")
sickrage.srCore.notifiersDict.trakt_notifier.update_watchlist(show_obj=self.show)
# After initial add, set to default_status_after.
sickrage.srCore.srLogger.info(
"Setting all future episodes to the specified default status: " + str(self.default_status_after))
self.show.default_ep_status = self.default_status_after
self.show.saveToDB()
sickrage.srCore.NAMECACHE.buildNameCache(self.show)
sickrage.srCore.srLogger.info("Finished adding show {}".format(self.showDir))
def _finishEarly(self):
if self.show:
sickrage.srCore.SHOWQUEUE.removeShow(self.show)
示例14: QueueItemAdd
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import saveToDB [as 别名]
#.........这里部分代码省略.........
# if self.show.classification and "sports" in self.show.classification.lower():
# self.show.sports = 1
except indexer_exception as e:
sickrage.app.log.error(
"Unable to add show due to an error with " + IndexerApi(
self.indexer).name + ": {}".format(e.message))
if self.show:
sickrage.app.alerts.error(
_("Unable to add ") + str(self.show.name) + _(" due to an error with ") + IndexerApi(
self.indexer).name + "")
else:
sickrage.app.alerts.error(
_("Unable to add show due to an error with ") + IndexerApi(self.indexer).name + "")
return self._finishEarly()
except MultipleShowObjectsException:
sickrage.app.log.warning("The show in " + self.showDir + " is already in your show list, skipping")
sickrage.app.alerts.error(_('Show skipped'),
_("The show in ") + self.showDir + _(" is already in your show list"))
return self._finishEarly()
except Exception as e:
sickrage.app.log.error("Error trying to add show: {}".format(e.message))
sickrage.app.log.debug(traceback.format_exc())
raise self._finishEarly()
try:
sickrage.app.log.debug("Attempting to retrieve show info from IMDb")
self.show.loadIMDbInfo()
except Exception as e:
sickrage.app.log.error("Error loading IMDb info: {}".format(e.message))
try:
self.show.saveToDB()
except Exception as e:
sickrage.app.log.error("Error saving the show to the database: {}".format(e.message))
sickrage.app.log.debug(traceback.format_exc())
raise self._finishEarly()
# add it to the show list
if not findCertainShow(sickrage.app.showlist, self.indexer_id): sickrage.app.showlist.append(self.show)
try:
self.show.loadEpisodesFromIndexer()
except Exception as e:
sickrage.app.log.error(
"Error with " + IndexerApi(
self.show.indexer).name + ", not creating episode list: {}".format(e.message))
sickrage.app.log.debug(traceback.format_exc())
try:
self.show.loadEpisodesFromDir()
except Exception as e:
sickrage.app.log.debug("Error searching dir for episodes: {}".format(e.message))
sickrage.app.log.debug(traceback.format_exc())
# if they set default ep status to WANTED then run the backlog to search for episodes
if self.show.default_ep_status == WANTED:
sickrage.app.log.info("Launching backlog for this show since its episodes are WANTED")
sickrage.app.backlog_searcher.searchBacklog([self.show])
self.show.writeMetadata()
self.show.updateMetadata()
self.show.populateCache()
if sickrage.app.config.use_trakt:
# if there are specific episodes that need to be added by trakt
sickrage.app.trakt_searcher.manageNewShow(self.show)
# add show to trakt.tv library
if sickrage.app.config.trakt_sync:
sickrage.app.trakt_searcher.addShowToTraktLibrary(self.show)
if sickrage.app.config.trakt_sync_watchlist:
sickrage.app.log.info("update watchlist")
sickrage.app.notifier_providers['trakt'].update_watchlist(show_obj=self.show)
# Load XEM data to DB for show
xem_refresh(self.show.indexerid, self.show.indexer, force=True)
# check if show has XEM mapping so we can determin if searches should go by scene numbering or indexer numbering.
if not self.scene and get_xem_numbering_for_show(self.show.indexerid, self.show.indexer):
self.show.scene = 1
self.show.default_ep_status = self.default_status_after
self.show.saveToDB()
sickrage.app.name_cache.build(self.show)
self.finish()
sickrage.app.log.info(
"Finished adding show {} in {}s from show dir: {}".format(self.show_name,
round(time.time() - self.startTime, 2),
self.showDir))
def _finishEarly(self):
if self.show: sickrage.app.show_queue.removeShow(self.show)
示例15: test_set_name
# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import saveToDB [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")