Merge pull request #636 from InfinityPacer/main

This commit is contained in:
jxxghp
2025-01-12 21:26:32 +08:00
committed by GitHub
2 changed files with 48 additions and 15 deletions

View File

@@ -20,13 +20,13 @@
"name": "站点刷流",
"description": "自动托管刷流,将会提高对应站点的访问频率。",
"labels": "刷流,仪表板",
"version": "4.0.1",
"version": "4.1",
"icon": "brush.jpg",
"author": "jxxghp,InfinityPacer",
"level": 2,
"history": {
"v4.0.1": "NexusPHP 站点支持自动跳过下载提示页调整为站点独立配置项",
"v4.0": "NexusPHP 站点支持自动跳过下载提示页",
"v4.1": "支持通过CRON表达式配置开启时间固定10分钟为执行周期",
"v4.0": "站点独立配置项支持配置NexusPHP 站点自动跳过下载提示页",
"v3.9": "MoviePilot V2 版本站点刷流插件"
}
},

View File

@@ -11,6 +11,7 @@ from urllib.parse import urlparse, parse_qs, unquote, parse_qsl, urlencode, urlu
import pytz
from app.helper.sites import SitesHelper
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.cron import CronTrigger
from app import schemas
from app.chain.torrents import TorrentsChain
@@ -72,6 +73,7 @@ class BrushConfig:
self.brush_sequential = config.get("brush_sequential", False)
self.proxy_delete = config.get("proxy_delete", False)
self.active_time_range = config.get("active_time_range")
self.cron = config.get("cron")
self.qb_category = config.get("qb_category")
self.site_hr_active = config.get("site_hr_active", False)
self.site_skip_tips = config.get("site_skip_tips", False)
@@ -249,7 +251,7 @@ class BrushFlow(_PluginBase):
# 插件图标
plugin_icon = "brush.jpg"
# 插件版本
plugin_version = "4.0.1"
plugin_version = "4.1"
# 插件作者
plugin_author = "jxxghp,InfinityPacer"
# 作者主页
@@ -431,14 +433,27 @@ class BrushFlow(_PluginBase):
return services
if self._task_brush_enable:
logger.info(f"站点刷流定时服务启动,时间间隔 {self._brush_interval} 分钟")
services.append({
"id": "BrushFlow",
"name": "站点刷流服务",
"trigger": "interval",
"func": self.brush,
"kwargs": {"minutes": self._brush_interval}
})
if brush_config.cron:
values = brush_config.cron.split()
values[0] = f"{datetime.now().minute % 10}/5"
cron = " ".join(values)
logger.info(f"站点刷流定时服务启动,执行周期 {cron}")
cron_trigger = CronTrigger.from_crontab(cron)
services.append({
"id": "BrushFlow",
"name": "站点刷流服务",
"trigger": cron_trigger,
"func": self.brush
})
else:
logger.info(f"站点刷流定时服务启动,时间间隔 {self._brush_interval} 分钟")
services.append({
"id": "BrushFlow",
"name": "站点刷流服务",
"trigger": "interval",
"func": self.brush,
"kwargs": {"minutes": self._brush_interval}
})
if brush_config.enabled:
logger.info(f"站点刷流检查定时服务启动,时间间隔 {self._check_interval} 分钟")
@@ -888,7 +903,7 @@ class BrushFlow(_PluginBase):
'component': 'VCol',
'props': {
"cols": 12,
"md": 4
"md": 3
},
'content': [
{
@@ -905,7 +920,24 @@ class BrushFlow(_PluginBase):
'component': 'VCol',
'props': {
"cols": 12,
"md": 4
"md": 3
},
'content': [
{
'component': 'VTextField',
'props': {
'model': 'cron',
'label': '执行周期',
'placeholder': '0 0-1 * * FRI,SUN'
}
}
]
},
{
'component': 'VCol',
'props': {
"cols": 12,
"md": 3
},
'content': [
{
@@ -922,7 +954,7 @@ class BrushFlow(_PluginBase):
'component': 'VCol',
'props': {
"cols": 12,
"md": 4
"md": 3
},
'content': [
{
@@ -2945,6 +2977,7 @@ class BrushFlow(_PluginBase):
"brush_sequential": brush_config.brush_sequential,
"proxy_delete": brush_config.proxy_delete,
"active_time_range": brush_config.active_time_range,
"cron": brush_config.cron,
"qb_category": brush_config.qb_category,
"enable_site_config": brush_config.enable_site_config,
"site_config": brush_config.site_config,