lock on tautulli send entry
This commit is contained in:
parent
6c30a47ce5
commit
cd0870d0b3
|
@ -34,14 +34,21 @@ def load_tautulli():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
plexpy = load_tautulli()
|
plexpy = load_tautulli()
|
||||||
|
send_entry_lock = asyncio.Lock()
|
||||||
|
|
||||||
async def send_entry(bot, room, entry):
|
async def send_entry(bot, room, entry):
|
||||||
|
global send_entry_lock
|
||||||
|
async with send_entry_lock:
|
||||||
if "art" in entry:
|
if "art" in entry:
|
||||||
global plexpy
|
global plexpy
|
||||||
if plexpy:
|
if plexpy:
|
||||||
pms = plexpy.pmsconnect.PmsConnect()
|
pms = plexpy.pmsconnect.PmsConnect()
|
||||||
(image0, image1) = pms.get_image(entry["art"], 600, 300)
|
pms_image = pms.get_image(entry["art"], 600, 300)
|
||||||
matrix_uri = await bot.upload_and_send_image(room, image0, "", True, image1)
|
if not pms_image:
|
||||||
|
return
|
||||||
|
|
||||||
|
(blob, content_type) = pms_image
|
||||||
|
matrix_uri = await bot.upload_and_send_image(room, blob, "", True, content_type)
|
||||||
|
|
||||||
if matrix_uri is not None:
|
if matrix_uri is not None:
|
||||||
await bot.send_image(room, matrix_uri, "")
|
await bot.send_image(room, matrix_uri, "")
|
||||||
|
|
Loading…
Reference in New Issue