当前位置: 首页>>代码示例>>Python>>正文


Python TVShow.load_episodes_from_indexer方法代码示例

本文整理汇总了Python中sickrage.core.tv.show.TVShow.load_episodes_from_indexer方法的典型用法代码示例。如果您正苦于以下问题:Python TVShow.load_episodes_from_indexer方法的具体用法?Python TVShow.load_episodes_from_indexer怎么用?Python TVShow.load_episodes_from_indexer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sickrage.core.tv.show.TVShow的用法示例。


在下文中一共展示了TVShow.load_episodes_from_indexer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: QueueItemAdd

# 需要导入模块: from sickrage.core.tv.show import TVShow [as 别名]
# 或者: from sickrage.core.tv.show.TVShow import load_episodes_from_indexer [as 别名]

#.........这里部分代码省略.........

        except indexer_exception as e:
            sickrage.app.log.warning(
                "Unable to add show due to an error with " + IndexerApi(
                    self.indexer).name + ": {}".format(e))
            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._finish_early()

        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._finish_early()

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

        try:
            sickrage.app.log.debug("Attempting to retrieve show info from IMDb")
            self.show.load_imdb_info()
        except Exception as e:
            sickrage.app.log.error("Error loading IMDb info: {}".format(e))

        try:
            self.show.save_to_db()
        except Exception as e:
            sickrage.app.log.error("Error saving the show to the database: {}".format(e))
            sickrage.app.log.debug(traceback.format_exc())
            raise self._finish_early()

        # add it to the show list
        if not findCertainShow(self.indexer_id):
            sickrage.app.showlist.append(self.show)

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

        try:
            self.show.load_episodes_from_dir()
        except Exception as e:
            sickrage.app.log.debug("Error searching dir for episodes: {}".format(e))
            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.search_backlog([self.show])

        self.show.write_metadata(force=True)
        self.show.populate_cache()

        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.save_to_db()

        sickrage.app.name_cache.build(self.show)

        sickrage.app.quicksearch_cache.add_show(self.show.indexerid)

        self.finish()

        sickrage.app.log.info(
            "Finished adding show {} in {}s from show dir: {}".format(self.show_name,
                                                                      round(time.time() - start_time, 2),
                                                                      self.showDir))

    def _finish_early(self):
        if self.show: sickrage.app.show_queue.removeShow(self.show)
开发者ID:SiCKRAGETV,项目名称:SiCKRAGE,代码行数:104,代码来源:show.py


注:本文中的sickrage.core.tv.show.TVShow.load_episodes_from_indexer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。