feat 新增已入库媒体是否跟随TMDB信息变化开关,关闭则延用媒体库名称
This commit is contained in:
@ -10,6 +10,7 @@ from apscheduler.triggers.cron import CronTrigger
|
||||
from app.core.config import settings
|
||||
from app.core.context import MediaInfo
|
||||
from app.core.metainfo import MetaInfo
|
||||
from app.db.transferhistory_oper import TransferHistoryOper
|
||||
from app.helper.nfo import NfoReader
|
||||
from app.log import logger
|
||||
from app.plugins import _PluginBase
|
||||
@ -41,6 +42,7 @@ class LibraryScraper(_PluginBase):
|
||||
user_level = 1
|
||||
|
||||
# 私有属性
|
||||
transferhis = None
|
||||
_scheduler = None
|
||||
_scraper = None
|
||||
# 限速开关
|
||||
@ -66,6 +68,7 @@ class LibraryScraper(_PluginBase):
|
||||
|
||||
# 启动定时任务 & 立即运行一次
|
||||
if self._enabled or self._onlyonce:
|
||||
self.transferhis = TransferHistoryOper(self.db)
|
||||
self._scheduler = BackgroundScheduler(timezone=settings.TZ)
|
||||
if self._cron:
|
||||
logger.info(f"媒体库刮削服务启动,周期:{self._cron}")
|
||||
@ -304,6 +307,11 @@ class LibraryScraper(_PluginBase):
|
||||
if not mediainfo:
|
||||
logger.warn(f"未识别到媒体信息:{file}")
|
||||
continue
|
||||
# 如果未开启新增已入库媒体是否跟随TMDB信息变化则根据tmdbid查询之前的title
|
||||
if not settings.SCRAP_FOLLOW_TMDB:
|
||||
transfer_historys = self.transferhis.get_by(tmdbid=str(mediainfo.tmdb_id))
|
||||
if not transfer_historys:
|
||||
mediainfo.title = transfer_historys[0].title
|
||||
# 开始刮削
|
||||
self.chain.scrape_metadata(path=file, mediainfo=mediainfo)
|
||||
|
||||
|
Reference in New Issue
Block a user