Skip to content

Commit

Permalink
Another minor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: anasty17 <[email protected]>
  • Loading branch information
anasty17 committed Jan 14, 2025
1 parent fdf4558 commit b34dd7a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bot/helper/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,11 +690,11 @@ async def proceed_ffmpeg(self, dl_path, gid):
else:
await rmtree(new_folder)
else:
var_cmd = cmd.copy()
for dirpath, _, files in await sync_to_async(
walk, dl_path, topdown=False
):
for file_ in files:
var_cmd = cmd.copy()
if self.is_cancelled:
return False
f_path = ospath.join(dirpath, file_)
Expand Down
6 changes: 3 additions & 3 deletions bot/helper/ext_utils/media_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PIL import Image
from aiofiles.os import remove, path as aiopath, makedirs
from asyncio import create_subprocess_exec, gather, wait_for, sleep
from asyncio import create_subprocess_exec, create_subprocess_shell, gather, wait_for, sleep
from asyncio.subprocess import PIPE
from os import path as ospath, cpu_count
from re import search as re_search, escape
Expand Down Expand Up @@ -420,8 +420,8 @@ async def ffmpeg_cmds(self, ffmpeg, f_path):
ffmpeg[index] = output
if self._listener.is_cancelled:
return False
self._listener.subproc = await create_subprocess_exec(
*ffmpeg, stdout=PIPE, stderr=PIPE
self._listener.subproc = await create_subprocess_shell(
(" ").join(ffmpeg), stdout=PIPE, stderr=PIPE
)
await self._ffmpeg_progress()
_, stderr = await self._listener.subproc.communicate()
Expand Down
14 changes: 8 additions & 6 deletions bot/helper/mirror_leech_utils/rclone_utils/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ async def upload(self, path):
path,
self._listener.extension_filter,
)
rc_path += f"/{self._listener.name}"
rc_path += f"/{self._listener.name}" if rc_path else self._listener.name
else:
if path.lower().endswith(tuple(self._listener.extension_filter)):
await self._listener.on_upload_error(
Expand Down Expand Up @@ -345,8 +345,10 @@ async def upload(self, path):

if mime_type == "Folder":
destination = f"{oremote}:{rc_path}"
else:
elif rc_path:
destination = f"{oremote}:{rc_path}/{self._listener.name}"
else:
destination = f"{oremote}:{self._listener.name}"

if remote_type == "drive":
link = await self._get_gdrive_link(oconfig_path, destination, mime_type)
Expand Down Expand Up @@ -417,11 +419,11 @@ async def clone(self, config_path, src_remote, src_path, mime_type, method):
return None, None
elif return_code == 0:
if mime_type != "Folder":
destination += f"/{self._listener.name}"
if dst_remote_type == "drive":
link = await self._get_gdrive_link(
config_path, f"{dst_remote}:{dst_path}", mime_type
destination += (
f"/{self._listener.name}" if dst_path else self._listener.name
)
if dst_remote_type == "drive":
link = await self._get_gdrive_link(config_path, destination, mime_type)
return (
(None, None) if self._listener.is_cancelled else (link, destination)
)
Expand Down
4 changes: 3 additions & 1 deletion bot/modules/clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ async def _proceed_to_clone(self, sync):
if rstat["IsDir"]:
if not self.name:
self.name = src_path.rsplit("/", 1)[-1] if src_path else remote
self.up_dest += f"/{self.name}"
self.up_dest += (
self.name if self.up_dest.endswith(":") else f"/{self.name}"
)
mime_type = "Folder"
else:
if not self.name:
Expand Down

0 comments on commit b34dd7a

Please sign in to comment.