当前位置: 首页>>代码示例>>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;未经允许,请勿转载。