fix 订阅创建一分钟内不自动搜索,留出编辑订阅的时间
This commit is contained in:
@@ -185,6 +185,13 @@ class SubscribeChain(ChainBase):
|
||||
subscribes = self.subscribeoper.list(state)
|
||||
# 遍历订阅
|
||||
for subscribe in subscribes:
|
||||
# 校验当前时间减订阅创建时间是否大于1分钟,否则跳过先,留出编辑订阅的时间
|
||||
if subscribe.date:
|
||||
now = datetime.now()
|
||||
subscribe_time = datetime.strptime(subscribe.date, '%Y-%m-%d %H:%M:%S')
|
||||
if (now - subscribe_time).total_seconds() < 60:
|
||||
logger.debug(f"订阅标题:{subscribe.name} 新增小于1分钟,暂不搜索...")
|
||||
continue
|
||||
logger.info(f'开始搜索订阅,标题:{subscribe.name} ...')
|
||||
# 如果状态为N则更新为R
|
||||
if subscribe.state == 'N':
|
||||
|
@@ -49,6 +49,8 @@ class Subscribe(Base):
|
||||
state = Column(String, nullable=False, index=True, default='N')
|
||||
# 最后更新时间
|
||||
last_update = Column(String)
|
||||
# 创建时间
|
||||
date = Column(String)
|
||||
# 订阅用户
|
||||
username = Column(String)
|
||||
# 订阅站点
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import time
|
||||
from typing import Tuple, List
|
||||
|
||||
from app.core.context import MediaInfo
|
||||
@@ -26,6 +27,7 @@ class SubscribeOper(DbOper):
|
||||
backdrop=mediainfo.get_backdrop_image(),
|
||||
vote=mediainfo.vote_average,
|
||||
description=mediainfo.overview,
|
||||
date=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
|
||||
**kwargs)
|
||||
subscribe.create(self._db)
|
||||
return subscribe.id, "新增订阅成功"
|
||||
|
@@ -268,7 +268,7 @@ class SpeedLimiter(_PluginBase):
|
||||
'props': {
|
||||
'model': 'bandwidth',
|
||||
'label': '智能限速上行带宽',
|
||||
'placeholder': 'MB/s'
|
||||
'placeholder': 'Mbps'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
Reference in New Issue
Block a user