royalnet.audio¶
Video and audio downloading related classes, mainly used for Discord voice bots.
-
class
royalnet.audio.
YtdlInfo
(info: Dict[str, Any])¶ A wrapper around youtube_dl extracted info.
-
__init__
(info: Dict[str, Any])¶ Create a YtdlInfo from the dict returned by the
youtube_dl.YoutubeDL.extract_info()
function.Warning
Does not download the info, for that use
royalnet.audio.YtdlInfo.retrieve_for_url()
.
-
_default_ytdl_args
= {'no_warnings': True, 'noplaylist': True, 'outtmpl': '%(title)s-%(id)s.%(ext)s', 'quiet': True}¶
-
classmethod
retrieve_for_url
(url, **ytdl_args) → List[royalnet.audio.ytdlinfo.YtdlInfo]¶ Fetch the info for an url through YoutubeDL.
- Returns
A
list
containing the infos for the requested videos.
-
to_discord_embed
() → discord.embeds.Embed¶ Return this info as a
discord.Embed
.
-
-
class
royalnet.audio.
YtdlFile
(url: str, info: Optional[royalnet.audio.ytdlinfo.YtdlInfo] = None, filename: Optional[str] = None)¶ Information about a youtube-dl downloaded file.
-
_default_ytdl_args
= {'no_warnings': True, 'noplaylist': True, 'outtmpl': '%(title)s-%(id)s.%(ext)s', 'quiet': True}¶
-
delete
()¶
-
download_file
(**ytdl_args) → None¶
-
classmethod
download_from_url
(url: str, **ytdl_args) → List[royalnet.audio.ytdlfile.YtdlFile]¶
-
has_info
() → bool¶
-
is_downloaded
() → bool¶
-
open
()¶
-
update_info
(**ytdl_args) → None¶
-
-
class
royalnet.audio.
FileAudioSource
(file)¶ A
discord.AudioSource
that uses aio.BufferedIOBase
as an input instead of memory.The stream should be in the usual PCM encoding.
Warning
This AudioSource will consume (and close) the passed stream.
-
is_opus
()¶ This audio file isn’t Opus-encoded, but PCM-encoded.
- Returns
False
.
-
-
class
royalnet.audio.
YtdlDiscord
(ytdl_file: royalnet.audio.ytdlfile.YtdlFile)¶ -
convert_to_pcm
() → None¶
-
classmethod
create_and_ready_from_url
(url, **ytdl_args) → List[royalnet.audio.ytdldiscord.YtdlDiscord]¶
-
classmethod
create_from_url
(url, **ytdl_args) → List[royalnet.audio.ytdldiscord.YtdlDiscord]¶
-
delete
() → None¶
-
info
¶
-
pcm_available
()¶
-
ready_up
()¶
-
spawn_audiosource
() → royalnet.audio.fileaudiosource.FileAudioSource¶
-