From f8d9429e7ee03554e8f8f9dc641c159b1746b868 Mon Sep 17 00:00:00 2001 From: Devesh Pal Date: Tue, 30 Aug 2022 20:20:06 +0530 Subject: [PATCH] Minor Fixes --- pyUltroid/fns/tools.py | 4 ++-- pyUltroid/startup/_database.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyUltroid/fns/tools.py b/pyUltroid/fns/tools.py index 60b4e176b3..6344cffa88 100644 --- a/pyUltroid/fns/tools.py +++ b/pyUltroid/fns/tools.py @@ -160,7 +160,7 @@ def is_url_ok(url: str): async def metadata(file): out, _ = await bash(f'mediainfo "{_unquote_text(file)}" --Output=JSON') if _ and _.endswith("NOT_FOUND"): - return _ + raise Exception(_) data = {} _info = json.loads(out)["media"]["track"] info = _info[0] @@ -516,7 +516,7 @@ def telegraph_client(): if TELEGRAPH: return TELEGRAPH[0] - from .. import udB + from .. import udB, ultroid_bot token = udB.get_key("_TELEGRAPH_TOKEN") TelegraphClient = Telegraph(token) diff --git a/pyUltroid/startup/_database.py b/pyUltroid/startup/_database.py index 23ac500f66..98a5be9d0b 100644 --- a/pyUltroid/startup/_database.py +++ b/pyUltroid/startup/_database.py @@ -23,6 +23,7 @@ except ImportError: LOGS.info("Installing 'redis' for database.") os.system("pip3 install -q redis hiredis") + from redis import Redis elif Var.MONGO_URI: try: from pymongo import MongoClient @@ -313,10 +314,9 @@ def __repr__(self): def UltroidDB(): _er = False + from .. import HOSTED_ON try: if Redis: - from .. import HOSTED_ON - return RedisDB( host=Var.REDIS_URI or Var.REDISHOST, password=Var.REDIS_PASSWORD or Var.REDISPASSWORD,