This commit is contained in:
jxxghp
2023-09-28 16:23:10 +08:00
parent e6af2c0f34
commit 02111a3b9f
10 changed files with 42 additions and 6 deletions

View File

@@ -29,7 +29,7 @@ class PlexModule(_ModuleBase):
"""
# 定时重连
if not self.plex.is_inactive():
self.plex = Plex()
self.plex.reconnect()
def webhook_parser(self, body: Any, form: Any, args: Any) -> Optional[WebhookEventInfo]:
"""

View File

@@ -38,6 +38,17 @@ class Plex(metaclass=Singleton):
return False
return True if not self._plex else False
def reconnect(self):
"""
重连
"""
try:
self._plex = PlexServer(self._host, self._token)
self._libraries = self._plex.library.sections()
except Exception as e:
self._plex = None
logger.error(f"Plex服务器连接失败{str(e)}")
def get_librarys(self):
"""
获取媒体服务器所有媒体库列表