當前位置: 首頁>>代碼示例>>Python>>正文


Python TVShow.saveToDB方法代碼示例

本文整理匯總了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))
開發者ID:gborri,項目名稱:SiCKRAGE,代碼行數:11,代碼來源:test_scene_helpers.py

示例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")
開發者ID:gborri,項目名稱:SiCKRAGE,代碼行數:12,代碼來源:test_tv.py

示例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]
開發者ID:TATUMTOT,項目名稱:SickRage,代碼行數:14,代碼來源:test_tv.py

示例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"
開發者ID:djenniex,項目名稱:SickBeard-TVRage,代碼行數:15,代碼來源:test_xem.py

示例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]
開發者ID:afctim,項目名稱:SiCKRAGE,代碼行數:15,代碼來源:test_tv.py

示例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)
開發者ID:TATUMTOT,項目名稱:SickRage,代碼行數:16,代碼來源:test_pp.py

示例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)
開發者ID:djenniex,項目名稱:SickBeard-TVRage,代碼行數:16,代碼來源:test_pp.py

示例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)
開發者ID:gborri,項目名稱:SiCKRAGE,代碼行數:17,代碼來源:test_tv.py

示例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"
開發者ID:afctim,項目名稱:SiCKRAGE,代碼行數:17,代碼來源:test_xem.py

示例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
開發者ID:gborri,項目名稱:SiCKRAGE,代碼行數:20,代碼來源:test_scene_helpers.py

示例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
開發者ID:TATUMTOT,項目名稱:SickRage,代碼行數:21,代碼來源:test_snatching.py

示例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)
開發者ID:thomas-burggraeve,項目名稱:SiCKRAGE,代碼行數:22,代碼來源:test_name_parser.py

示例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)
開發者ID:afctim,項目名稱:SiCKRAGE,代碼行數:104,代碼來源:show.py

示例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)
開發者ID:gborri,項目名稱:SiCKRAGE,代碼行數:104,代碼來源:show.py

示例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")
開發者ID:gborri,項目名稱:SiCKRAGE,代碼行數:8,代碼來源:test_tv.py


注:本文中的sickrage.core.tv.show.TVShow.saveToDB方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。