Skip to content

Commit

Permalink
Merge pull request subinps#45 from anon97945/patch-2
Browse files Browse the repository at this point in the history
add performer for audio
  • Loading branch information
subinps authored Oct 14, 2021
2 parents ddd86d1 + cbad03c commit 4fed522
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 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
24 changes: 16 additions & 8 deletions utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1241,12 +1241,20 @@ async def c_play(channel):
now = datetime.now()
nyav = now.strftime("%d-%m-%Y-%H:%M:%S")
if filter == "audio":
title=you.audio.title
if you.audio.performer is not None:
title = f"{you.audio.performer} - {you.audio.title}"
else:
title = you.audio.title
file_id = you.audio.file_id
unique = f"{nyav}_{m.message_id}_audio"
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 @@ -1255,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 Expand Up @@ -1847,8 +1855,8 @@ def get_image(title, pic, dur="Live"):
newimage = "converted.jpg"
image = Image.open(pic)
draw = ImageDraw.Draw(image)
font = ImageFont.truetype('./utils/font.ttf', 70)
title = title[0:30]
font = ImageFont.truetype('./utils/font.ttf', 60)
title = title[0:45]
MAX_W = 1790
dur=convert(int(float(dur)))
if dur=="0:00:00":
Expand Down

0 comments on commit 4fed522

Please sign in to comment.