mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-04-13 17:52:28 +08:00
feat(recommend): add job to refresh recommend cache
This commit is contained in:
@@ -62,6 +62,7 @@ class RecommendChain(ChainBase, metaclass=Singleton):
|
||||
self.tmdb_tvs()
|
||||
self.tmdb_trending()
|
||||
self.bangumi_calendar()
|
||||
self.douban_movie_showing()
|
||||
self.douban_movies()
|
||||
self.douban_tvs()
|
||||
self.douban_movie_top250()
|
||||
@@ -88,7 +89,7 @@ class RecommendChain(ChainBase, metaclass=Singleton):
|
||||
@log_execution_time(logger=logger)
|
||||
@cached_with_empty_check
|
||||
def tmdb_tvs(self, sort_by: str = "popularity.desc", with_genres: str = "",
|
||||
with_original_language: str = "", page: int = 1) -> Any:
|
||||
with_original_language: str = "zh|en|ja|ko", page: int = 1) -> Any:
|
||||
"""
|
||||
TMDB热门电视剧
|
||||
"""
|
||||
|
||||
@@ -11,6 +11,7 @@ from apscheduler.schedulers.background import BackgroundScheduler
|
||||
from app import schemas
|
||||
from app.chain import ChainBase
|
||||
from app.chain.mediaserver import MediaServerChain
|
||||
from app.chain.recommend import RecommendChain
|
||||
from app.chain.site import SiteChain
|
||||
from app.chain.subscribe import SubscribeChain
|
||||
from app.chain.tmdb import TmdbChain
|
||||
@@ -121,6 +122,11 @@ class Scheduler(metaclass=Singleton):
|
||||
"name": "站点数据刷新",
|
||||
"func": SiteChain().refresh_userdatas,
|
||||
"running": False,
|
||||
},
|
||||
"recommend_refresh": {
|
||||
"name": "推荐缓存",
|
||||
"func": RecommendChain().refresh_recommend,
|
||||
"running": False,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,6 +316,19 @@ class Scheduler(metaclass=Singleton):
|
||||
}
|
||||
)
|
||||
|
||||
# 推荐缓存
|
||||
self._scheduler.add_job(
|
||||
self.start,
|
||||
"interval",
|
||||
id="recommend_refresh",
|
||||
name="推荐缓存",
|
||||
hours=6,
|
||||
next_run_time=datetime.now(pytz.timezone(settings.TZ)) + timedelta(seconds=3),
|
||||
kwargs={
|
||||
'job_id': 'recommend_refresh'
|
||||
}
|
||||
)
|
||||
|
||||
self.init_plugin_jobs()
|
||||
|
||||
# 打印服务
|
||||
|
||||
Reference in New Issue
Block a user