1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Search by default in dlmusic

This commit is contained in:
Steffo 2019-08-03 19:00:57 +02:00
parent aa5fdf4d40
commit ff15d4c883

View file

@ -23,9 +23,12 @@ class DlmusicCommand(Command):
@classmethod
async def common(cls, call: Call):
url = call.args[0]
files: typing.List[YtdlVorbis] = await asyncify(YtdlVorbis.create_and_ready_from_url, url, **ytdl_args)
for file in files:
await call.reply(f"⬇️ https://scaleway.steffo.eu/musicbot_cache/{urllib.parse.quote(file.vorbis_filename)}")
if url.startswith("http://") or url.startswith("https://"):
vfiles: typing.List[YtdlVorbis] = await asyncify(YtdlVorbis.create_and_ready_from_url, url, **ytdl_args)
else:
vfiles = await asyncify(YtdlVorbis.create_and_ready_from_url, f"ytsearch:{url}", **ytdl_args)
for vfile in vfiles:
await call.reply(f"⬇️ https://scaleway.steffo.eu/musicbot_cache/{urllib.parse.quote(vfile.vorbis_filename)}")
await asyncio.sleep(seconds_before_deletion)
for file in files:
file.delete()
for vfile in vfiles:
vfile.delete()