add 站点图标缓存

This commit is contained in:
jxxghp
2023-06-12 11:16:37 +08:00
parent e10776cf1d
commit a111c1dea9
13 changed files with 110 additions and 65 deletions

View File

@ -6,6 +6,7 @@ from lxml import etree
from app.chain import ChainBase
from app.core.config import settings
from app.db.siteicons import SiteIcons
from app.db.sites import Sites
from app.helper.cookiecloud import CookieCloudHelper
from app.helper.sites import SitesHelper
@ -21,6 +22,7 @@ class CookieCloudChain(ChainBase):
def __init__(self):
super().__init__()
self.sites = Sites()
self.siteicons = SiteIcons()
self.siteshelper = SitesHelper()
self.cookiecloud = CookieCloudHelper(
server=settings.COOKIECLOUD_HOST,
@ -60,10 +62,10 @@ class CookieCloudChain(ChainBase):
cookie=cookie,
ua=settings.USER_AGENT)
if icon_url:
self.sites.update_icon(name=indexer.get("name"),
domain=domain,
icon_url=icon_url,
icon_base64=icon_base64)
self.siteicons.update_icon(name=indexer.get("name"),
domain=domain,
icon_url=icon_url,
icon_base64=icon_base64)
# 处理完成
ret_msg = f"更新了{_update_count}个站点,新增了{_add_count}个站点"
logger.info(f"CookieCloud同步成功{ret_msg}")

View File

@ -86,7 +86,7 @@ class UserMessageChain(ChainBase):
mediainfo=self._current_media)
if exist_flag:
self.post_message(title=f"{self._current_media.get_title_string()}"
f"{self._current_meta.get_season_string()} 媒体库中已存在",
f"{self._current_meta.get_season()} 媒体库中已存在",
userid=userid)
return
# 发送缺失的媒体信息
@ -106,7 +106,7 @@ class UserMessageChain(ChainBase):
if not contexts:
# 没有数据
self.post_message(title=f"{mediainfo.title}"
f"{self._current_meta.get_season_string()} 未搜索到资源!",
f"{self._current_meta.get_season()} 未搜索到资源!",
userid=userid)
return
# 搜索结果排序
@ -142,7 +142,7 @@ class UserMessageChain(ChainBase):
mediainfo=self._current_media)
if exist_flag:
self.post_message(title=f"{self._current_media.get_title_string()}"
f"{self._current_meta.get_season_string()} 媒体库中已存在",
f"{self._current_meta.get_season()} 媒体库中已存在",
userid=userid)
return
# 批量下载