Skip to content

Commit 319350e

Browse files
committed
fix 7z progrss
Signed-off-by: anasty17 <e.anastayyar@gmail.com>
1 parent c74d634 commit 319350e

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

bot/helper/ext_utils/files_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from aioshutil import rmtree as aiormtree, move
2-
from asyncio import create_subprocess_exec, sleep, wait_for
2+
from asyncio import create_subprocess_exec, wait_for
33
from asyncio.subprocess import PIPE
44
from magic import Magic
55
from os import walk, path as ospath, readlink
@@ -308,7 +308,9 @@ def progress(self):
308308
return self._percentage
309309

310310
async def _sevenz_progress(self):
311-
pattern = r"(\d+)\s+bytes|Total Physical Size\s*=\s*(\d+)"
311+
pattern = (
312+
r"(\d+)\s+bytes|Total Physical Size\s*=\s*(\d+)|Physical Size\s*=\s*(\d+)"
313+
)
312314
while not (
313315
self._listener.subproc.returncode is not None
314316
or self._listener.is_cancelled
@@ -321,7 +323,6 @@ async def _sevenz_progress(self):
321323
line = line.decode().strip()
322324
if match := re_search(pattern, line):
323325
self._listener.subsize = int(match[1] or match[2])
324-
await sleep(0.05)
325326
s = b""
326327
while not (
327328
self._listener.is_cancelled
@@ -345,7 +346,6 @@ async def _sevenz_progress(self):
345346
self._processed_bytes = 0
346347
self._percentage = "0%"
347348
s = b""
348-
await sleep(0.05)
349349

350350
self._processed_bytes = 0
351351
self._percentage = "0%"

bot/helper/ext_utils/media_utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
create_subprocess_exec,
55
gather,
66
wait_for,
7-
sleep,
87
)
98
from asyncio.subprocess import PIPE
109
from os import path as ospath
@@ -367,7 +366,6 @@ async def _ffmpeg_progress(self):
367366
except:
368367
self._progress_raw = 0
369368
self._eta_raw = 0
370-
await sleep(0.05)
371369

372370
async def ffmpeg_cmds(self, ffmpeg, f_path):
373371
self.clear()

bot/helper/mirror_leech_utils/rclone_utils/transfer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from aiofiles import open as aiopen
22
from aiofiles.os import path as aiopath, makedirs, listdir
3-
from asyncio import create_subprocess_exec, gather, sleep, wait_for
3+
from asyncio import create_subprocess_exec, gather, wait_for
44
from asyncio.subprocess import PIPE
55
from configparser import RawConfigParser
66
from json import loads
@@ -79,7 +79,6 @@ async def _progress(self):
7979
self._speed,
8080
self._eta,
8181
) = data[0]
82-
await sleep(0.05)
8382

8483
def _switch_service_account(self):
8584
if self._sa_index == self._sa_number - 1:

0 commit comments

Comments
 (0)