fix plugin
This commit is contained in:
parent
464cdf5430
commit
0068e673ec
@ -210,7 +210,7 @@ docker pull jxxghp/moviepilot:latest
|
||||
**注意**
|
||||
|
||||
1) 容器首次启动需要下载浏览器内核,根据网络情况可能需要较长时间,此时无法登录。可映射`/root`目录避免容器重置后重新触发浏览器内核下载。
|
||||
2) 使用反向代理时,需要添加以下配置,否则要能会导致部分功能无法访问(`ip:port`修改为实际值):
|
||||
2) 使用反向代理时,需要添加以下配置,否则可能会导致部分功能无法访问(`ip:port`修改为实际值):
|
||||
```nginx configuration
|
||||
location / {
|
||||
proxy_pass http://ip:port;
|
||||
|
@ -19,4 +19,4 @@ class PluginData(Base):
|
||||
|
||||
@staticmethod
|
||||
def get_plugin_data_by_key(db: Session, plugin_id: str, key: str):
|
||||
return db.query(PluginData.value).filter(PluginData.plugin_id == plugin_id, PluginData.key == key).first()
|
||||
return db.query(PluginData).filter(PluginData.plugin_id == plugin_id, PluginData.key == key).first()
|
||||
|
@ -24,12 +24,15 @@ class PluginDataOper(DbOper):
|
||||
plugin = PluginData(plugin_id=plugin_id, key=key, value=value)
|
||||
return plugin.create(self._db)
|
||||
|
||||
def get_data(self, key: str) -> Any:
|
||||
def get_data(self, plugin_id: str, key: str) -> Any:
|
||||
"""
|
||||
获取插件数据
|
||||
:param plugin_id: 插件id
|
||||
:param key: 数据key
|
||||
"""
|
||||
data = PluginData.get_plugin_data_by_key(self._db, self.__class__.__name__, key)
|
||||
if ObjectUtils.is_obj(data):
|
||||
return json.load(data)
|
||||
return data
|
||||
data = PluginData.get_plugin_data_by_key(self._db, plugin_id, key)
|
||||
if not data:
|
||||
return None
|
||||
if ObjectUtils.is_obj(data.value):
|
||||
return json.loads(data.value)
|
||||
return data.value
|
||||
|
@ -145,7 +145,7 @@ class _PluginBase(metaclass=ABCMeta):
|
||||
获取插件数据
|
||||
:param key: 数据key
|
||||
"""
|
||||
return self.plugindata.get_data(key)
|
||||
return self.plugindata.get_data(self.__class__.__name__, key)
|
||||
|
||||
def post_message(self, channel: MessageChannel = None, mtype: NotificationType = None, title: str = None,
|
||||
text: str = None, image: str = None, link: str = None, userid: str = None):
|
||||
|
@ -1,5 +1,5 @@
|
||||
import traceback
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from multiprocessing.dummy import Pool as ThreadPool
|
||||
from multiprocessing.pool import ThreadPool
|
||||
from typing import Any, List, Dict, Tuple, Optional
|
||||
@ -264,7 +264,68 @@ class AutoSignIn(_PluginBase):
|
||||
"""
|
||||
拼装插件详情页面,需要返回页面配置,同时附带数据
|
||||
"""
|
||||
pass
|
||||
# 最近两天的日期数组
|
||||
date_list = [str((datetime.now() - timedelta(days=i)).date()) for i in range(2)]
|
||||
# 最近一天的签到数据
|
||||
current_day = ""
|
||||
sign_data = []
|
||||
for day in date_list:
|
||||
current_day = datetime.now().strftime('%Y-%m-%d')
|
||||
sign_data = self.get_data(current_day)
|
||||
if sign_data:
|
||||
break
|
||||
return [
|
||||
{
|
||||
'component': 'VTable',
|
||||
'props': {
|
||||
'hover': True
|
||||
},
|
||||
'content': [
|
||||
{
|
||||
'component': 'thead',
|
||||
'content': [
|
||||
{
|
||||
'component': 'th',
|
||||
'text': '日期'
|
||||
},
|
||||
{
|
||||
'component': 'th',
|
||||
'text': '站点'
|
||||
},
|
||||
{
|
||||
'component': 'th',
|
||||
'text': '状态'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'component': 'tbody',
|
||||
'content': [
|
||||
{
|
||||
'component': 'tr',
|
||||
'props': {
|
||||
'class': 'text-sm'
|
||||
},
|
||||
'content': [
|
||||
{
|
||||
'component': 'td',
|
||||
'text': current_day
|
||||
},
|
||||
{
|
||||
'component': 'td',
|
||||
'text': data.get("site")
|
||||
},
|
||||
{
|
||||
'component': 'td',
|
||||
'text': data.get("status")
|
||||
}
|
||||
]
|
||||
} for data in sign_data
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@eventmanager.register(EventType.SiteSignin)
|
||||
def sign_in(self, event: Event = None):
|
||||
|
@ -238,6 +238,7 @@ class DoubanSync(_PluginBase):
|
||||
"""
|
||||
拼装插件详情页面,需要返回页面配置,同时附带数据
|
||||
"""
|
||||
# TODO 查询同步详情
|
||||
pass
|
||||
|
||||
def stop_service(self):
|
||||
@ -286,6 +287,7 @@ class DoubanSync(_PluginBase):
|
||||
logger.info(f'已超过同步天数,标题:{title},发布时间:{pubdate}')
|
||||
continue
|
||||
douban_id = result.get("link", "").split("/")[-2]
|
||||
# 检查缓存
|
||||
if not douban_id or douban_id in caches:
|
||||
continue
|
||||
# 根据豆瓣ID获取豆瓣数据
|
||||
@ -323,12 +325,24 @@ class DoubanSync(_PluginBase):
|
||||
season=meta.begin_season,
|
||||
exist_ok=True,
|
||||
username="豆瓣想看")
|
||||
# 保存记录
|
||||
self.save_data('history', {
|
||||
"action": 'subscribe',
|
||||
"media": mediainfo.to_dict(),
|
||||
"time": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
})
|
||||
continue
|
||||
# 自动下载
|
||||
downloads, lefts = self.downloadchain.batch_download(contexts=contexts, no_exists=no_exists)
|
||||
if downloads and not lefts:
|
||||
# 全部下载完成
|
||||
logger.info(f'{mediainfo.title_year} 下载完成')
|
||||
# 保存记录
|
||||
self.save_data('history', {
|
||||
"action": 'download',
|
||||
"media": mediainfo.to_dict(),
|
||||
"time": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
})
|
||||
else:
|
||||
# 未完成下载
|
||||
logger.info(f'{mediainfo.title_year} 未下载未完整,添加订阅 ...')
|
||||
@ -340,6 +354,12 @@ class DoubanSync(_PluginBase):
|
||||
season=meta.begin_season,
|
||||
exist_ok=True,
|
||||
username="豆瓣想看")
|
||||
# 保存记录
|
||||
self.save_data('history', {
|
||||
"action": 'subscribe',
|
||||
"media": mediainfo.to_dict(),
|
||||
"time": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
})
|
||||
|
||||
logger.info(f"用户 {user_id} 豆瓣想看同步完成")
|
||||
# 保存缓存
|
||||
|
Loading…
x
Reference in New Issue
Block a user