diff --git a/app/api/endpoints/site.py b/app/api/endpoints/site.py index 3e078af28..92316cc4e 100644 --- a/app/api/endpoints/site.py +++ b/app/api/endpoints/site.py @@ -234,14 +234,14 @@ def read_rss_sites(db: Session = Depends(get_db)) -> List[dict]: 获取站点列表 """ # 选中的rss站点 - rss_sites = SystemConfigOper().get(SystemConfigKey.RssSites) + selected_sites = SystemConfigOper().get(SystemConfigKey.RssSites) or [] # 所有站点 all_site = Site.list_order_by_pri(db) - if not rss_sites or not all_site: + if not selected_sites or not all_site: return [] # 选中的rss站点 - rss_sites = [site for site in all_site if site and site.id in rss_sites] + rss_sites = [site for site in all_site if site and site.id in selected_sites] return rss_sites diff --git a/app/chain/search.py b/app/chain/search.py index b4c865525..2c390dbcd 100644 --- a/app/chain/search.py +++ b/app/chain/search.py @@ -247,14 +247,14 @@ def __search_all_sites(self, mediainfo: Optional[MediaInfo] = None, """ # 未开启的站点不搜索 indexer_sites = [] + # 配置的索引站点 - if sites: - config_indexers = [str(sid) for sid in sites] - else: - config_indexers = [str(sid) for sid in self.systemconfig.get(SystemConfigKey.IndexerSites) or []] + if not sites: + sites = self.systemconfig.get(SystemConfigKey.IndexerSites) or [] + for indexer in self.siteshelper.get_indexers(): # 检查站点索引开关 - if not config_indexers or str(indexer.get("id")) in config_indexers: + if not sites or indexer.get("id") in sites: # 站点流控 state, msg = self.siteshelper.check(indexer.get("domain")) if state: @@ -264,6 +264,7 @@ def __search_all_sites(self, mediainfo: Optional[MediaInfo] = None, if not indexer_sites: logger.warn('未开启任何有效站点,无法搜索资源') return [] + # 开始进度 self.progress.start(ProgressKey.Search) # 开始计时 diff --git a/app/chain/torrents.py b/app/chain/torrents.py index b92b9cf6d..c86bdf53d 100644 --- a/app/chain/torrents.py +++ b/app/chain/torrents.py @@ -129,7 +129,7 @@ def refresh(self, stype: str = None, sites: List[int] = None) -> Dict[str, List[ # 刷新站点 if not sites: - sites = [str(sid) for sid in (self.systemconfig.get(SystemConfigKey.RssSites) or [])] + sites = self.systemconfig.get(SystemConfigKey.RssSites) or [] # 读取缓存 torrents_cache = self.get_torrents() @@ -139,7 +139,7 @@ def refresh(self, stype: str = None, sites: List[int] = None) -> Dict[str, List[ # 遍历站点缓存资源 for indexer in indexers: # 未开启的站点不刷新 - if sites and str(indexer.get("id")) not in sites: + if sites and indexer.get("id") not in sites: continue domain = StringUtils.get_url_domain(indexer.get("domain")) if stype == "spider":