Merge remote-tracking branch 'origin/main'

This commit is contained in:
jxxghp 2023-09-01 15:00:37 +08:00
commit 0bb67824bd
6 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,30 @@
"""1.0.4
Revision ID: 1e169250e949
Revises: 52ab4930be04
Create Date: 2023-09-01 09:56:33.907661
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1e169250e949'
down_revision = '52ab4930be04'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('date', sa.String, nullable=True))
except Exception as e:
pass
# ### end Alembic commands ###
def downgrade() -> None:
pass

View File

@ -185,6 +185,13 @@ class SubscribeChain(ChainBase):
subscribes = self.subscribeoper.list(state) subscribes = self.subscribeoper.list(state)
# 遍历订阅 # 遍历订阅
for subscribe in subscribes: 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} ...') logger.info(f'开始搜索订阅,标题:{subscribe.name} ...')
# 如果状态为N则更新为R # 如果状态为N则更新为R
if subscribe.state == 'N': if subscribe.state == 'N':

View File

@ -49,6 +49,8 @@ class Subscribe(Base):
state = Column(String, nullable=False, index=True, default='N') state = Column(String, nullable=False, index=True, default='N')
# 最后更新时间 # 最后更新时间
last_update = Column(String) last_update = Column(String)
# 创建时间
date = Column(String)
# 订阅用户 # 订阅用户
username = Column(String) username = Column(String)
# 订阅站点 # 订阅站点

View File

@ -1,3 +1,4 @@
import time
from typing import Tuple, List from typing import Tuple, List
from app.core.context import MediaInfo from app.core.context import MediaInfo
@ -26,6 +27,7 @@ class SubscribeOper(DbOper):
backdrop=mediainfo.get_backdrop_image(), backdrop=mediainfo.get_backdrop_image(),
vote=mediainfo.vote_average, vote=mediainfo.vote_average,
description=mediainfo.overview, description=mediainfo.overview,
date=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
**kwargs) **kwargs)
subscribe.create(self._db) subscribe.create(self._db)
return subscribe.id, "新增订阅成功" return subscribe.id, "新增订阅成功"

View File

@ -268,7 +268,7 @@ class SpeedLimiter(_PluginBase):
'props': { 'props': {
'model': 'bandwidth', 'model': 'bandwidth',
'label': '智能限速上行带宽', 'label': '智能限速上行带宽',
'placeholder': 'MB/s' 'placeholder': 'Mbps'
} }
} }
] ]

View File

@ -104,6 +104,9 @@ class SystemUtils:
if directory.is_file(): if directory.is_file():
return [directory] return [directory]
if not min_filesize:
min_filesize = 0
files = [] files = []
pattern = r".*(" + "|".join(extensions) + ")$" pattern = r".*(" + "|".join(extensions) + ")$"