<spanclass="target"id="module-royalnet.audio"></span><p>Video and audio downloading related classes, mainly used for Discord voice bots.</p>
<dlclass="class">
<dtid="royalnet.audio.YtdlInfo">
<emclass="property">class </em><codeclass="descclassname">royalnet.audio.</code><codeclass="descname">YtdlInfo</code><spanclass="sig-paren">(</span><em>info: Dict[str, Any]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.YtdlInfo"title="Permalink to this definition">¶</a></dt>
<dd><p>A wrapper around youtube_dl extracted info.</p>
<dlclass="method">
<dtid="royalnet.audio.YtdlInfo.__init__">
<codeclass="descname">__init__</code><spanclass="sig-paren">(</span><em>info: Dict[str, Any]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.YtdlInfo.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a YtdlInfo from the dict returned by the <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">youtube_dl.YoutubeDL.extract_info()</span></code> function.</p>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>Does not download the info, for that use <aclass="reference internal"href="#royalnet.audio.YtdlInfo.retrieve_for_url"title="royalnet.audio.YtdlInfo.retrieve_for_url"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">royalnet.audio.YtdlInfo.retrieve_for_url()</span></code></a>.</p>
<codeclass="descname">_default_ytdl_args</code><emclass="property"> = {'no_warnings': True, 'noplaylist': True, 'outtmpl': '%(title)s-%(id)s.%(ext)s', 'quiet': True}</em><aclass="headerlink"href="#royalnet.audio.YtdlInfo._default_ytdl_args"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="classmethod">
<dtid="royalnet.audio.YtdlInfo.retrieve_for_url">
<emclass="property">classmethod </em><codeclass="descname">retrieve_for_url</code><spanclass="sig-paren">(</span><em>url</em>, <em>**ytdl_args</em><spanclass="sig-paren">)</span>→ List[royalnet.audio.ytdlinfo.YtdlInfo]<aclass="headerlink"href="#royalnet.audio.YtdlInfo.retrieve_for_url"title="Permalink to this definition">¶</a></dt>
<dd><p>Fetch the info for an url through YoutubeDL.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A <aclass="reference external"href="https://docs.python.org/3.7/library/stdtypes.html#list"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">list</span></code></a> containing the infos for the requested videos.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.YtdlInfo.to_discord_embed">
<codeclass="descname">to_discord_embed</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ discord.embeds.Embed<aclass="headerlink"href="#royalnet.audio.YtdlInfo.to_discord_embed"title="Permalink to this definition">¶</a></dt>
<dd><p>Return this info as a <aclass="reference external"href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed"title="(in discord.py v1.3.0a)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">discord.Embed</span></code></a>.</p>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.audio.YtdlFile">
<emclass="property">class </em><codeclass="descclassname">royalnet.audio.</code><codeclass="descname">YtdlFile</code><spanclass="sig-paren">(</span><em>url: str</em>, <em>info: Optional[royalnet.audio.ytdlinfo.YtdlInfo] = None</em>, <em>filename: Optional[str] = None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.YtdlFile"title="Permalink to this definition">¶</a></dt>
<dd><p>Information about a youtube-dl downloaded file.</p>
<codeclass="descname">_default_ytdl_args</code><emclass="property"> = {'no_warnings': True, 'noplaylist': True, 'outtmpl': '%(title)s-%(id)s.%(ext)s', 'quiet': True}</em><aclass="headerlink"href="#royalnet.audio.YtdlFile._default_ytdl_args"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.audio.YtdlFile.delete">
<codeclass="descname">delete</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.YtdlFile.delete"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.audio.YtdlFile.download_file">
<codeclass="descname">download_file</code><spanclass="sig-paren">(</span><em>**ytdl_args</em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.audio.YtdlFile.download_file"title="Permalink to this definition">¶</a></dt>
<emclass="property">classmethod </em><codeclass="descname">download_from_url</code><spanclass="sig-paren">(</span><em>url: str</em>, <em>**ytdl_args</em><spanclass="sig-paren">)</span>→ List[royalnet.audio.ytdlfile.YtdlFile]<aclass="headerlink"href="#royalnet.audio.YtdlFile.download_from_url"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.audio.YtdlFile.has_info">
<codeclass="descname">has_info</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ bool<aclass="headerlink"href="#royalnet.audio.YtdlFile.has_info"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.audio.YtdlFile.is_downloaded">
<codeclass="descname">is_downloaded</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ bool<aclass="headerlink"href="#royalnet.audio.YtdlFile.is_downloaded"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.audio.YtdlFile.open">
<codeclass="descname">open</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.YtdlFile.open"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.audio.YtdlFile.update_info">
<codeclass="descname">update_info</code><spanclass="sig-paren">(</span><em>**ytdl_args</em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.audio.YtdlFile.update_info"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.audio.FileAudioSource">
<emclass="property">class </em><codeclass="descclassname">royalnet.audio.</code><codeclass="descname">FileAudioSource</code><spanclass="sig-paren">(</span><em>file</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.FileAudioSource"title="Permalink to this definition">¶</a></dt>
<dd><p>A <aclass="reference external"href="https://discordpy.readthedocs.io/en/latest/api.html#discord.AudioSource"title="(in discord.py v1.3.0a)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">discord.AudioSource</span></code></a> that uses a <aclass="reference external"href="https://docs.python.org/3.7/library/io.html#io.BufferedIOBase"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">io.BufferedIOBase</span></code></a> as an input instead of memory.</p>
<p>The stream should be in the usual PCM encoding.</p>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>This AudioSource will consume (and close) the passed stream.</p>
</div>
<dlclass="method">
<dtid="royalnet.audio.FileAudioSource.is_opus">
<codeclass="descname">is_opus</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.FileAudioSource.is_opus"title="Permalink to this definition">¶</a></dt>
<dd><p>This audio file isn’t Opus-encoded, but PCM-encoded.</p>
<codeclass="descname">read</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.FileAudioSource.read"title="Permalink to this definition">¶</a></dt>
<dd><p>Reads 20ms worth of audio.</p>
<p>If the audio is complete, then returning an empty <aclass="reference external"href="https://docs.python.org/3.7/library/stdtypes.html#bytes"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">bytes</span></code></a>-like object to signal this is the way to do so.</p>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.audio.YtdlDiscord">
<emclass="property">class </em><codeclass="descclassname">royalnet.audio.</code><codeclass="descname">YtdlDiscord</code><spanclass="sig-paren">(</span><em>ytdl_file: royalnet.audio.ytdlfile.YtdlFile</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.YtdlDiscord"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">convert_to_pcm</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.audio.YtdlDiscord.convert_to_pcm"title="Permalink to this definition">¶</a></dt>
<emclass="property">classmethod </em><codeclass="descname">create_and_ready_from_url</code><spanclass="sig-paren">(</span><em>url</em>, <em>**ytdl_args</em><spanclass="sig-paren">)</span>→ List[royalnet.audio.ytdldiscord.YtdlDiscord]<aclass="headerlink"href="#royalnet.audio.YtdlDiscord.create_and_ready_from_url"title="Permalink to this definition">¶</a></dt>
<emclass="property">classmethod </em><codeclass="descname">create_from_url</code><spanclass="sig-paren">(</span><em>url</em>, <em>**ytdl_args</em><spanclass="sig-paren">)</span>→ List[royalnet.audio.ytdldiscord.YtdlDiscord]<aclass="headerlink"href="#royalnet.audio.YtdlDiscord.create_from_url"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.audio.YtdlDiscord.delete">
<codeclass="descname">delete</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.audio.YtdlDiscord.delete"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="royalnet.audio.YtdlDiscord.info">
<codeclass="descname">info</code><aclass="headerlink"href="#royalnet.audio.YtdlDiscord.info"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.audio.YtdlDiscord.pcm_available">
<codeclass="descname">pcm_available</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.YtdlDiscord.pcm_available"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.audio.YtdlDiscord.ready_up">
<codeclass="descname">ready_up</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.YtdlDiscord.ready_up"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">spawn_audiosource</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ royalnet.audio.fileaudiosource.FileAudioSource<aclass="headerlink"href="#royalnet.audio.YtdlDiscord.spawn_audiosource"title="Permalink to this definition">¶</a></dt>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.