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


Python TVShow.flushEpisodes方法代碼示例

本文整理匯總了Python中sickrage.core.tv.show.TVShow.flushEpisodes方法的典型用法代碼示例。如果您正苦於以下問題:Python TVShow.flushEpisodes方法的具體用法?Python TVShow.flushEpisodes怎麽用?Python TVShow.flushEpisodes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sickrage.core.tv.show.TVShow的用法示例。


在下文中一共展示了TVShow.flushEpisodes方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: QueueItemAdd

# 需要導入模塊: from sickrage.core.tv.show import TVShow [as 別名]
# 或者: from sickrage.core.tv.show.TVShow import flushEpisodes [as 別名]

#.........這裏部分代碼省略.........
                                self.indexer).name + "")
            else:
                notifications.error(
                        "Unable to add show due to an error with " + sickrage.INDEXER_API(self.indexer).name + "")
            self._finishEarly()
            return

        except MultipleShowObjectsException:
            sickrage.LOGGER.warning("The show in " + self.showDir + " is already in your show list, skipping")
            notifications.error('Show skipped', "The show in " + self.showDir + " is already in your show list")
            self._finishEarly()
            return

        except Exception as e:
            sickrage.LOGGER.error("Error trying to add show: {}".format(e))
            sickrage.LOGGER.debug(traceback.format_exc())
            self._finishEarly()
            raise

        sickrage.LOGGER.debug("Retrieving show info from TMDb")
        try:
            self.show.loadTMDbInfo()
        except Exception as e:
            sickrage.LOGGER.error("Error loading TMDb info: {}".format(e))
            try:
                sickrage.LOGGER.debug("Attempting to retrieve show info from IMDb")
                self.show.loadIMDbInfo()
            except Exception as e:
                sickrage.LOGGER.error("Error loading IMDb info: {}".format(e))

        try:
            self.show.saveToDB()
        except Exception as e:
            sickrage.LOGGER.error("Error saving the show to the database: {}".format(e))
            sickrage.LOGGER.debug(traceback.format_exc())
            self._finishEarly()
            raise

        # add it to the show list
        sickrage.showList.append(self.show)

        try:
            self.show.loadEpisodesFromIndexer()
        except Exception as e:
            sickrage.LOGGER.error(
                    "Error with " + sickrage.INDEXER_API(
                            self.show.indexer).name + ", not creating episode list: {}".format(e))
            sickrage.LOGGER.debug(traceback.format_exc())

        # update internal name cache
        sickrage.NAMECACHE.buildNameCache()

        try:
            self.show.loadEpisodesFromDir()
        except Exception as e:
            sickrage.LOGGER.error("Error searching dir for episodes: {}".format(e))
            sickrage.LOGGER.debug(traceback.format_exc())

        # if they set default ep status to WANTED then run the backlog to search for episodes
        # FIXME: This needs to be a backlog queue item!!!
        if self.show.default_ep_status == WANTED:
            sickrage.LOGGER.info("Launching backlog for this show since its episodes are WANTED")
            sickrage.BACKLOGSEARCHER.searchBacklog([self.show])

        self.show.writeMetadata()
        self.show.updateMetadata()
        self.show.populateCache()

        self.show.flushEpisodes()

        if sickrage.USE_TRAKT:
            # if there are specific episodes that need to be added by trakt
            sickrage.TRAKTSEARCHER.manageNewShow(self.show)

            # add show to trakt.tv library
            if sickrage.TRAKT_SYNC:
                sickrage.TRAKTSEARCHER.addShowToTraktLibrary(self.show)

            if sickrage.TRAKT_SYNC_WATCHLIST:
                sickrage.LOGGER.info("update watchlist")
                sickrage.NOTIFIERS.trakt_notifier.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

        # After initial add, set to default_status_after.
        self.show.default_ep_status = self.default_status_after

        self.finish()

    def _finishEarly(self):
        if self.show is not None:
            sickrage.SHOWQUEUE.removeShow(self.show)

        self.finish()
開發者ID:ITJamie,項目名稱:SickRage,代碼行數:104,代碼來源:show.py


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