add duration info for local video

This commit is contained in:
levina 2022-01-25 20:23:55 +07:00 committed by GitHub
parent 8b1e384508
commit 2d5e9ce838
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -135,8 +135,10 @@ async def vplay(c: Client, m: Message):
try: try:
if replied.video: if replied.video:
songname = replied.video.file_name[:70] songname = replied.video.file_name[:70]
duration = replied.video.duration
elif replied.document: elif replied.document:
songname = replied.document.file_name[:70] songname = replied.document.file_name[:70]
duration = replied.document.duration
except BaseException: except BaseException:
songname = "Video" songname = "Video"
@ -148,7 +150,7 @@ async def vplay(c: Client, m: Message):
await m.reply_photo( await m.reply_photo(
photo=f"{IMG_1}", photo=f"{IMG_1}",
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({link}) | `video`\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}", caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({link}) | `video`\n⏱️ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
) )
else: else:
if Q == 720: if Q == 720:
@ -174,7 +176,7 @@ async def vplay(c: Client, m: Message):
await m.reply_photo( await m.reply_photo(
photo=f"{IMG_2}", photo=f"{IMG_2}",
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"🗂 **Name:** [{songname}]({link}) | `video`\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}", caption=f"🗂 **Name:** [{songname}]({link}) | `video`\n⏱️ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
) )
else: else:
if len(m.command) < 2: if len(m.command) < 2: