From cbad03c1c710559f26b1ab55ce6d46e9f9c9ca6e Mon Sep 17 00:00:00 2001 From: subinps <64341611+subinps@users.noreply.github.com> Date: Thu, 14 Oct 2021 11:04:00 +0530 Subject: [PATCH] add performer --- plugins/player.py | 15 +++++++++------ plugins/scheduler.py | 15 +++++++++------ utils/utils.py | 15 ++++++++++----- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/plugins/player.py b/plugins/player.py index e4d0622e..3d7b46fa 100644 --- a/plugins/player.py +++ b/plugins/player.py @@ -153,17 +153,20 @@ async def add_to_playlist(_, message: Message): nyav = now.strftime("%d-%m-%Y-%H:%M:%S") if type in ["video", "audio"]: if type == "audio": - title=m_video.title + if m_video.performer is not None: + title = f"{m_video.performer} - {m_video.title}" + else: + title=m_video.title unique = f"{nyav}_{m_video.file_size}_audio" else: title=m_video.file_name unique = f"{nyav}_{m_video.file_size}_video" + if Config.PTN: + ny = parse(title) + title_ = ny.get("title") + if title_: + title = title_ file_id=m_video.file_id - if Config.PTN: - ny = parse(title) - title_ = ny.get("title") - if title_: - title = title_ data={1:title, 2:file_id, 3:"telegram", 4:user, 5:unique} if message.command[0] == "fplay": pla = [data] + Config.playlist diff --git a/plugins/scheduler.py b/plugins/scheduler.py index e360ee22..5390c5a3 100644 --- a/plugins/scheduler.py +++ b/plugins/scheduler.py @@ -120,16 +120,19 @@ async def schedule_vc(bot, message): nyav = now.strftime("%d-%m-%Y-%H:%M:%S") if type in ["video", "audio"]: if type == "audio": - title=m_video.title + if m_video.performer is not None: + title = f"{m_video.performer} - {m_video.title}" + else: + title=m_video.title unique = f"{nyav}_{m_video.file_size}_audio" else: title=m_video.file_name unique = f"{nyav}_{m_video.file_size}_video" - if Config.PTN: - ny = parse(title) - title_ = ny.get("title") - if title_: - title = title_ + if Config.PTN: + ny = parse(title) + title_ = ny.get("title") + if title_: + title = title_ data={'1':title, '2':m_video.file_id, '3':"telegram", '4':user, '5':unique} sid=f"{message.chat.id}_{msg.message_id}" Config.SCHEDULED_STREAM[sid] = data diff --git a/utils/utils.py b/utils/utils.py index a8dff44b..cdd68818 100644 --- a/utils/utils.py +++ b/utils/utils.py @@ -1250,6 +1250,11 @@ async def c_play(channel): elif filter == "video": file_id = you.video.file_id title = you.video.file_name + if Config.PTN: + ny = parse(title) + title_ = ny.get("title") + if title_: + title = title_ unique = f"{nyav}_{m.message_id}_video" elif filter == "document": if not "video" in you.document.mime_type: @@ -1258,11 +1263,11 @@ async def c_play(channel): file_id=you.document.file_id title = you.document.file_name unique = f"{nyav}_{m.message_id}_document" - if Config.PTN: - ny = parse(title) - title_ = ny.get("title") - if title_: - title = title_ + if Config.PTN: + ny = parse(title) + title_ = ny.get("title") + if title_: + title = title_ data={1:title, 2:file_id, 3:"telegram", 4:f"[{chat.title}]({you.link})", 5:unique} Config.playlist.append(data) await add_to_db_playlist(data)