From ed119b7bebedaead66b81ddbfb88c3ef55514596 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 6 May 2024 12:37:51 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=95=B0=E6=8D=AE=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/endpoints/subscribe.py | 10 +++++++++- app/helper/plugin.py | 2 ++ app/helper/subscribe.py | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/api/endpoints/subscribe.py b/app/api/endpoints/subscribe.py index dc5b11cf..48f8102e 100644 --- a/app/api/endpoints/subscribe.py +++ b/app/api/endpoints/subscribe.py @@ -1,6 +1,7 @@ import json from typing import List, Any +import cn2an from fastapi import APIRouter, Request, BackgroundTasks, Depends, HTTPException, Header from sqlalchemy.orm import Session @@ -351,7 +352,14 @@ def popular_subscribes( for sub in subscribes: media = MediaInfo() media.type = MediaType(sub.get("type")) - media.title = sub.get("name") + # 处理标题 + title = sub.get("name") + season = sub.get("season") + if season and int(season) > 1: + # 小写数据转大写 + season_str = cn2an.an2cn(season, "low") + title = f"{title} 第{season_str}季" + media.title = title media.year = sub.get("year") media.tmdb_id = sub.get("tmdbid") media.douban_id = sub.get("doubanid") diff --git a/app/helper/plugin.py b/app/helper/plugin.py index 12309418..23aaae53 100644 --- a/app/helper/plugin.py +++ b/app/helper/plugin.py @@ -81,6 +81,8 @@ class PluginHelper(metaclass=Singleton): """ 获取插件安装统计 """ + if not settings.PLUGIN_STATISTIC_SHARE: + return {} res = RequestUtils(timeout=10).get_res(self._install_statistic) if res and res.status_code == 200: return res.json() diff --git a/app/helper/subscribe.py b/app/helper/subscribe.py index 3c70ddb1..abe4875e 100644 --- a/app/helper/subscribe.py +++ b/app/helper/subscribe.py @@ -29,11 +29,13 @@ class SubscribeHelper(metaclass=Singleton): if self.sub_report(): self.systemconfig.set(SystemConfigKey.SubscribeReport, "1") - @cached(cache=TTLCache(maxsize=10, ttl=1800)) + @cached(cache=TTLCache(maxsize=20, ttl=1800)) def get_statistic(self, stype: str, page: int = 1, count: int = 30) -> List[dict]: """ 获取订阅统计数据 """ + if not settings.SUBSCRIBE_STATISTIC_SHARE: + return [] res = RequestUtils(timeout=15).get_res(self._sub_statistic, params={ "stype": stype, "page": page,