Skip to content

Commit

Permalink
add performer
Browse files Browse the repository at this point in the history
  • Loading branch information
subinps committed Oct 14, 2021
1 parent b6b0ca4 commit cbad03c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
15 changes: 9 additions & 6 deletions plugins/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 9 additions & 6 deletions plugins/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down

0 comments on commit cbad03c

Please sign in to comment.