commit
242359cbb7
@ -45,9 +45,10 @@ def song(_, message):
|
|||||||
global is_downloading
|
global is_downloading
|
||||||
query = " ".join(message.command[1:])
|
query = " ".join(message.command[1:])
|
||||||
if is_downloading:
|
if is_downloading:
|
||||||
return await message.reply(
|
message.reply(
|
||||||
"» Another download in progress, please try again after some time !"
|
"» Another download in progress, please try again after some time !"
|
||||||
)
|
)
|
||||||
|
return
|
||||||
is_downloading = True
|
is_downloading = True
|
||||||
m = message.reply("🔎 finding song...")
|
m = message.reply("🔎 finding song...")
|
||||||
ydl_ops = {"format": "bestaudio[ext=m4a]"}
|
ydl_ops = {"format": "bestaudio[ext=m4a]"}
|
||||||
@ -62,7 +63,7 @@ def song(_, message):
|
|||||||
duration = results[0]["duration"]
|
duration = results[0]["duration"]
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
m.edit("❌ song not found.\n\nplease give a valid song name.")
|
m.edit("❌ song not found.\n\nplease give a valid song name !")
|
||||||
print(str(e))
|
print(str(e))
|
||||||
return
|
return
|
||||||
m.edit("📥 downloading song...")
|
m.edit("📥 downloading song...")
|
||||||
@ -72,6 +73,7 @@ def song(_, message):
|
|||||||
audio_file = ydl.prepare_filename(info_dict)
|
audio_file = ydl.prepare_filename(info_dict)
|
||||||
ydl.process_info(info_dict)
|
ydl.process_info(info_dict)
|
||||||
rep = f"• uploader @{bn}"
|
rep = f"• uploader @{bn}"
|
||||||
|
host = str(info_dict["uploader"])
|
||||||
secmul, dur, dur_arr = 1, 0, duration.split(":")
|
secmul, dur, dur_arr = 1, 0, duration.split(":")
|
||||||
for i in range(len(dur_arr) - 1, -1, -1):
|
for i in range(len(dur_arr) - 1, -1, -1):
|
||||||
dur += int(float(dur_arr[i])) * secmul
|
dur += int(float(dur_arr[i])) * secmul
|
||||||
@ -80,6 +82,7 @@ def song(_, message):
|
|||||||
message.reply_audio(
|
message.reply_audio(
|
||||||
audio_file,
|
audio_file,
|
||||||
caption=rep,
|
caption=rep,
|
||||||
|
performer=host,
|
||||||
thumb=thumb_name,
|
thumb=thumb_name,
|
||||||
parse_mode="md",
|
parse_mode="md",
|
||||||
title=title,
|
title=title,
|
||||||
|
1
runtime.txt
Normal file
1
runtime.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
python-3.10.0
|
Loading…
Reference in New Issue
Block a user