1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-12-17 23:24:20 +00:00
royalnet/docs/html/audio.html

372 lines
No EOL
17 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>royalnet.audio &mdash; Royalnet documentation</title>
<script type="text/javascript" src="_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="royalnet.bots" href="bots.html" />
<link rel="prev" title="royalnet" href="index.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> Royalnet
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">royalnet.audio</a><ul class="simple">
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="bots.html">royalnet.bots</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">royalnet.commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="database.html">royalnet.database</a></li>
<li class="toctree-l1"><a class="reference internal" href="network.html">royalnet.network</a></li>
<li class="toctree-l1"><a class="reference internal" href="utils.html">royalnet.utils</a></li>
<li class="toctree-l1"><a class="reference internal" href="error.html">royalnet.error</a></li>
<li class="toctree-l1"><a class="reference internal" href="web.html">royalnet.web</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Royalnet</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>royalnet.audio</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/audio.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="royalnet-audio">
<h1>royalnet.audio<a class="headerlink" href="#royalnet-audio" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
</div>
<span class="target" id="module-royalnet.audio"></span><p>Video and audio downloading related classes, mainly used for Discord voice bots.</p>
<dl class="class">
<dt id="royalnet.audio.YtdlInfo">
<em class="property">class </em><code class="descclassname">royalnet.audio.</code><code class="descname">YtdlInfo</code><span class="sig-paren">(</span><em>info: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlInfo" title="Permalink to this definition"></a></dt>
<dd><p>A wrapper around youtube_dl extracted info.</p>
<dl class="method">
<dt id="royalnet.audio.YtdlInfo.__init__">
<code class="descname">__init__</code><span class="sig-paren">(</span><em>info: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlInfo.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Create a YtdlInfo from the dict returned by the <code class="xref py py-func docutils literal notranslate"><span class="pre">youtube_dl.YoutubeDL.extract_info()</span></code> function.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Does not download the info, for that use <a class="reference internal" href="#royalnet.audio.YtdlInfo.retrieve_for_url" title="royalnet.audio.YtdlInfo.retrieve_for_url"><code class="xref py py-func docutils literal notranslate"><span class="pre">royalnet.audio.YtdlInfo.retrieve_for_url()</span></code></a>.</p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.audio.YtdlInfo._default_ytdl_args">
<code class="descname">_default_ytdl_args</code><em class="property"> = {'no_warnings': True, 'noplaylist': True, 'outtmpl': '%(title)s-%(id)s.%(ext)s', 'quiet': True}</em><a class="headerlink" href="#royalnet.audio.YtdlInfo._default_ytdl_args" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="classmethod">
<dt id="royalnet.audio.YtdlInfo.retrieve_for_url">
<em class="property">classmethod </em><code class="descname">retrieve_for_url</code><span class="sig-paren">(</span><em>url</em>, <em>**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.audio.ytdlinfo.YtdlInfo]<a class="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>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A <a class="reference external" href="https://docs.python.org/3.7/library/stdtypes.html#list" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> containing the infos for the requested videos.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlInfo.to_discord_embed">
<code class="descname">to_discord_embed</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; discord.embeds.Embed<a class="headerlink" href="#royalnet.audio.YtdlInfo.to_discord_embed" title="Permalink to this definition"></a></dt>
<dd><p>Return this info as a <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed" title="(in discord.py v1.3.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Embed</span></code></a>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.audio.YtdlFile">
<em class="property">class </em><code class="descclassname">royalnet.audio.</code><code class="descname">YtdlFile</code><span class="sig-paren">(</span><em>url: str</em>, <em>info: Optional[royalnet.audio.ytdlinfo.YtdlInfo] = None</em>, <em>filename: Optional[str] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlFile" title="Permalink to this definition"></a></dt>
<dd><p>Information about a youtube-dl downloaded file.</p>
<dl class="attribute">
<dt id="royalnet.audio.YtdlFile._default_ytdl_args">
<code class="descname">_default_ytdl_args</code><em class="property"> = {'no_warnings': True, 'noplaylist': True, 'outtmpl': '%(title)s-%(id)s.%(ext)s', 'quiet': True}</em><a class="headerlink" href="#royalnet.audio.YtdlFile._default_ytdl_args" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlFile.delete">
<code class="descname">delete</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlFile.delete" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlFile.download_file">
<code class="descname">download_file</code><span class="sig-paren">(</span><em>**ytdl_args</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.audio.YtdlFile.download_file" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="classmethod">
<dt id="royalnet.audio.YtdlFile.download_from_url">
<em class="property">classmethod </em><code class="descname">download_from_url</code><span class="sig-paren">(</span><em>url: str</em>, <em>**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.audio.ytdlfile.YtdlFile]<a class="headerlink" href="#royalnet.audio.YtdlFile.download_from_url" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlFile.has_info">
<code class="descname">has_info</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; bool<a class="headerlink" href="#royalnet.audio.YtdlFile.has_info" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlFile.is_downloaded">
<code class="descname">is_downloaded</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; bool<a class="headerlink" href="#royalnet.audio.YtdlFile.is_downloaded" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlFile.open">
<code class="descname">open</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlFile.open" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlFile.update_info">
<code class="descname">update_info</code><span class="sig-paren">(</span><em>**ytdl_args</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.audio.YtdlFile.update_info" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.audio.FileAudioSource">
<em class="property">class </em><code class="descclassname">royalnet.audio.</code><code class="descname">FileAudioSource</code><span class="sig-paren">(</span><em>file</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.FileAudioSource" title="Permalink to this definition"></a></dt>
<dd><p>A <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.AudioSource" title="(in discord.py v1.3.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.AudioSource</span></code></a> that uses a <a class="reference external" href="https://docs.python.org/3.7/library/io.html#io.BufferedIOBase" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">io.BufferedIOBase</span></code></a> as an input instead of memory.</p>
<p>The stream should be in the usual PCM encoding.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>This AudioSource will consume (and close) the passed stream.</p>
</div>
<dl class="method">
<dt id="royalnet.audio.FileAudioSource.is_opus">
<code class="descname">is_opus</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.FileAudioSource.is_opus" title="Permalink to this definition"></a></dt>
<dd><p>This audio file isnt Opus-encoded, but PCM-encoded.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.FileAudioSource.read">
<code class="descname">read</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="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 <a class="reference external" href="https://docs.python.org/3.7/library/stdtypes.html#bytes" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a>-like object to signal this is the way to do so.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.audio.YtdlDiscord">
<em class="property">class </em><code class="descclassname">royalnet.audio.</code><code class="descname">YtdlDiscord</code><span class="sig-paren">(</span><em>ytdl_file: royalnet.audio.ytdlfile.YtdlFile</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlDiscord" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.audio.YtdlDiscord.convert_to_pcm">
<code class="descname">convert_to_pcm</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.audio.YtdlDiscord.convert_to_pcm" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="classmethod">
<dt id="royalnet.audio.YtdlDiscord.create_and_ready_from_url">
<em class="property">classmethod </em><code class="descname">create_and_ready_from_url</code><span class="sig-paren">(</span><em>url</em>, <em>**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.audio.ytdldiscord.YtdlDiscord]<a class="headerlink" href="#royalnet.audio.YtdlDiscord.create_and_ready_from_url" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="classmethod">
<dt id="royalnet.audio.YtdlDiscord.create_from_url">
<em class="property">classmethod </em><code class="descname">create_from_url</code><span class="sig-paren">(</span><em>url</em>, <em>**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.audio.ytdldiscord.YtdlDiscord]<a class="headerlink" href="#royalnet.audio.YtdlDiscord.create_from_url" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlDiscord.delete">
<code class="descname">delete</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.audio.YtdlDiscord.delete" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="royalnet.audio.YtdlDiscord.info">
<code class="descname">info</code><a class="headerlink" href="#royalnet.audio.YtdlDiscord.info" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlDiscord.pcm_available">
<code class="descname">pcm_available</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlDiscord.pcm_available" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlDiscord.ready_up">
<code class="descname">ready_up</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlDiscord.ready_up" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlDiscord.spawn_audiosource">
<code class="descname">spawn_audiosource</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; royalnet.audio.fileaudiosource.FileAudioSource<a class="headerlink" href="#royalnet.audio.YtdlDiscord.spawn_audiosource" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="bots.html" class="btn btn-neutral float-right" title="royalnet.bots" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="index.html" class="btn btn-neutral float-left" title="royalnet" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2019, Stefano Pigozzi
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>