Skip to content

Commit

Permalink
Some minor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: anasty17 <[email protected]>
  • Loading branch information
anasty17 committed Jun 5, 2024
1 parent bf2d8e3 commit 2c16035
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
1 change: 0 additions & 1 deletion bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from time import time
from tzlocal import get_localzone
from uvloop import install
from asyncio import run as aiorun

# from faulthandler import enable as faulthandler_enable
# faulthandler_enable()
Expand Down
2 changes: 1 addition & 1 deletion bot/helper/ext_utils/db_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def db_load(self):
return
# Save bot settings
try:
res = await self._db.settings.config.replace_one(
await self._db.settings.config.replace_one(
{"_id": bot_id}, config_dict, upsert=True
)
except Exception as e:
Expand Down
5 changes: 2 additions & 3 deletions bot/helper/ext_utils/media_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,8 @@ async def get_document_type(path):
path,
]
)
if res := result[1]:
if mime_type.startswith("video"):
is_video = True
if result[1] and mime_type.startswith("video"):
is_video = True
except Exception as e:
LOGGER.error(f"Get Document Type: {e}. Mostly File not found! - File: {path}")
if mime_type.startswith("video"):
Expand Down
6 changes: 3 additions & 3 deletions bot/helper/listeners/aria2_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def _onDownloadStarted(api, gid):
if download.is_removed or download.followed_by_ids:
await deleteMessage(meta)
break
download = download.live
download = await sync_to_async(download.live)
return
else:
LOGGER.info(f"onDownloadStarted: {download.name} - Gid: {gid}")
Expand All @@ -46,7 +46,7 @@ async def _onDownloadStarted(api, gid):
if task := await getTaskByGid(gid):
download = await sync_to_async(api.get_download, gid)
await sleep(2)
download = download.live
download = await sync_to_async(download.live)
task.listener.name = download.name
msg, button = await stop_duplicate_check(task.listener)
if msg:
Expand Down Expand Up @@ -127,7 +127,7 @@ async def _onBtDownloadComplete(api, gid):
await task.listener.onDownloadComplete()
if Intervals["stopAll"]:
return
download = download.live
download = await sync_to_async(download.live)
if task.listener.seed:
if download.is_complete:
if task := await getTaskByGid(gid):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1445,13 +1445,13 @@ def filelions_and_streamwish(url):
if quality == version["name"]:
return version["url"]
elif version["name"] == "l":
error += f"\nLow"
error += "\nLow"
elif version["name"] == "n":
error += f"\nNormal"
error += "\nNormal"
elif version["name"] == "o":
error += f"\nOriginal"
error += "\nOriginal"
elif version["name"] == "h":
error += f"\nHD"
error += "\nHD"
error += f" <code>{url}_{version['name']}</code>"
raise DirectDownloadLinkException(f"ERROR: {error}")

Expand Down
5 changes: 3 additions & 2 deletions bot/helper/mirror_leech_utils/rclone_utils/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,9 @@ async def clone(self, config_path, src_remote, src_path, mime_type, method):
return None, None
elif return_code != 0:
error = (
await self._proc.stderr.read()
).decode().strip() or "Use <code>/shell cat rlog.txt</code> to see more information"
(await self._proc.stderr.read()).decode().strip()
or "Use <code>/shell cat rlog.txt</code> to see more information"
)
LOGGER.error(error)
await self._listener.onUploadError(error[:4000])
return None, None
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async def do(func, message):
func_return = (
await sync_to_async(rfunc) if func == "exec" else await rfunc()
)
except Exception as e:
except:
value = stdout.getvalue()
return f"{value}{format_exc()}"
else:
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/ytdlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ async def newEvent(self):
return

if "mdisk.me" in self.link:
name, self.link = await _mdisk(self.link, name)
self.name, self.link = await _mdisk(self.link, self.name)

try:
await self.beforeStart()
Expand Down

0 comments on commit 2c16035

Please sign in to comment.