Skip to content

Commit

Permalink
return original url if no shorteners
Browse files Browse the repository at this point in the history
  • Loading branch information
5hojib committed Jan 19, 2025
1 parent d466e26 commit 520130e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 79 deletions.
5 changes: 4 additions & 1 deletion bot/helper/aeon_utils/shorteners.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@


async def short(long_url):
if not shorteners_list:
return long_url

async with ClientSession() as session:
for _attempt in range(4):
shortener_info = choice(shorteners_list)
Expand All @@ -31,4 +34,4 @@ async def short(long_url):
except Exception:
await sleep(1)

return long_url
return long_url
3 changes: 0 additions & 3 deletions bot/helper/ext_utils/status_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,6 @@ async def get_readable_message(sid, is_user, page_no=1, status="All", page_step=
return None, None
msg = f"No Active {status} Tasks!\n\n"
buttons = ButtonMaker()
if not is_user:
buttons.data_button("📜", f"status {sid} ov", position="header")
if len(tasks) > STATUS_LIMIT:
msg += f"<b>Page:</b> {page_no}/{pages} | <b>Tasks:</b> {tasks_no} | <b>Step:</b> {page_step}\n"
buttons.data_button("<<", f"status {sid} pre", position="header")
Expand All @@ -257,7 +255,6 @@ async def get_readable_message(sid, is_user, page_no=1, status="All", page_step=
for label, status_value in list(STATUSES.items()):
if status_value != status:
buttons.data_button(label, f"status {sid} st {status_value}")
buttons.data_button("♻️", f"status {sid} ref", position="header")
button = buttons.build_menu(8)
msg += f"<b>CPU:</b> {cpu_percent()}% | <b>FREE:</b> {get_readable_file_size(disk_usage(Config.DOWNLOAD_DIR).free)}"
msg += f"\n<b>RAM:</b> {virtual_memory().percent}% | <b>UPTIME:</b> {get_readable_time(time() - bot_start_time)}"
Expand Down
76 changes: 1 addition & 75 deletions bot/modules/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ async def task_status(_, message):
async def status_pages(_, query):
data = query.data.split()
key = int(data[1])
if data[2] == "ref":
await query.answer()
await update_status_message(key, force=True)
elif data[2] in ["nex", "pre"]:
if data[2] in ["nex", "pre"]:
await query.answer()
async with task_dict_lock:
if data[2] == "nex":
Expand All @@ -74,74 +71,3 @@ async def status_pages(_, query):
async with task_dict_lock:
status_dict[key]["status"] = data[3]
await update_status_message(key, force=True)
elif data[2] == "ov":
message = query.message
tasks = {
"Download": 0,
"Upload": 0,
"Seed": 0,
"Archive": 0,
"Extract": 0,
"Split": 0,
"QueueDl": 0,
"QueueUp": 0,
"Clone": 0,
"CheckUp": 0,
"Pause": 0,
"SamVid": 0,
"ConvertMedia": 0,
"FFmpeg": 0,
}
dl_speed = 0
up_speed = 0
seed_speed = 0
async with task_dict_lock:
for download in task_dict.values():
match await sync_to_async(download.status):
case MirrorStatus.STATUS_DOWNLOAD:
tasks["Download"] += 1
dl_speed += speed_string_to_bytes(download.speed())
case MirrorStatus.STATUS_UPLOAD:
tasks["Upload"] += 1
up_speed += speed_string_to_bytes(download.speed())
case MirrorStatus.STATUS_SEED:
tasks["Seed"] += 1
seed_speed += speed_string_to_bytes(download.seed_speed())
case MirrorStatus.STATUS_ARCHIVE:
tasks["Archive"] += 1
case MirrorStatus.STATUS_EXTRACT:
tasks["Extract"] += 1
case MirrorStatus.STATUS_SPLIT:
tasks["Split"] += 1
case MirrorStatus.STATUS_QUEUEDL:
tasks["QueueDl"] += 1
case MirrorStatus.STATUS_QUEUEUP:
tasks["QueueUp"] += 1
case MirrorStatus.STATUS_CLONE:
tasks["Clone"] += 1
case MirrorStatus.STATUS_CHECK:
tasks["CheckUp"] += 1
case MirrorStatus.STATUS_PAUSED:
tasks["Pause"] += 1
case MirrorStatus.STATUS_SAMVID:
tasks["SamVid"] += 1
case MirrorStatus.STATUS_CONVERT:
tasks["ConvertMedia"] += 1
case MirrorStatus.STATUS_FFMPEG:
tasks["FFMPEG"] += 1
case _:
tasks["Download"] += 1
dl_speed += speed_string_to_bytes(download.speed())

msg = f"""<b>DL:</b> {tasks["Download"]} | <b>UP:</b> {tasks["Upload"]} | <b>SD:</b> {tasks["Seed"]} | <b>AR:</b> {tasks["Archive"]}
<b>EX:</b> {tasks["Extract"]} | <b>SP:</b> {tasks["Split"]} | <b>QD:</b> {tasks["QueueDl"]} | <b>QU:</b> {tasks["QueueUp"]}
<b>CL:</b> {tasks["Clone"]} | <b>CK:</b> {tasks["CheckUp"]} | <b>PA:</b> {tasks["Pause"]} | <b>SV:</b> {tasks["SamVid"]}
<b>CM:</b> {tasks["ConvertMedia"]} | <b>FF:</b> {tasks["FFmpeg"]}
<b>ODLS:</b> {get_readable_file_size(dl_speed)}/s
<b>OULS:</b> {get_readable_file_size(up_speed)}/s
<b>OSDS:</b> {get_readable_file_size(seed_speed)}/s
"""
button = ButtonMaker()
button.data_button("Back", f"status {data[1]} ref")
await edit_message(message, msg, button.build_menu())

0 comments on commit 520130e

Please sign in to comment.