some fixes

This commit is contained in:
Andrea Spacca 2022-08-15 13:00:26 +09:00
parent cd6a86dfb9
commit 42affd5a52
2 changed files with 13 additions and 16 deletions

View File

@ -556,13 +556,15 @@ Commands:
Tautulli instance and API Key:
The module work with an existing installed instance of Tautulli accessible on the machine at the path defined by env variable `TAUTULLI_PATH`
The module work with an instance of Tautulli accessible on URL defined by env variable `TAUTULLI_URL`
In order to load art pictures you need to define an instance of Plex Media Server with its token as well by the two env variables `PLEX_MEDIA_SERVER_URL` and `PLEX_MEDIA_SERVER_TOKEN`
You have to provide an api key by using the relevant command.
Environ variables seen by command:
* TAUTULLI_PATH: Path accessible from the machine to the installed instance of Tautulli
* TAUTULLI_URL: Url accessible from the machine to the installed instance of Tautulli
* PLEX_MEDIA_SERVER_URL: Url accessible from the machine to an instance of Plex Media Server
* PLEX_MEDIA_SERVER_TOKEN: Plex Token for the instance of Plex Media Server
* TAUTULLI_URL: Url accessible from the machine to an instance of Tautulli
* TAUTULLI_NOTIFIER_ADDR: Listening address for the Tautulli webhook handler target
* TAUTULLI_NOTIFIER_PORT: Listening port for the Tautulli webhook handler target
* BOT_OWNERS: Owner of the rooms in the list for the notification webhook

View File

@ -112,16 +112,6 @@ msg_template_plain = """*{title} -({year})- Rating: {audience_rating}*
"""
def _get_loop():
try:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
except RuntimeError:
loop = asyncio.get_event_loop()
finally:
return loop
class WebServer:
def __init__(self, host, port):
self.host = host
@ -129,11 +119,15 @@ class WebServer:
self.app = web.Application()
self.app.router.add_post('/notify', self.notify)
def run(self):
async def run(self):
if not self.host or not self.port:
return
aiohttp.web.run_app(self.app, host=self.host, port=self.port, handle_signals=True, loop=asyncio.get_running_loop())
loop = asyncio.get_event_loop()
runner = web.AppRunner(self.app)
loop.run_until_complete(runner.setup())
site = web.TCPSite(runner, host=self.host, port=self.port)
loop.run_until_complete(site.start())
async def notify(self, request: web.Request) -> web.Response:
try:
@ -171,7 +165,8 @@ class MatrixModule(BotModule):
super().matrix_start(bot)
global global_bot
global_bot = bot
self.httpd.run()
loop = asyncio.get_event_loop()
loop.run_until_complete(self.httpd.run())
def matrix_stop(self, bot):
super().matrix_stop(bot)