From 6cbcb46c78f7b69fc83f0e789d21d950cf9cb5a6 Mon Sep 17 00:00:00 2001 From: Tofik Denianto <77754555+tofikdn@users.noreply.github.com> Date: Mon, 13 Sep 2021 22:16:53 +0700 Subject: [PATCH] Update videoplayer.py --- bot/videoplayer.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bot/videoplayer.py b/bot/videoplayer.py index a9c45db..f3b5d66 100644 --- a/bot/videoplayer.py +++ b/bot/videoplayer.py @@ -26,6 +26,15 @@ app = Client(Veez.SESSION_NAME, Veez.API_ID, Veez.API_HASH) call_py = PyTgCalls(app) FFMPEG_PROCESS = {} + +def convert_seconds(seconds: int) -> str: + seconds = seconds % (24 * 3600) + seconds %= 3600 + minutes = seconds // 60 + seconds %= 60 + return "%02d:%02d" % (minutes, seconds) + + def raw_converter(dl, song, video): return subprocess.Popen( ['ffmpeg', '-i', dl, '-f', 's16le', '-ac', '1', '-ar', '48000', song, '-y', '-f', 'rawvideo', '-r', '20', '-pix_fmt', 'yuv420p', '-vf', 'scale=854:480', video, '-y'], @@ -130,7 +139,7 @@ async def startvideo(client, m: Message): await m.reply_photo( photo="https://telegra.ph/file/422650a849a8d6831bde8.png", reply_markup=keyboard, - caption=f"💡 **video streaming started!**\n\n🏷 **Name:** {title}\n⏱ **Duration:** `{duration}`\n\n» **join to video chat on the top to watch the video.**") + caption=f"💡 **video streaming started!**\n\n🏷 **Name:** {title}\n⏱ **Duration:** `{convert_seconds(duration)}`\n\n» **join to video chat on the top to watch the video.**") return await msg.delete() await idle() except Exception as e: