mirror of
https://github.com/anasty17/mirror-leech-telegram-bot.git
synced 2025-01-05 10:36:52 +08:00
added missing buttons = Button maker()
in list.py
and added ruff checkout.
This commit is contained in:
parent
d18c00a394
commit
66483eaf96
8
.github/workflows/ruff.yml
vendored
Normal file
8
.github/workflows/ruff.yml
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
name: Ruff
|
||||
on: [ push, pull_request ]
|
||||
jobs:
|
||||
ruff:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: chartboost/ruff-action@v1
|
0
aria-nox-nzb.sh
Executable file → Normal file
0
aria-nox-nzb.sh
Executable file → Normal 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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
log_error(f"Wrong USENET_SERVERS format: {SEARCH_PLUGINS}")
|
||||
SEARCH_PLUGINS = ""
|
||||
|
||||
|
@ -39,26 +39,7 @@ 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,
|
||||
)
|
||||
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):
|
||||
@ -245,7 +226,7 @@ async def restart_notification():
|
||||
await bot.edit_message_text(
|
||||
chat_id=chat_id, message_id=msg_id, text="Restarted Successfully!"
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
await remove(".restartmsg")
|
||||
|
||||
|
@ -310,7 +310,7 @@ class TaskConfig:
|
||||
await self.client.send_chat_action(
|
||||
self.upDest, ChatAction.TYPING
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
raise ValueError("Start the bot and try again!")
|
||||
elif (self.userTransmission or self.mixedLeech) and not self.isSuperChat:
|
||||
self.userTransmission = False
|
||||
@ -351,7 +351,7 @@ class TaskConfig:
|
||||
self.userDict = user_data.get(self.userId, {})
|
||||
try:
|
||||
await self.message.unpin()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if self.user:
|
||||
if username := self.user.username:
|
||||
@ -453,7 +453,7 @@ class TaskConfig:
|
||||
self.multiTag,
|
||||
self.options,
|
||||
).newEvent()
|
||||
except:
|
||||
except Exception:
|
||||
await sendMessage(
|
||||
self.message,
|
||||
"Reply to text file or to telegram message that have links seperated by new line!",
|
||||
@ -510,7 +510,7 @@ class TaskConfig:
|
||||
if code != 0:
|
||||
try:
|
||||
stderr = stderr.decode().strip()
|
||||
except:
|
||||
except Exception:
|
||||
stderr = "Unable to decode the error!"
|
||||
LOGGER.error(
|
||||
f"{stderr}. Unable to extract archive splits!. Path: {f_path}"
|
||||
@ -525,7 +525,7 @@ class TaskConfig:
|
||||
del_path = ospath.join(dirpath, file_)
|
||||
try:
|
||||
await remove(del_path)
|
||||
except:
|
||||
except Exception:
|
||||
self.isCancelled = True
|
||||
return up_path
|
||||
else:
|
||||
@ -560,13 +560,13 @@ class TaskConfig:
|
||||
if not self.seed:
|
||||
try:
|
||||
await remove(dl_path)
|
||||
except:
|
||||
except Exception:
|
||||
self.isCancelled = True
|
||||
return up_path
|
||||
else:
|
||||
try:
|
||||
stderr = stderr.decode().strip()
|
||||
except:
|
||||
except Exception:
|
||||
stderr = "Unable to decode the error!"
|
||||
LOGGER.error(
|
||||
f"{stderr}. Unable to extract archive! Uploading anyway. Path: {dl_path}"
|
||||
@ -642,7 +642,7 @@ class TaskConfig:
|
||||
if await aiopath.exists(f):
|
||||
try:
|
||||
await remove(f)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
ft_delete.clear()
|
||||
return up_path
|
||||
@ -652,7 +652,7 @@ class TaskConfig:
|
||||
self.newDir = ""
|
||||
try:
|
||||
stderr = stderr.decode().strip()
|
||||
except:
|
||||
except Exception:
|
||||
stderr = "Unable to decode the error!"
|
||||
LOGGER.error(f"{stderr}. Unable to zip this path: {dl_path}")
|
||||
return dl_path
|
||||
@ -684,13 +684,13 @@ class TaskConfig:
|
||||
else:
|
||||
try:
|
||||
await remove(f_path)
|
||||
except:
|
||||
except Exception:
|
||||
return
|
||||
continue
|
||||
elif not self.seed or self.newDir:
|
||||
try:
|
||||
await remove(f_path)
|
||||
except:
|
||||
except Exception:
|
||||
return
|
||||
else:
|
||||
m_size.append(f_size)
|
||||
@ -866,7 +866,7 @@ class TaskConfig:
|
||||
else:
|
||||
try:
|
||||
await remove(dl_path)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return output_file
|
||||
else:
|
||||
@ -886,7 +886,7 @@ class TaskConfig:
|
||||
else:
|
||||
try:
|
||||
await remove(f_path)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if checked:
|
||||
cpu_eater_lock.release()
|
||||
@ -930,10 +930,10 @@ class TaskConfig:
|
||||
async def substitute(self, dl_path):
|
||||
if await aiopath.isfile(dl_path):
|
||||
up_dir, name = dl_path.rsplit("/", 1)
|
||||
for l in self.nameSub:
|
||||
pattern = l[0]
|
||||
res = l[1] if len(l) > 1 and l[1] else ""
|
||||
sen = len(l) > 2 and l[2] == "s"
|
||||
for substitution in self.nameSub:
|
||||
pattern = substitution[0]
|
||||
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)
|
||||
await move(dl_path, new_path)
|
||||
@ -942,10 +942,10 @@ class TaskConfig:
|
||||
for dirpath, _, files in await sync_to_async(walk, dl_path, topdown=False):
|
||||
for file_ in files:
|
||||
f_path = ospath.join(dirpath, file_)
|
||||
for l in self.nameSub:
|
||||
pattern = l[0]
|
||||
res = l[1] if len(l) > 1 and l[1] else ""
|
||||
sen = len(l) > 2 and l[2] == "s"
|
||||
for substitution in self.nameSub:
|
||||
pattern = substitution[0]
|
||||
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))
|
||||
return dl_path
|
||||
|
@ -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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
stdout = "Unable to decode the response!"
|
||||
try:
|
||||
stderr = stderr.decode().strip()
|
||||
except:
|
||||
except Exception:
|
||||
stderr = "Unable to decode the error!"
|
||||
return stdout, stderr, proc.returncode
|
||||
|
||||
|
@ -95,7 +95,7 @@ def clean_all():
|
||||
try:
|
||||
LOGGER.info("Cleaning Download Directory")
|
||||
rmtree(DOWNLOAD_DIR, ignore_errors=True)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
makedirs(DOWNLOAD_DIR, exist_ok=True)
|
||||
|
||||
|
@ -124,7 +124,7 @@ class JDownloader(Myjdapi):
|
||||
break
|
||||
else:
|
||||
continue
|
||||
except:
|
||||
except Exception:
|
||||
continue
|
||||
break
|
||||
await self.device.enable_direct_connection()
|
||||
|
@ -57,7 +57,7 @@ async def convert_video(listener, video_file, ext, retry=False):
|
||||
else:
|
||||
try:
|
||||
stderr = stderr.decode().strip()
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
stderr = "Unable to decode the error!"
|
||||
try:
|
||||
await remove(out_path)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if multi_streams:
|
||||
LOGGER.warning(
|
||||
@ -488,7 +488,7 @@ async def split_file(
|
||||
elif code != 0:
|
||||
try:
|
||||
stderr = stderr.decode().strip()
|
||||
except:
|
||||
except Exception:
|
||||
stderr = "Unable to decode the error!"
|
||||
LOGGER.error(f"{stderr}. Split Document: {path}")
|
||||
return True
|
||||
@ -556,7 +556,7 @@ async def createSampleVideo(listener, video_file, sample_duration, part_duration
|
||||
else:
|
||||
try:
|
||||
stderr = stderr.decode().strip()
|
||||
except:
|
||||
except Exception:
|
||||
stderr = "Unable to decode the error!"
|
||||
LOGGER.error(
|
||||
f"{stderr}. Something went wrong while creating sample video, mostly file is corrupted. Path: {video_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:
|
||||
except Exception:
|
||||
pass
|
||||
elif tstatus == MirrorStatus.STATUS_SEEDING:
|
||||
msg += f"\n<b>Size: </b>{task.size()}"
|
||||
|
@ -38,7 +38,7 @@ async def stop_duplicate_check(listener):
|
||||
elif listener.extract:
|
||||
try:
|
||||
name = get_base_name(name)
|
||||
except:
|
||||
except Exception:
|
||||
name = None
|
||||
|
||||
if name is not None:
|
||||
|
@ -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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
pass
|
||||
await clean_unwanted(download.dir)
|
||||
if task.listener.seed:
|
||||
@ -170,7 +170,7 @@ async def _onDownloadError(api, gid):
|
||||
return
|
||||
error = download.error_message
|
||||
LOGGER.info(f"Download Error: {error}")
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if task := await getTaskByGid(gid):
|
||||
await task.listener.onDownloadError(error)
|
||||
|
@ -17,7 +17,7 @@ async def update_download(gid, value):
|
||||
task._gid = new_gid
|
||||
async with jd_lock:
|
||||
del jd_downloads[gid]
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ async def _jd_listener():
|
||||
await wait_for(
|
||||
retry_function(jdownloader.device.jd.version), timeout=10
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
continue
|
||||
finished = [
|
||||
pack["uuid"] for pack in packages if pack.get("finished", False)
|
||||
|
@ -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:
|
||||
except Exception:
|
||||
pass
|
||||
await task.listener.onDownloadComplete()
|
||||
if Intervals["stopAll"]:
|
||||
|
@ -57,7 +57,7 @@ class TaskListener(TaskConfig):
|
||||
intvl.cancel()
|
||||
Intervals["status"].clear()
|
||||
await gather(sync_to_async(aria2.purge), delete_status())
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def removeFromSameDir(self):
|
||||
|
@ -816,7 +816,7 @@ def linkBox(url: str):
|
||||
parsed_url = urlparse(url)
|
||||
try:
|
||||
shareToken = parsed_url.path.split("/")[-1]
|
||||
except:
|
||||
except Exception:
|
||||
raise DirectDownloadLinkException("ERROR: invalid URL")
|
||||
|
||||
details = {"contents": [], "title": "", "total_size": 0}
|
||||
@ -876,7 +876,7 @@ def linkBox(url: str):
|
||||
try:
|
||||
if data["shareType"] == "singleItem":
|
||||
return __singleItem(session, data["itemId"])
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if not details["title"]:
|
||||
details["title"] = data["dirName"]
|
||||
@ -1028,7 +1028,7 @@ def mediafireFolder(url):
|
||||
raw = url.split("/", 4)[-1]
|
||||
folderkey = raw.split("/", 1)[0]
|
||||
folderkey = folderkey.split(",")
|
||||
except:
|
||||
except Exception:
|
||||
raise DirectDownloadLinkException("ERROR: Could not parse ")
|
||||
if len(folderkey) == 1:
|
||||
folderkey = folderkey[0]
|
||||
@ -1083,7 +1083,7 @@ def mediafireFolder(url):
|
||||
def __scraper(url):
|
||||
try:
|
||||
html = HTML(session.get(url).text)
|
||||
except:
|
||||
except Exception:
|
||||
return
|
||||
if final_link := html.xpath("//a[@id='downloadButton']/@href"):
|
||||
return final_link[0]
|
||||
@ -1241,7 +1241,7 @@ def send_cm(url):
|
||||
)
|
||||
if "Location" in _res.headers:
|
||||
return _res.headers["Location"]
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def __getFiles(html):
|
||||
@ -1613,7 +1613,7 @@ def mp4upload(url):
|
||||
data["referer"] = url
|
||||
direct_link = session.post(url, data=data).url
|
||||
return direct_link, header
|
||||
except:
|
||||
except Exception:
|
||||
raise DirectDownloadLinkException("ERROR: File Not Found!")
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ class JDownloaderHelper:
|
||||
)
|
||||
try:
|
||||
await wait_for(self.event.wait(), timeout=self._timeout)
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
is_connected = await jdownloader.jdconnect()
|
||||
if not is_connected:
|
||||
await listener.onDownloadError(jdownloader.error)
|
||||
|
@ -110,7 +110,7 @@ async def add_qb_torrent(listener, path, ratio, seed_time):
|
||||
]:
|
||||
await deleteMessage(meta)
|
||||
break
|
||||
except:
|
||||
except Exception:
|
||||
await deleteMessage(meta)
|
||||
return
|
||||
|
||||
|
@ -64,7 +64,7 @@ class TelegramDownloadHelper:
|
||||
async with global_lock:
|
||||
try:
|
||||
GLOBAL_GID.remove(self._id)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
await self._listener.onDownloadError(error)
|
||||
|
||||
|
@ -115,7 +115,7 @@ class YoutubeDLHelper:
|
||||
self._eta = d.get("eta", "-") or "-"
|
||||
try:
|
||||
self._progress = (self._downloaded_bytes / self._listener.size) * 100
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
async def _onDownloadStart(self, from_queue=False):
|
||||
|
@ -52,7 +52,7 @@ class GoogleDriveHelper:
|
||||
def speed(self):
|
||||
try:
|
||||
return self.proc_bytes / self.total_time
|
||||
except:
|
||||
except Exception:
|
||||
return 0
|
||||
|
||||
@property
|
||||
|
@ -145,7 +145,7 @@ class gdriveList(GoogleDriveHelper):
|
||||
)
|
||||
try:
|
||||
await wait_for(self.event.wait(), timeout=self._timeout)
|
||||
except:
|
||||
except Exception:
|
||||
self.id = "Timed Out. Task has been cancelled!"
|
||||
self.listener.isCancelled = True
|
||||
self.event.set()
|
||||
@ -263,6 +263,7 @@ class gdriveList(GoogleDriveHelper):
|
||||
await self.get_items()
|
||||
elif len(drives) == 0:
|
||||
msg = "Service accounts Doesn't have access to any drive!"
|
||||
buttons = ButtonMaker()
|
||||
if self._token_user and self._token_owner:
|
||||
buttons.ibutton("Back", "gdq back dr", position="footer")
|
||||
buttons.ibutton("Cancel", "gdq cancel", position="footer")
|
||||
|
@ -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:
|
||||
except Exception:
|
||||
pass
|
||||
self.file_processed_bytes = 0
|
||||
# Insert new permissions
|
||||
|
@ -140,7 +140,7 @@ class RcloneList:
|
||||
)
|
||||
try:
|
||||
await wait_for(self.event.wait(), timeout=self._timeout)
|
||||
except:
|
||||
except Exception:
|
||||
self.path = ""
|
||||
self.remote = "Timed Out. Task has been cancelled!"
|
||||
self.listener.isCancelled = True
|
||||
|
@ -14,7 +14,7 @@ async def rclone_serve_booter():
|
||||
try:
|
||||
RcloneServe[0].kill()
|
||||
RcloneServe.clear()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return
|
||||
config = ConfigParser()
|
||||
@ -32,7 +32,7 @@ async def rclone_serve_booter():
|
||||
try:
|
||||
RcloneServe[0].kill()
|
||||
RcloneServe.clear()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
cmd = [
|
||||
"rclone",
|
||||
|
@ -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:
|
||||
except Exception:
|
||||
continue
|
||||
if not data:
|
||||
break
|
||||
@ -492,7 +492,7 @@ class RcloneTransferHelper:
|
||||
if self._proc is not None:
|
||||
try:
|
||||
self._proc.kill()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if self._is_download:
|
||||
LOGGER.info(f"Cancelling Download: {self._listener.name}")
|
||||
|
@ -17,7 +17,7 @@ class DirectStatus:
|
||||
def progress_raw(self):
|
||||
try:
|
||||
return self._obj.processed_bytes / self.listener.size * 100
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
return "-"
|
||||
|
||||
def status(self):
|
||||
|
@ -27,7 +27,7 @@ class ExtractStatus:
|
||||
await self.processed_raw()
|
||||
try:
|
||||
return self._proccessed_bytes / self._size * 100
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
return "-"
|
||||
|
||||
def status(self):
|
||||
|
@ -36,7 +36,7 @@ class GdriveStatus:
|
||||
def progress_raw(self):
|
||||
try:
|
||||
return self._obj.processed_bytes / self._size * 100
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
return "-"
|
||||
|
||||
def task(self):
|
||||
|
@ -26,7 +26,7 @@ def _get_combined_info(result):
|
||||
status = "UnknownError"
|
||||
try:
|
||||
eta = (bytesTotal - bytesLoaded) / speed
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
return "0%"
|
||||
|
||||
def processed_bytes(self):
|
||||
|
@ -47,7 +47,7 @@ class SabnzbdStatus:
|
||||
def speed_raw(self):
|
||||
try:
|
||||
return int(float(self._info["mb"]) * 1048576) / self.eta_raw()
|
||||
except:
|
||||
except Exception:
|
||||
return 0
|
||||
|
||||
def speed(self):
|
||||
|
@ -30,7 +30,7 @@ class TelegramStatus:
|
||||
def progress(self):
|
||||
try:
|
||||
progress_raw = self._obj.processed_bytes / self._size * 100
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
return "-"
|
||||
|
||||
def gid(self):
|
||||
|
@ -49,7 +49,7 @@ class YtDlpDownloadStatus:
|
||||
self._obj.size - self._proccessed_bytes
|
||||
) / self._obj.download_speed
|
||||
return get_readable_time(seconds)
|
||||
except:
|
||||
except Exception:
|
||||
return "-"
|
||||
|
||||
def task(self):
|
||||
|
@ -27,7 +27,7 @@ class ZipStatus:
|
||||
await self.processed_raw()
|
||||
try:
|
||||
return self._proccessed_bytes / self._size * 100
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
return "-"
|
||||
|
||||
def status(self):
|
||||
|
@ -497,7 +497,7 @@ class TgUploader:
|
||||
def speed(self):
|
||||
try:
|
||||
return self._processed_bytes / (time() - self._start_time)
|
||||
except:
|
||||
except Exception:
|
||||
return 0
|
||||
|
||||
@property
|
||||
|
@ -412,7 +412,7 @@ async def edit_nzb_server(_, message, pre_message, key, index=0):
|
||||
if key == "newser":
|
||||
try:
|
||||
value = eval(value)
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
LOGGER.error(f"Wrong SEARCH_PLUGINS fornat {SEARCH_PLUGINS}")
|
||||
SEARCH_PLUGINS = ""
|
||||
|
||||
|
@ -8,7 +8,6 @@ from bot import LOGGER, task_dict, task_dict_lock, bot
|
||||
from bot.helper.ext_utils.bot_utils import (
|
||||
new_task,
|
||||
sync_to_async,
|
||||
new_task,
|
||||
cmd_exec,
|
||||
arg_parser,
|
||||
COMMAND_USAGE,
|
||||
@ -82,7 +81,7 @@ class Clone(TaskListener):
|
||||
|
||||
try:
|
||||
self.multi = int(args["-i"])
|
||||
except:
|
||||
except Exception:
|
||||
self.multi = 0
|
||||
|
||||
self.upDest = args["-up"]
|
||||
|
@ -88,7 +88,7 @@ async def do(func, message):
|
||||
func_return = (
|
||||
await sync_to_async(rfunc) if func == "exec" else await rfunc()
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
result = f"{value}{func_return}"
|
||||
|
@ -93,7 +93,7 @@ async def select(_, message):
|
||||
f"{e} Error in pause, this mostly happens after abuse aria2"
|
||||
)
|
||||
task.listener.select = True
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
pass
|
||||
if not task.queued:
|
||||
try:
|
||||
|
@ -148,7 +148,7 @@ class Mirror(TaskListener):
|
||||
|
||||
try:
|
||||
self.multi = int(args["-i"])
|
||||
except:
|
||||
except Exception:
|
||||
self.multi = 0
|
||||
|
||||
if not isinstance(self.seed, bool):
|
||||
|
@ -658,7 +658,7 @@ async def rssMonitor():
|
||||
res = await client.get(data["link"])
|
||||
html = res.text
|
||||
break
|
||||
except:
|
||||
except Exception:
|
||||
tries += 1
|
||||
if tries > 3:
|
||||
raise
|
||||
@ -677,7 +677,7 @@ async def rssMonitor():
|
||||
while True:
|
||||
try:
|
||||
await sleep(10)
|
||||
except:
|
||||
except Exception:
|
||||
raise RssShutdownException("Rss Monitor Stopped!")
|
||||
try:
|
||||
item_title = rss_d.entries[feed_count]["title"]
|
||||
|
@ -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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
continue
|
||||
else:
|
||||
msg += f"<a href='{result.descrLink}'>{escape(result.fileName)}</a><br>"
|
||||
|
@ -87,7 +87,7 @@ class YtSelection:
|
||||
)
|
||||
try:
|
||||
await wait_for(self.event.wait(), timeout=self._timeout)
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
self.multi = 0
|
||||
|
||||
self.select = args["-s"]
|
||||
|
@ -35,3 +35,39 @@ from .exception import (
|
||||
from .myjdapi import Myjdapi
|
||||
|
||||
__version__ = "1.1.7"
|
||||
|
||||
__all__ = [
|
||||
"MYJDException",
|
||||
"MYJDConnectionException",
|
||||
"MYJDDeviceNotFoundException",
|
||||
"MYJDDecodeException",
|
||||
"MYJDApiException",
|
||||
"MYJDApiCommandNotFoundException",
|
||||
"MYJDApiInterfaceNotFoundException",
|
||||
"MYJDAuthFailedException",
|
||||
"MYJDBadParametersException",
|
||||
"MYJDBadRequestException",
|
||||
"MYJDChallengeFailedException",
|
||||
"MYJDEmailForbiddenException",
|
||||
"MYJDEmailInvalidException",
|
||||
"MYJDErrorEmailNotConfirmedException",
|
||||
"MYJDFailedException",
|
||||
"MYJDFileNotFoundException",
|
||||
"MYJDInternalServerErrorException",
|
||||
"MYJDMaintenanceException",
|
||||
"MYJDMethodForbiddenException",
|
||||
"MYJDOfflineException",
|
||||
"MYJDOutdatedException",
|
||||
"MYJDOverloadException",
|
||||
"MYJDSessionException",
|
||||
"MYJDStorageAlreadyExistsException",
|
||||
"MYJDStorageInvalidKeyException",
|
||||
"MYJDStorageInvalidStorageIdException",
|
||||
"MYJDStorageKeyNotFoundException",
|
||||
"MYJDStorageLimitReachedException",
|
||||
"MYJDStorageNotFoundException",
|
||||
"MYJDTokenInvalidException",
|
||||
"MYJDTooManyRequestsException",
|
||||
"MYJDUnknownException",
|
||||
"Myjdapi",
|
||||
]
|
||||
|
@ -1 +1,5 @@
|
||||
from sabnzbdapi.requests import sabnzbdClient
|
||||
|
||||
__all__ = [
|
||||
"sabnzbdClient"
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user