mirror of
https://github.com/jxxghp/MoviePilot-Plugins.git
synced 2026-03-27 10:05:57 +00:00
feat 媒体库服务器刷新 增加延迟时间
This commit is contained in:
@@ -146,7 +146,7 @@
|
||||
"MediaServerRefresh": {
|
||||
"name": "媒体库服务器刷新",
|
||||
"description": "入库后自动刷新Emby/Jellyfin/Plex服务器海报墙。",
|
||||
"version": "1.0",
|
||||
"version": "1.1",
|
||||
"icon": "refresh2.png",
|
||||
"color": "#347180",
|
||||
"author": "jxxghp",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import time
|
||||
from typing import Any, List, Dict, Tuple
|
||||
|
||||
from app.core.config import settings
|
||||
@@ -9,6 +10,7 @@ from app.modules.plex import Plex
|
||||
from app.plugins import _PluginBase
|
||||
from app.schemas import TransferInfo, RefreshMediaItem
|
||||
from app.schemas.types import EventType
|
||||
from app.log import logger
|
||||
|
||||
|
||||
class MediaServerRefresh(_PluginBase):
|
||||
@@ -21,7 +23,7 @@ class MediaServerRefresh(_PluginBase):
|
||||
# 主题色
|
||||
plugin_color = "#347180"
|
||||
# 插件版本
|
||||
plugin_version = "1.0"
|
||||
plugin_version = "1.1"
|
||||
# 插件作者
|
||||
plugin_author = "jxxghp"
|
||||
# 作者主页
|
||||
@@ -35,10 +37,12 @@ class MediaServerRefresh(_PluginBase):
|
||||
|
||||
# 私有属性
|
||||
_enabled = False
|
||||
_delay = 0
|
||||
|
||||
def init_plugin(self, config: dict = None):
|
||||
if config:
|
||||
self._enabled = config.get("enabled")
|
||||
self._delay = config.get("delay") or 0
|
||||
|
||||
def get_state(self) -> bool:
|
||||
return self._enabled
|
||||
@@ -50,7 +54,8 @@ class MediaServerRefresh(_PluginBase):
|
||||
def get_api(self) -> List[Dict[str, Any]]:
|
||||
pass
|
||||
|
||||
def get_form(self) -> Tuple[List[dict], Dict[str, Any]]:
|
||||
@staticmethod
|
||||
def get_form() -> Tuple[List[dict], Dict[str, Any]]:
|
||||
"""
|
||||
拼装插件配置页面,需要返回两块数据:1、页面配置;2、数据结构
|
||||
"""
|
||||
@@ -78,11 +83,34 @@ class MediaServerRefresh(_PluginBase):
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'component': 'VRow',
|
||||
'content': [
|
||||
{
|
||||
'component': 'VCol',
|
||||
'props': {
|
||||
'cols': 12,
|
||||
'md': 6
|
||||
},
|
||||
'content': [
|
||||
{
|
||||
'component': 'VTextField',
|
||||
'props': {
|
||||
'model': 'delay',
|
||||
'label': '延迟时间(秒)',
|
||||
'placeholder': '0'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
], {
|
||||
"enabled": False
|
||||
"enabled": False,
|
||||
"delay": 0
|
||||
}
|
||||
|
||||
def get_page(self) -> List[dict]:
|
||||
@@ -104,6 +132,10 @@ class MediaServerRefresh(_PluginBase):
|
||||
if not settings.MEDIASERVER:
|
||||
return
|
||||
|
||||
if self._delay:
|
||||
logger.info(f"延迟 {self._delay} 秒后刷新媒体库... ")
|
||||
time.sleep(float(self._delay))
|
||||
|
||||
# 入库数据
|
||||
transferinfo: TransferInfo = event_info.get("transferinfo")
|
||||
mediainfo: MediaInfo = event_info.get("mediainfo")
|
||||
|
||||
Reference in New Issue
Block a user