vranki / hemppa

Generic modular bot for Matrix (and via it irc, telegram, slack, etc..)
GNU General Public License v3.0
151 stars 37 forks source link

fix Bot running twice and refactor tautulli module #213

Closed aspacca closed 2 years ago

aspacca commented 2 years ago

I've pulled from master since a long while and start experiencing aiohttp in the tautulli module listing twice on the same port

After many changes to the tautulli module I've identified the follwoing:

https://github.com/vranki/hemppa/commit/bdc9713a146fce0339f40e8486c1b512657f27de#diff-15c4a2d5065f85d9cf3c0cefaa1e3269d5c43fe2aa965981ecf3c50d71c7230bR9

Importing UploadFailed from bot made the bot to be started twice you should be able to see the following then starting the bot:

2022-08-14 22:37:57,433 - INFO - hemppa - Loading module: apod..
Traceback (most recent call last):
  File "/opt/hemppa/bot.py", line 678, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 33, in run
    raise RuntimeError(
RuntimeError: asyncio.run() cannot be called from a running event loop
/opt/hemppa/bot.py:680: RuntimeWarning: coroutine 'main' was never awaited
  traceback.print_exc(file=sys.stderr)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

I've moved the exception definition in a separated module, please, feel free to suggest any other location you see more fitting

I've also kept some of the refactoring I did to the tautulli module while trying to solve the issue: most important I've ported the get_image from tautulli directly in the hemppa module, so no more need to reference a local tautulli codebase

art images are fetched directly from the plex media server, defined from the env variables