Skip to content

Commit

Permalink
try fix ffmpeg speed metre
Browse files Browse the repository at this point in the history
  • Loading branch information
5hojib committed Jan 2, 2025
1 parent b45b3ca commit 3db2106
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
9 changes: 6 additions & 3 deletions bot/helper/mirror_leech_utils/status_utils/ffmpeg_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ async def _ffmpeg_progress(self):
self._processed_bytes / self.listener.subsize * 100
)
elif key == "bitrate":
self._speed_raw = (
float(value.strip("kbits/s")) / 8
) * 1000
try:
self._speed_raw = (
float(value.replace("kbits/s", "").strip()) / 8
) * 1000
except ValueError:
self._speed_raw = 0
self._active = False

def speed(self):
Expand Down
15 changes: 4 additions & 11 deletions bot/modules/mediainfo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import asyncio
from os import getcwd
from os import path as ospath
from re import search as re_search
Expand All @@ -20,7 +19,6 @@
from bot.helper.telegram_helper.button_build import ButtonMaker
from bot.helper.telegram_helper.message_utils import (
delete_links,
delete_message,
edit_message,
five_minute_del,
send_message,
Expand Down Expand Up @@ -67,14 +65,9 @@ async def gen_mediainfo(message, link=None, media=None, msg=None):
await aioremove(des_path)

link_id = (await telegraph.create_page(title="MediaInfo", content=tc))["path"]
link = f"https://graph.org/{link_id}"
await delete_message(temp_send)
await asyncio.sleep(2)
await TgClient.bot.send_web_page(
message.chat.id,
link,
"<blockquote>MediaInfo generated successfully.</blockquote>",
invert_media=True,
await temp_send.edit(
f"<blockquote>MediaInfo generated successfully<a href='https://graph.org/{link_id}'>.</a></blockquote>",
disable_web_page_preview=False,
)


Expand Down Expand Up @@ -107,4 +100,4 @@ async def mediainfo(_, message):
else:
await send_message(message, help_msg)
else:
await send_message(message, help_msg)
await send_message(message, help_msg)

0 comments on commit 3db2106

Please sign in to comment.