added thumbnail support

This commit is contained in:
levina 2022-01-08 22:39:59 +07:00 committed by GitHub
parent a6f92660be
commit 26a6789c43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,
)