From 26a6789c43040b0bf2634e2d59e052a21a7315d1 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Sat, 8 Jan 2022 22:39:59 +0700 Subject: [PATCH] added thumbnail support --- program/video.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/program/video.py b/program/video.py index 9357598..c9cc450 100644 --- a/program/video.py +++ b/program/video.py @@ -6,6 +6,8 @@ import re import asyncio from config import ASSISTANT_NAME, BOT_USERNAME, IMG_1, IMG_2 +from driver.design.thumbnail import thumb +from driver.design.chatname import CHAT_TITLE from driver.filters import command, other_filters from driver.queues import QUEUE, add_to_queue from driver.veez import call_py, user @@ -197,9 +199,14 @@ async def vplay(c: Client, m: Message): await loser.edit("❌ **no results found.**") else: songname = search[0] + title = search[0] url = search[1] duration = search[2] thumbnail = search[3] + userid = m.from_user.id + gcname = m.chat.title + ctitle = await CHAT_TITLE(gcname) + image = await thumb(thumbnail, title, userid, ctitle) veez, ytlink = await ytdl(url) if veez == 0: await loser.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`") @@ -211,7 +218,7 @@ async def vplay(c: Client, m: Message): await loser.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" await m.reply_photo( - photo=thumbnail, + photo=image, caption=f"💡 **Track added to queue »** `{pos}`\n\n🏷 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🎧 **Request by:** {requester}", reply_markup=keyboard, ) @@ -231,7 +238,7 @@ async def vplay(c: Client, m: Message): await loser.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" await m.reply_photo( - photo=thumbnail, + photo=image, caption=f"🏷 **Name:** [{songname}]({url})\n⏱ **Duration:** `{duration}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {requester}\n📹 **Stream type:** `Video`", reply_markup=keyboard, ) @@ -254,9 +261,14 @@ async def vplay(c: Client, m: Message): await loser.edit("❌ **no results found.**") else: songname = search[0] + title = search[0] url = search[1] duration = search[2] thumbnail = search[3] + userid = m.from_user.id + gcname = m.chat.title + ctitle = await CHAT_TITLE(gcname) + image = await thumb(thumbnail, title, userid, ctitle) veez, ytlink = await ytdl(url) if veez == 0: await loser.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`") @@ -268,7 +280,7 @@ async def vplay(c: Client, m: Message): f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" ) await m.reply_photo( - photo=thumbnail, + photo=image, caption=f"💡 **Track added to queue »** `{pos}`\n\n🏷 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🎧 **Request by:** {requester}", reply_markup=keyboard, ) @@ -288,7 +300,7 @@ async def vplay(c: Client, m: Message): await loser.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" await m.reply_photo( - photo=thumbnail, + photo=image, caption=f"🏷 **Name:** [{songname}]({url})\n⏱ **Duration:** `{duration}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {requester}\n📹 **Stream type:** `Video`", reply_markup=keyboard, )