- Fix jdownloader device version issue after idle
- Fix sample video. Build is required, issue was in ffmpeg version. now it's v7
- Fix rss tage when name have space
- Fix aria2 seed

Signed-off-by: anasty17 <e.anastayyar@gmail.com>
This commit is contained in:
anasty17 2024-07-25 02:16:13 +03:00
parent 70a86274d9
commit e8b494f0e6
44 changed files with 228 additions and 118 deletions

View File

@ -1,8 +0,0 @@
name: Ruff
on: [ push, pull_request ]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1

View File

@ -73,7 +73,7 @@ try:
if bool(environ.get("_____REMOVE_THIS_LINE_____")):
log_error("The README.md file there to be read! Exiting now!")
exit(1)
except Exception:
except:
pass
task_dict_lock = Lock()
@ -192,7 +192,7 @@ if len(USER_SESSION_STRING) != 0:
max_concurrent_transmissions=10,
).start()
IS_PREMIUM_USER = user.me.is_premium
except Exception:
except:
log_error("Failed to start client from USER_SESSION_STRING")
IS_PREMIUM_USER = False
user = ""
@ -255,7 +255,7 @@ try:
USENET_SERVERS = []
else:
USENET_SERVERS = eval(USENET_SERVERS)
except Exception:
except:
log_error(f"Wrong USENET_SERVERS format: {USENET_SERVERS}")
USENET_SERVERS = []
@ -285,7 +285,7 @@ if len(SEARCH_PLUGINS) == 0:
else:
try:
SEARCH_PLUGINS = eval(SEARCH_PLUGINS)
except Exception:
except:
log_error(f"Wrong USENET_SERVERS format: {SEARCH_PLUGINS}")
SEARCH_PLUGINS = ""

View File

@ -39,7 +39,26 @@ from .helper.telegram_helper.bot_commands import BotCommands
from .helper.telegram_helper.button_build import ButtonMaker
from .helper.telegram_helper.filters import CustomFilters
from .helper.telegram_helper.message_utils import sendMessage, editMessage, sendFile
from .modules import authorize, cancel_task, clone, exec, file_selector, gd_count, gd_delete, gd_search, mirror_leech, status, torrent_search, ytdlp, rss, shell, users_settings, bot_settings, help, force_start # noqa: F401
from .modules import (
authorize,
cancel_task,
clone,
exec,
file_selector,
gd_count,
gd_delete,
gd_search,
mirror_leech,
status,
torrent_search,
ytdlp,
rss,
shell,
users_settings,
bot_settings,
help,
force_start,
) # noqa: F401
async def stats(_, message):
@ -226,7 +245,7 @@ async def restart_notification():
await bot.edit_message_text(
chat_id=chat_id, message_id=msg_id, text="Restarted Successfully!"
)
except Exception:
except:
pass
await remove(".restartmsg")

View File

@ -310,7 +310,7 @@ class TaskConfig:
await self.client.send_chat_action(
self.upDest, ChatAction.TYPING
)
except Exception:
except:
raise ValueError("Start the bot and try again!")
elif (self.userTransmission or self.mixedLeech) and not self.isSuperChat:
self.userTransmission = False
@ -345,13 +345,18 @@ class TaskConfig:
async def getTag(self, text: list):
if len(text) > 1 and text[1].startswith("Tag: "):
self.tag, id_ = text[1].split("Tag: ")[1].split()
user_info = text[1].split("Tag: ")
if len(user_info) >= 3:
id_ = user_info[-1]
self.tag = " ".join(user_info[:-1])
else:
self.tag, id_ = text[1].split("Tag: ")[1].split()
self.user = self.message.from_user = await self.client.get_users(id_)
self.userId = self.user.id
self.userDict = user_data.get(self.userId, {})
try:
await self.message.unpin()
except Exception:
except:
pass
if self.user:
if username := self.user.username:
@ -453,7 +458,7 @@ class TaskConfig:
self.multiTag,
self.options,
).newEvent()
except Exception:
except:
await sendMessage(
self.message,
"Reply to text file or to telegram message that have links seperated by new line!",
@ -510,7 +515,7 @@ class TaskConfig:
if code != 0:
try:
stderr = stderr.decode().strip()
except Exception:
except:
stderr = "Unable to decode the error!"
LOGGER.error(
f"{stderr}. Unable to extract archive splits!. Path: {f_path}"
@ -525,7 +530,7 @@ class TaskConfig:
del_path = ospath.join(dirpath, file_)
try:
await remove(del_path)
except Exception:
except:
self.isCancelled = True
return up_path
else:
@ -560,13 +565,13 @@ class TaskConfig:
if not self.seed:
try:
await remove(dl_path)
except Exception:
except:
self.isCancelled = True
return up_path
else:
try:
stderr = stderr.decode().strip()
except Exception:
except:
stderr = "Unable to decode the error!"
LOGGER.error(
f"{stderr}. Unable to extract archive! Uploading anyway. Path: {dl_path}"
@ -642,7 +647,7 @@ class TaskConfig:
if await aiopath.exists(f):
try:
await remove(f)
except Exception:
except:
pass
ft_delete.clear()
return up_path
@ -652,7 +657,7 @@ class TaskConfig:
self.newDir = ""
try:
stderr = stderr.decode().strip()
except Exception:
except:
stderr = "Unable to decode the error!"
LOGGER.error(f"{stderr}. Unable to zip this path: {dl_path}")
return dl_path
@ -684,13 +689,13 @@ class TaskConfig:
else:
try:
await remove(f_path)
except Exception:
except:
return
continue
elif not self.seed or self.newDir:
try:
await remove(f_path)
except Exception:
except:
return
else:
m_size.append(f_size)
@ -866,7 +871,7 @@ class TaskConfig:
else:
try:
await remove(dl_path)
except Exception:
except:
pass
return output_file
else:
@ -886,7 +891,7 @@ class TaskConfig:
else:
try:
await remove(f_path)
except Exception:
except:
pass
if checked:
cpu_eater_lock.release()
@ -932,7 +937,9 @@ class TaskConfig:
up_dir, name = dl_path.rsplit("/", 1)
for substitution in self.nameSub:
pattern = substitution[0]
res = substitution[1] if len(substitution) > 1 and substitution[1] else ""
res = (
substitution[1] if len(substitution) > 1 and substitution[1] else ""
)
sen = len(substitution) > 2 and substitution[2] == "s"
new_name = sub(rf"{pattern}", res, name, flags=I if sen else 0)
new_path = ospath.join(up_dir, new_name)
@ -944,7 +951,11 @@ class TaskConfig:
f_path = ospath.join(dirpath, file_)
for substitution in self.nameSub:
pattern = substitution[0]
res = substitution[1] if len(substitution) > 1 and substitution[1] else ""
res = (
substitution[1]
if len(substitution) > 1 and substitution[1]
else ""
)
sen = len(substitution) > 2 and substitution[2] == "s"
new_name = sub(rf"{pattern}", res, file_, flags=I if sen else 0)
await move(f_path, ospath.join(dirpath, new_name))

View File

@ -163,7 +163,7 @@ async def get_content_type(url):
async with AsyncClient() as client:
response = await client.get(url, allow_redirects=True, verify=False)
return response.headers.get("Content-Type")
except Exception:
except:
return None
@ -175,7 +175,7 @@ def update_user_ldata(id_, key, value):
async def retry_function(func, *args, **kwargs):
try:
return await func(*args, **kwargs)
except Exception:
except:
return await retry_function(func, *args, **kwargs)
@ -187,11 +187,11 @@ async def cmd_exec(cmd, shell=False):
stdout, stderr = await proc.communicate()
try:
stdout = stdout.decode().strip()
except Exception:
except:
stdout = "Unable to decode the response!"
try:
stderr = stderr.decode().strip()
except Exception:
except:
stderr = "Unable to decode the error!"
return stdout, stderr, proc.returncode

View File

@ -95,7 +95,7 @@ def clean_all():
try:
LOGGER.info("Cleaning Download Directory")
rmtree(DOWNLOAD_DIR, ignore_errors=True)
except Exception:
except:
pass
makedirs(DOWNLOAD_DIR, exist_ok=True)

View File

@ -124,7 +124,7 @@ class JDownloader(Myjdapi):
break
else:
continue
except Exception:
except:
continue
break
await self.device.enable_direct_connection()

View File

@ -57,7 +57,7 @@ async def convert_video(listener, video_file, ext, retry=False):
else:
try:
stderr = stderr.decode().strip()
except Exception:
except:
stderr = "Unable to decode the error!"
LOGGER.error(
f"{stderr}. Something went wrong while converting video, mostly file need specific codec. Path: {video_file}"
@ -91,7 +91,7 @@ async def convert_audio(listener, audio_file, ext):
else:
try:
stderr = stderr.decode().strip()
except Exception:
except:
stderr = "Unable to decode the error!"
LOGGER.error(
f"{stderr}. Something went wrong while converting audio, mostly file need specific codec. Path: {audio_file}"
@ -261,7 +261,7 @@ async def take_ss(video_file, ss_nb) -> bool:
)
await rmtree(dirpath, ignore_errors=True)
return False
except Exception:
except:
LOGGER.error(
f"Error while creating sreenshots from video. Path: {video_file}. Error: Timeout some issues with ffmpeg with specific arch!"
)
@ -330,7 +330,7 @@ async def create_thumbnail(video_file, duration):
f"Error while extracting thumbnail from video. Name: {video_file} stderr: {err}"
)
return None
except Exception:
except:
LOGGER.error(
f"Error while extracting thumbnail from video. Name: {video_file}. Error: Timeout some issues with ffmpeg with specific arch!"
)
@ -404,11 +404,11 @@ async def split_file(
elif code != 0:
try:
stderr = stderr.decode().strip()
except Exception:
except:
stderr = "Unable to decode the error!"
try:
await remove(out_path)
except Exception:
except:
pass
if multi_streams:
LOGGER.warning(
@ -488,14 +488,13 @@ async def split_file(
elif code != 0:
try:
stderr = stderr.decode().strip()
except Exception:
except:
stderr = "Unable to decode the error!"
LOGGER.error(f"{stderr}. Split Document: {path}")
return True
async def createSampleVideo(listener, video_file, sample_duration, part_duration):
filter_complex = ""
dir, name = video_file.rsplit("/", 1)
output_file = f"{dir}/SAMPLE.{name}"
segments = [(0, part_duration)]
@ -509,6 +508,7 @@ async def createSampleVideo(listener, video_file, sample_duration, part_duration
next_segment += time_interval
segments.append((duration - part_duration, duration))
filter_complex = ""
for i, (start, end) in enumerate(segments):
filter_complex += (
f"[0:v]trim=start={start}:end={end},setpts=PTS-STARTPTS[v{i}]; "
@ -564,3 +564,90 @@ async def createSampleVideo(listener, video_file, sample_duration, part_duration
if await aiopath.exists(output_file):
await remove(output_file)
return False
"""finished_segments = []
await makedirs(f"{dir}/mltb_segments/", exist_ok=True)
ext = name.rsplit(".", 1)[-1]
for index, (start_time, end_time) in enumerate(segments, start=1):
output_seg = f"{dir}/mltb_segments/segment{index}.{ext}"
cmd = [
"ffmpeg",
"-i",
video_file,
"-ss",
f"{start_time}",
"-to",
f"{end_time}",
"-c",
"copy",
output_seg,
]
if listener.isCancelled:
return False
listener.suproc = await create_subprocess_exec(*cmd, stderr=PIPE)
_, stderr = await listener.suproc.communicate()
if listener.isCancelled:
return False
code = listener.suproc.returncode
if code == -9:
listener.isCancelled = True
return False
elif code != 0:
try:
stderr = stderr.decode().strip()
except:
stderr = "Unable to decode the error!"
LOGGER.error(
f"{stderr}. Something went wrong while splitting file for sample video, mostly file is corrupted. Path: {video_file}"
)
if await aiopath.exists(output_file):
await remove(output_file)
return False
else:
finished_segments.append(f"file '{output_seg}'")
segments_file = f"{dir}/segments.txt"
async with aiopen(segments_file, "w+") as f:
await f.write("\n".join(finished_segments))
cmd = [
"ffmpeg",
"-f",
"concat",
"-safe",
"0",
"-i",
segments_file,
"-c:v",
"libx264",
"-c:a",
"aac",
"-threads",
f"{cpu_count() // 2}",
output_file,
]
if listener.isCancelled:
return False
listener.suproc = await create_subprocess_exec(*cmd, stderr=PIPE)
_, stderr = await listener.suproc.communicate()
if listener.isCancelled:
return False
code = listener.suproc.returncode
if code == -9:
listener.isCancelled = True
return False
elif code != 0:
try:
stderr = stderr.decode().strip()
except:
stderr = "Unable to decode the error!"
LOGGER.error(
f"{stderr}. Something went wrong while creating sample video, mostly file is corrupted. Path: {video_file}"
)
if await aiopath.exists(output_file):
await remove(output_file)
await gather(remove(segments_file), rmtree(f"{dir}/mltb_segments"))
return False
await gather(remove(segments_file), rmtree(f"{dir}/mltb_segments"))
return output_file"""

View File

@ -193,7 +193,7 @@ async def get_readable_message(sid, is_user, page_no=1, status="All", page_step=
if hasattr(task, "seeders_num"):
try:
msg += f"\n<b>Seeders:</b> {task.seeders_num()} | <b>Leechers:</b> {task.leechers_num()}"
except Exception:
except:
pass
elif tstatus == MirrorStatus.STATUS_SEEDING:
msg += f"\n<b>Size: </b>{task.size()}"

View File

@ -38,7 +38,7 @@ async def stop_duplicate_check(listener):
elif listener.extract:
try:
name = get_base_name(name)
except Exception:
except:
name = None
if name is not None:

View File

@ -37,7 +37,7 @@ async def _onDownloadStarted(api, gid):
if download.is_removed or download.followed_by_ids:
await deleteMessage(meta)
break
download = await sync_to_async(download.live)
await sync_to_async(download.update)
return
else:
LOGGER.info(f"onDownloadStarted: {download.name} - Gid: {gid}")
@ -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 = await sync_to_async(download.live)
await sync_to_async(download.update)
task.listener.name = download.name
msg, button = await stop_duplicate_check(task.listener)
if msg:
@ -59,7 +59,7 @@ async def _onDownloadStarted(api, gid):
async def _onDownloadComplete(api, gid):
try:
download = await sync_to_async(api.get_download, gid)
except Exception:
except:
return
if download.options.follow_torrent == "false":
return
@ -107,7 +107,7 @@ async def _onBtDownloadComplete(api, gid):
if not file_o.selected and await aiopath.exists(f_path):
try:
await remove(f_path)
except Exception:
except:
pass
await clean_unwanted(download.dir)
if task.listener.seed:
@ -127,10 +127,10 @@ async def _onBtDownloadComplete(api, gid):
await task.listener.onDownloadComplete()
if Intervals["stopAll"]:
return
download = await sync_to_async(download.live)
await sync_to_async(download.update)
if task.listener.seed:
if download.is_complete:
if task := await getTaskByGid(gid):
if await getTaskByGid(gid):
LOGGER.info(f"Cancelling Seed: {download.name}")
await task.listener.onUploadError(
f"Seeding stopped with Ratio: {task.ratio()} and Time: {task.seeding_time()}"
@ -170,7 +170,7 @@ async def _onDownloadError(api, gid):
return
error = download.error_message
LOGGER.info(f"Download Error: {error}")
except Exception:
except:
pass
if task := await getTaskByGid(gid):
await task.listener.onDownloadError(error)

View File

@ -17,7 +17,7 @@ async def update_download(gid, value):
task._gid = new_gid
async with jd_lock:
del jd_downloads[gid]
except Exception:
except:
pass
@ -71,7 +71,7 @@ async def _jd_listener():
await wait_for(
retry_function(jdownloader.device.jd.version), timeout=10
)
except Exception:
except:
is_connected = await jdownloader.jdconnect()
if not is_connected:
LOGGER.error(jdownloader.error)
@ -84,7 +84,7 @@ async def _jd_listener():
packages = await jdownloader.device.downloads.query_packages(
[{"finished": True}]
)
except Exception:
except:
continue
finished = [
pack["uuid"] for pack in packages if pack.get("finished", False)

View File

@ -83,7 +83,7 @@ async def _onDownloadComplete(tor):
if f.priority == 0 and await aiopath.exists(f"{path}/{f.name}"):
try:
await remove(f"{path}/{f.name}")
except Exception:
except:
pass
await task.listener.onDownloadComplete()
if Intervals["stopAll"]:

View File

@ -57,7 +57,7 @@ class TaskListener(TaskConfig):
intvl.cancel()
Intervals["status"].clear()
await gather(sync_to_async(aria2.purge), delete_status())
except Exception:
except:
pass
def removeFromSameDir(self):

View File

@ -242,7 +242,9 @@ def mediafire(url, session=None):
if html.xpath("//div[@class='passwordPrompt']"):
if not _password:
session.close()
raise DirectDownloadLinkException(f"ERROR: {PASSWORD_ERROR_MESSAGE}".format(url))
raise DirectDownloadLinkException(
f"ERROR: {PASSWORD_ERROR_MESSAGE}".format(url)
)
try:
html = HTML(session.post(url, data={"downloadp": _password}).text)
except Exception as e:
@ -396,7 +398,9 @@ def streamtape(url):
html = HTML(session.get(url).text)
except Exception as e:
raise DirectDownloadLinkException(f"ERROR: {e.__class__.__name__}") from e
script = html.xpath("//script[contains(text(),'ideoooolink')]/text()") or html.xpath("//script[contains(text(),'ideoolink')]/text()")
script = html.xpath(
"//script[contains(text(),'ideoooolink')]/text()"
) or html.xpath("//script[contains(text(),'ideoolink')]/text()")
if not script:
raise DirectDownloadLinkException("ERROR: requeries script not found")
if not (link := findall(r"(&expires\S+)'", script[0])):
@ -833,7 +837,7 @@ def linkBox(url: str):
parsed_url = urlparse(url)
try:
shareToken = parsed_url.path.split("/")[-1]
except Exception:
except:
raise DirectDownloadLinkException("ERROR: invalid URL")
details = {"contents": [], "title": "", "total_size": 0}
@ -893,7 +897,7 @@ def linkBox(url: str):
try:
if data["shareType"] == "singleItem":
return __singleItem(session, data["itemId"])
except Exception:
except:
pass
if not details["title"]:
details["title"] = data["dirName"]
@ -1045,7 +1049,7 @@ def mediafireFolder(url):
raw = url.split("/", 4)[-1]
folderkey = raw.split("/", 1)[0]
folderkey = folderkey.split(",")
except Exception:
except:
raise DirectDownloadLinkException("ERROR: Could not parse ")
if len(folderkey) == 1:
folderkey = folderkey[0]
@ -1100,7 +1104,7 @@ def mediafireFolder(url):
def __scraper(url):
try:
html = HTML(session.get(url).text)
except Exception:
except:
return
if final_link := html.xpath("//a[@id='downloadButton']/@href"):
return final_link[0]
@ -1258,7 +1262,7 @@ def send_cm(url):
)
if "Location" in _res.headers:
return _res.headers["Location"]
except Exception:
except:
pass
def __getFiles(html):
@ -1630,7 +1634,7 @@ def mp4upload(url):
data["referer"] = url
direct_link = session.post(url, data=data).url
return direct_link, header
except Exception:
except:
raise DirectDownloadLinkException("ERROR: File Not Found!")

View File

@ -67,7 +67,7 @@ class JDownloaderHelper:
)
try:
await wait_for(self.event.wait(), timeout=self._timeout)
except Exception:
except:
await editMessage(self._reply_to, "Timed Out. Task has been cancelled!")
self.listener.isCancelled = True
self.event.set()
@ -97,7 +97,7 @@ async def add_jd_download(listener, path):
try:
await wait_for(retry_function(jdownloader.device.jd.version), timeout=10)
except Exception:
except:
is_connected = await jdownloader.jdconnect()
if not is_connected:
await listener.onDownloadError(jdownloader.error)

View File

@ -110,7 +110,7 @@ async def add_qb_torrent(listener, path, ratio, seed_time):
]:
await deleteMessage(meta)
break
except Exception:
except:
await deleteMessage(meta)
return

View File

@ -64,7 +64,7 @@ class TelegramDownloadHelper:
async with global_lock:
try:
GLOBAL_GID.remove(self._id)
except Exception:
except:
pass
await self._listener.onDownloadError(error)

View File

@ -115,7 +115,7 @@ class YoutubeDLHelper:
self._eta = d.get("eta", "-") or "-"
try:
self._progress = (self._downloaded_bytes / self._listener.size) * 100
except Exception:
except:
pass
async def _onDownloadStart(self, from_queue=False):

View File

@ -52,7 +52,7 @@ class GoogleDriveHelper:
def speed(self):
try:
return self.proc_bytes / self.total_time
except Exception:
except:
return 0
@property

View File

@ -145,7 +145,7 @@ class gdriveList(GoogleDriveHelper):
)
try:
await wait_for(self.event.wait(), timeout=self._timeout)
except Exception:
except:
self.id = "Timed Out. Task has been cancelled!"
self.listener.isCancelled = True
self.event.set()

View File

@ -223,7 +223,7 @@ class gdUpload(GoogleDriveHelper):
if not self.listener.seed or self.listener.newDir or file_path in ft_delete:
try:
remove(file_path)
except Exception:
except:
pass
self.file_processed_bytes = 0
# Insert new permissions

View File

@ -140,7 +140,7 @@ class RcloneList:
)
try:
await wait_for(self.event.wait(), timeout=self._timeout)
except Exception:
except:
self.path = ""
self.remote = "Timed Out. Task has been cancelled!"
self.listener.isCancelled = True

View File

@ -14,7 +14,7 @@ async def rclone_serve_booter():
try:
RcloneServe[0].kill()
RcloneServe.clear()
except Exception:
except:
pass
return
config = ConfigParser()
@ -32,7 +32,7 @@ async def rclone_serve_booter():
try:
RcloneServe[0].kill()
RcloneServe.clear()
except Exception:
except:
pass
cmd = [
"rclone",

View File

@ -59,7 +59,7 @@ class RcloneTransferHelper:
while not (self._proc is None or self._listener.isCancelled):
try:
data = (await self._proc.stdout.readline()).decode()
except Exception:
except:
continue
if not data:
break
@ -401,9 +401,8 @@ class RcloneTransferHelper:
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
@ -492,7 +491,7 @@ class RcloneTransferHelper:
if self._proc is not None:
try:
self._proc.kill()
except Exception:
except:
pass
if self._is_download:
LOGGER.info(f"Cancelling Download: {self._listener.name}")

View File

@ -17,7 +17,7 @@ class DirectStatus:
def progress_raw(self):
try:
return self._obj.processed_bytes / self.listener.size * 100
except Exception:
except:
return 0
def progress(self):
@ -36,7 +36,7 @@ class DirectStatus:
try:
seconds = (self.listener.size - self._obj.processed_bytes) / self._obj.speed
return get_readable_time(seconds)
except Exception:
except:
return "-"
def status(self):

View File

@ -27,7 +27,7 @@ class ExtractStatus:
await self.processed_raw()
try:
return self._proccessed_bytes / self._size * 100
except Exception:
except:
return 0
async def progress(self):
@ -46,7 +46,7 @@ class ExtractStatus:
try:
seconds = (self._size - self._proccessed_bytes) / self.speed_raw()
return get_readable_time(seconds)
except Exception:
except:
return "-"
def status(self):

View File

@ -36,7 +36,7 @@ class GdriveStatus:
def progress_raw(self):
try:
return self._obj.processed_bytes / self._size * 100
except Exception:
except:
return 0
def progress(self):
@ -49,7 +49,7 @@ class GdriveStatus:
try:
seconds = (self._size - self._obj.processed_bytes) / self._obj.speed
return get_readable_time(seconds)
except Exception:
except:
return "-"
def task(self):

View File

@ -26,7 +26,7 @@ def _get_combined_info(result):
status = "UnknownError"
try:
eta = (bytesTotal - bytesLoaded) / speed
except Exception:
except:
eta = 0
return {
"name": name,
@ -56,7 +56,7 @@ async def get_download(gid, old_info):
]
)
return _get_combined_info(result) if len(result) > 1 else result[0]
except Exception:
except:
return old_info
@ -72,7 +72,7 @@ class JDownloaderStatus:
def progress(self):
try:
return f"{round((self._info.get('bytesLoaded', 0) / self._info.get('bytesTotal', 0)) * 100, 2)}%"
except Exception:
except:
return "0%"
def processed_bytes(self):

View File

@ -47,7 +47,7 @@ class SabnzbdStatus:
def speed_raw(self):
try:
return int(float(self._info["mb"]) * 1048576) / self.eta_raw()
except Exception:
except:
return 0
def speed(self):

View File

@ -30,7 +30,7 @@ class TelegramStatus:
def progress(self):
try:
progress_raw = self._obj.processed_bytes / self._size * 100
except Exception:
except:
progress_raw = 0
return f"{round(progress_raw, 2)}%"
@ -41,7 +41,7 @@ class TelegramStatus:
try:
seconds = (self._size - self._obj.processed_bytes) / self._obj.speed
return get_readable_time(seconds)
except Exception:
except:
return "-"
def gid(self):

View File

@ -49,7 +49,7 @@ class YtDlpDownloadStatus:
self._obj.size - self._proccessed_bytes
) / self._obj.download_speed
return get_readable_time(seconds)
except Exception:
except:
return "-"
def task(self):

View File

@ -27,7 +27,7 @@ class ZipStatus:
await self.processed_raw()
try:
return self._proccessed_bytes / self._size * 100
except Exception:
except:
return 0
async def progress(self):
@ -46,7 +46,7 @@ class ZipStatus:
try:
seconds = (self._size - self._proccessed_bytes) / self.speed_raw()
return get_readable_time(seconds)
except Exception:
except:
return "-"
def status(self):

View File

@ -497,7 +497,7 @@ class TgUploader:
def speed(self):
try:
return self._processed_bytes / (time() - self._start_time)
except Exception:
except:
return 0
@property

View File

@ -412,7 +412,7 @@ async def edit_nzb_server(_, message, pre_message, key, index=0):
if key == "newser":
try:
value = eval(value)
except Exception:
except:
await sendMessage(message, "Invalid dict format!")
await update_buttons(pre_message, "nzbserver")
return
@ -446,7 +446,7 @@ async def sync_jdownloader():
return
try:
await wait_for(retry_function(jdownloader.update_devices), timeout=10)
except Exception:
except:
is_connected = await jdownloader.jdconnect()
if not is_connected:
LOGGER.error(jdownloader.error)
@ -999,7 +999,7 @@ async def load_config():
USENET_SERVERS = []
else:
USENET_SERVERS = eval(USENET_SERVERS)
except Exception:
except:
LOGGER.error(f"Wrong USENET_SERVERS format: {USENET_SERVERS}")
USENET_SERVERS = []
@ -1029,7 +1029,7 @@ async def load_config():
else:
try:
SEARCH_PLUGINS = eval(SEARCH_PLUGINS)
except Exception:
except:
LOGGER.error(f"Wrong SEARCH_PLUGINS fornat {SEARCH_PLUGINS}")
SEARCH_PLUGINS = ""

View File

@ -81,7 +81,7 @@ class Clone(TaskListener):
try:
self.multi = int(args["-i"])
except Exception:
except:
self.multi = 0
self.upDest = args["-up"]

View File

@ -88,7 +88,7 @@ async def do(func, message):
func_return = (
await sync_to_async(rfunc) if func == "exec" else await rfunc()
)
except Exception:
except:
value = stdout.getvalue()
return f"{value}{format_exc()}"
else:
@ -100,7 +100,7 @@ async def do(func, message):
else:
try:
result = f"{repr(await sync_to_async(eval, body, env))}"
except Exception:
except:
pass
else:
result = f"{value}{func_return}"

View File

@ -93,7 +93,7 @@ async def select(_, message):
f"{e} Error in pause, this mostly happens after abuse aria2"
)
task.listener.select = True
except Exception:
except:
await sendMessage(message, "This is not a bittorrent or sabnzbd task!")
return
@ -136,7 +136,7 @@ async def get_confirm(_, query):
if await aiopath.exists(f_path):
try:
await remove(f_path)
except Exception:
except:
pass
if not task.queued:
await sync_to_async(
@ -148,7 +148,7 @@ async def get_confirm(_, query):
if f["selected"] == "false" and await aiopath.exists(f["path"]):
try:
await remove(f["path"])
except Exception:
except:
pass
if not task.queued:
try:

View File

@ -148,7 +148,7 @@ class Mirror(TaskListener):
try:
self.multi = int(args["-i"])
except Exception:
except:
self.multi = 0
if not isinstance(self.seed, bool):

View File

@ -658,7 +658,7 @@ async def rssMonitor():
res = await client.get(data["link"])
html = res.text
break
except Exception:
except:
tries += 1
if tries > 3:
raise
@ -677,7 +677,7 @@ async def rssMonitor():
while True:
try:
await sleep(10)
except Exception:
except:
raise RssShutdownException("Rss Monitor Stopped!")
try:
item_title = rss_d.entries[feed_count]["title"]

View File

@ -162,7 +162,7 @@ async def _getResult(search_results, key, message, method):
msg += f"<b>Size: </b>{result['size']}<br>"
try:
msg += f"<b>Seeders: </b>{result['seeders']} | <b>Leechers: </b>{result['leechers']}<br>"
except Exception:
except:
pass
if "torrent" in result.keys():
msg += f"<a href='{result['torrent']}'>Direct Link</a><br><br>"
@ -171,7 +171,7 @@ async def _getResult(search_results, key, message, method):
msg += f"<a href='http://t.me/share/url?url={quote(result['magnet'])}'>Telegram</a><br><br>"
else:
msg += "<br>"
except Exception:
except:
continue
else:
msg += f"<a href='{result.descrLink}'>{escape(result.fileName)}</a><br>"

View File

@ -87,7 +87,7 @@ class YtSelection:
)
try:
await wait_for(self.event.wait(), timeout=self._timeout)
except Exception:
except:
await editMessage(self._reply_to, "Timed Out. Task has been cancelled!")
self.qual = None
self.listener.isCancelled = True
@ -318,7 +318,7 @@ class YtDlp(TaskListener):
try:
self.multi = int(args["-i"])
except Exception:
except:
self.multi = 0
self.select = args["-s"]

View File

@ -1,5 +1,3 @@
version: "3.9"
services:
app:
build: .

View File

@ -35,7 +35,7 @@ try:
if bool(environ.get("_____REMOVE_THIS_LINE_____")):
log_error("The README.md file there to be read! Exiting now!")
exit(1)
except Exception:
except:
pass
BOT_TOKEN = environ.get("BOT_TOKEN", "")