mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
cool
This commit is contained in:
parent
8a25fa8b84
commit
d1e3714559
1 changed files with 18 additions and 17 deletions
|
@ -818,23 +818,24 @@ class RoyalDiscordBot(discord.Client):
|
||||||
async def add_video_from_url(self, url: str, index: typing.Optional[int] = None, enqueuer: discord.Member = None):
|
async def add_video_from_url(self, url: str, index: typing.Optional[int] = None, enqueuer: discord.Member = None):
|
||||||
# Retrieve info
|
# Retrieve info
|
||||||
logger.debug(f"Retrieving info for {url}.")
|
logger.debug(f"Retrieving info for {url}.")
|
||||||
with youtube_dl.YoutubeDL({"quiet": True,
|
async with self.main_channel.typing():
|
||||||
"ignoreerrors": True,
|
with youtube_dl.YoutubeDL({"quiet": True,
|
||||||
"simulate": True}) as ytdl:
|
"ignoreerrors": True,
|
||||||
info = await loop.run_in_executor(executor,
|
"simulate": True}) as ytdl:
|
||||||
functools.partial(ytdl.extract_info, url=url, download=False))
|
info = await loop.run_in_executor(executor,
|
||||||
if info is None:
|
functools.partial(ytdl.extract_info, url=url, download=False))
|
||||||
logger.debug(f"No video found at {url}.")
|
if info is None:
|
||||||
await self.main_channel.send(f"⚠️ Non è stato trovato nessun video all'URL `{url}`,"
|
logger.debug(f"No video found at {url}.")
|
||||||
f" pertanto non è stato aggiunto alla coda.")
|
await self.main_channel.send(f"⚠️ Non è stato trovato nessun video all'URL `{url}`,"
|
||||||
return
|
f" pertanto non è stato aggiunto alla coda.")
|
||||||
if "entries" in info:
|
return
|
||||||
logger.debug(f"Playlist detected at {url}.")
|
if "entries" in info:
|
||||||
for entry in info["entries"]:
|
logger.debug(f"Playlist detected at {url}.")
|
||||||
self.video_queue.add(YoutubeDLVideo(entry["webpage_url"], enqueuer=enqueuer), index)
|
for entry in info["entries"]:
|
||||||
return
|
self.video_queue.add(YoutubeDLVideo(entry["webpage_url"], enqueuer=enqueuer), index)
|
||||||
logger.debug(f"Single video detected at {url}.")
|
return
|
||||||
self.video_queue.add(YoutubeDLVideo(url, enqueuer=enqueuer), index)
|
logger.debug(f"Single video detected at {url}.")
|
||||||
|
self.video_queue.add(YoutubeDLVideo(url, enqueuer=enqueuer), index)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
async def null(self, channel: discord.TextChannel, author: discord.Member, params: typing.List[str]):
|
async def null(self, channel: discord.TextChannel, author: discord.Member, params: typing.List[str]):
|
||||||
|
|
Loading…
Reference in a new issue