1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00
royalnet/docs/html/audio.html
2019-07-10 17:16:35 +03:00

657 lines
No EOL
41 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.PlayMode">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.audio.</code><code class="sig-name descname">PlayMode</code><a class="headerlink" href="#royalnet.audio.PlayMode" title="Permalink to this definition"></a></dt>
<dd><p>The base class for a PlayMode, such as <a class="reference internal" href="#royalnet.audio.Playlist" title="royalnet.audio.Playlist"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.Playlist</span></code></a>. Inherit from this class if you want to create a custom PlayMode.</p>
<dl class="method">
<dt id="royalnet.audio.PlayMode.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.PlayMode.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Create a new PlayMode and initialize the generator inside.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.PlayMode._generate_generator">
<code class="sig-name descname">_generate_generator</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.PlayMode._generate_generator" title="Permalink to this definition"></a></dt>
<dd><p>Factory function for an async generator that changes the <code class="docutils literal notranslate"><span class="pre">now_playing</span></code> property either to a <code class="xref py py-class docutils literal notranslate"><span class="pre">discord.audio.RoyalPCMAudio</span></code> or to <code class="docutils literal notranslate"><span class="pre">None</span></code>, then yields the value it changed it to.</p>
<dl class="field-list simple">
<dt class="field-odd">Yields</dt>
<dd class="field-odd"><p>The <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a> to be played next.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.PlayMode.add">
<code class="sig-name descname">add</code><span class="sig-paren">(</span><em class="sig-param">item: royalnet.audio.royalpcmaudio.RoyalPCMAudio</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.audio.PlayMode.add" title="Permalink to this definition"></a></dt>
<dd><p>Add a new <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a> to the PlayMode.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>item</strong> The item to add to the PlayMode.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.PlayMode.delete">
<code class="sig-name descname">delete</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.audio.PlayMode.delete" title="Permalink to this definition"></a></dt>
<dd><p>Delete all <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a> contained inside this PlayMode.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.PlayMode.next">
<em class="property">async </em><code class="sig-name descname">next</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Optional[royalnet.audio.royalpcmaudio.RoyalPCMAudio]<a class="headerlink" href="#royalnet.audio.PlayMode.next" title="Permalink to this definition"></a></dt>
<dd><p>Get the next <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a> from the list and advance it.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The next <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a>.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.PlayMode.queue_preview">
<code class="sig-name descname">queue_preview</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; List[royalnet.audio.royalpcmaudio.RoyalPCMAudio]<a class="headerlink" href="#royalnet.audio.PlayMode.queue_preview" title="Permalink to this definition"></a></dt>
<dd><p>Display all the videos in the PlayMode as a list, if possible.</p>
<p>To be used with <cite>queue</cite> commands, for example.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.7/library/exceptions.html#NotImplementedError" title="(in Python v3.7)"><strong>NotImplementedError</strong></a> If a preview cant be generated.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A list of videos contained in the queue.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.PlayMode.videos_left">
<code class="sig-name descname">videos_left</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Union[int, float]<a class="headerlink" href="#royalnet.audio.PlayMode.videos_left" title="Permalink to this definition"></a></dt>
<dd><p>Return the number of videos left in the PlayMode.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Usually a <a class="reference external" href="https://docs.python.org/3.7/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, but may return also <a class="reference external" href="https://docs.python.org/3.7/library/math.html#math.inf" title="(in Python v3.7)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">math.inf</span></code></a> if the PlayMode is infinite.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.audio.Playlist">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.audio.</code><code class="sig-name descname">Playlist</code><span class="sig-paren">(</span><em class="sig-param">starting_list: List[royalnet.audio.royalpcmaudio.RoyalPCMAudio] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.Playlist" title="Permalink to this definition"></a></dt>
<dd><p>A video list. <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a> played are removed from the list.</p>
<dl class="method">
<dt id="royalnet.audio.Playlist.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">starting_list: List[royalnet.audio.royalpcmaudio.RoyalPCMAudio] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.Playlist.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Create a new Playlist.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>starting_list</strong> A list of items with which the Playlist will be created.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.Playlist._generate_generator">
<code class="sig-name descname">_generate_generator</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.Playlist._generate_generator" title="Permalink to this definition"></a></dt>
<dd><p>Factory function for an async generator that changes the <code class="docutils literal notranslate"><span class="pre">now_playing</span></code> property either to a <code class="xref py py-class docutils literal notranslate"><span class="pre">discord.audio.RoyalPCMAudio</span></code> or to <code class="docutils literal notranslate"><span class="pre">None</span></code>, then yields the value it changed it to.</p>
<dl class="field-list simple">
<dt class="field-odd">Yields</dt>
<dd class="field-odd"><p>The <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a> to be played next.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.Playlist.add">
<code class="sig-name descname">add</code><span class="sig-paren">(</span><em class="sig-param">item</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.audio.Playlist.add" title="Permalink to this definition"></a></dt>
<dd><p>Add a new <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a> to the PlayMode.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>item</strong> The item to add to the PlayMode.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.Playlist.delete">
<code class="sig-name descname">delete</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.audio.Playlist.delete" title="Permalink to this definition"></a></dt>
<dd><p>Delete all <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a> contained inside this PlayMode.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.Playlist.queue_preview">
<code class="sig-name descname">queue_preview</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; List[royalnet.audio.royalpcmaudio.RoyalPCMAudio]<a class="headerlink" href="#royalnet.audio.Playlist.queue_preview" title="Permalink to this definition"></a></dt>
<dd><p>Display all the videos in the PlayMode as a list, if possible.</p>
<p>To be used with <cite>queue</cite> commands, for example.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.7/library/exceptions.html#NotImplementedError" title="(in Python v3.7)"><strong>NotImplementedError</strong></a> If a preview cant be generated.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A list of videos contained in the queue.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.Playlist.videos_left">
<code class="sig-name descname">videos_left</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Union[int, float]<a class="headerlink" href="#royalnet.audio.Playlist.videos_left" title="Permalink to this definition"></a></dt>
<dd><p>Return the number of videos left in the PlayMode.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Usually a <a class="reference external" href="https://docs.python.org/3.7/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, but may return also <a class="reference external" href="https://docs.python.org/3.7/library/math.html#math.inf" title="(in Python v3.7)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">math.inf</span></code></a> if the PlayMode is infinite.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.audio.Pool">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.audio.</code><code class="sig-name descname">Pool</code><span class="sig-paren">(</span><em class="sig-param">starting_pool: List[royalnet.audio.royalpcmaudio.RoyalPCMAudio] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.Pool" title="Permalink to this definition"></a></dt>
<dd><p>A <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a> pool. <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a> are selected in random order and are not repeated until every song has been played at least once.</p>
<dl class="method">
<dt id="royalnet.audio.Pool.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">starting_pool: List[royalnet.audio.royalpcmaudio.RoyalPCMAudio] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.Pool.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Create a new Pool.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>starting_pool</strong> A list of items the Pool will be created from.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.Pool._generate_generator">
<code class="sig-name descname">_generate_generator</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.Pool._generate_generator" title="Permalink to this definition"></a></dt>
<dd><p>Factory function for an async generator that changes the <code class="docutils literal notranslate"><span class="pre">now_playing</span></code> property either to a <code class="xref py py-class docutils literal notranslate"><span class="pre">discord.audio.RoyalPCMAudio</span></code> or to <code class="docutils literal notranslate"><span class="pre">None</span></code>, then yields the value it changed it to.</p>
<dl class="field-list simple">
<dt class="field-odd">Yields</dt>
<dd class="field-odd"><p>The <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a> to be played next.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.Pool.add">
<code class="sig-name descname">add</code><span class="sig-paren">(</span><em class="sig-param">item</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.audio.Pool.add" title="Permalink to this definition"></a></dt>
<dd><p>Add a new <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a> to the PlayMode.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>item</strong> The item to add to the PlayMode.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.Pool.delete">
<code class="sig-name descname">delete</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.audio.Pool.delete" title="Permalink to this definition"></a></dt>
<dd><p>Delete all <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio" title="royalnet.audio.RoyalPCMAudio"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio</span></code></a> contained inside this PlayMode.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.Pool.queue_preview">
<code class="sig-name descname">queue_preview</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; List[royalnet.audio.royalpcmaudio.RoyalPCMAudio]<a class="headerlink" href="#royalnet.audio.Pool.queue_preview" title="Permalink to this definition"></a></dt>
<dd><p>Display all the videos in the PlayMode as a list, if possible.</p>
<p>To be used with <cite>queue</cite> commands, for example.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.7/library/exceptions.html#NotImplementedError" title="(in Python v3.7)"><strong>NotImplementedError</strong></a> If a preview cant be generated.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A list of videos contained in the queue.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.Pool.videos_left">
<code class="sig-name descname">videos_left</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Union[int, float]<a class="headerlink" href="#royalnet.audio.Pool.videos_left" title="Permalink to this definition"></a></dt>
<dd><p>Return the number of videos left in the PlayMode.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Usually a <a class="reference external" href="https://docs.python.org/3.7/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, but may return also <a class="reference external" href="https://docs.python.org/3.7/library/math.html#math.inf" title="(in Python v3.7)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">math.inf</span></code></a> if the PlayMode is infinite.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.audio.YtdlFile">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.audio.</code><code class="sig-name descname">YtdlFile</code><span class="sig-paren">(</span><em class="sig-param">info: royalnet.audio.youtubedl.YtdlInfo</em>, <em class="sig-param">outtmpl='%(title)s-%(id)s.%(ext)s'</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlFile" title="Permalink to this definition"></a></dt>
<dd><p>A wrapper around a youtube_dl downloaded file.</p>
<dl class="method">
<dt id="royalnet.audio.YtdlFile._stop_download">
<code class="sig-name descname">_stop_download</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlFile._stop_download" title="Permalink to this definition"></a></dt>
<dd><p>I have no clue of what this does, or why is it here. Possibly remove it?</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>InterruptDownload</strong> …uhhh, always?</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlFile.create_from_url">
<em class="property">static </em><code class="sig-name descname">create_from_url</code><span class="sig-paren">(</span><em class="sig-param">url</em>, <em class="sig-param">outtmpl='%(title)s-%(id)s.%(ext)s'</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.audio.youtubedl.YtdlFile]<a class="headerlink" href="#royalnet.audio.YtdlFile.create_from_url" title="Permalink to this definition"></a></dt>
<dd><p>Download the videos at the specified url.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>url</strong> The url to download the videos from.</p></li>
<li><p><strong>outtmpl</strong> The filename that the downloaded videos are going to have. The name can be formatted according to the <a class="reference external" href="https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template">outtmpl documentation</a>.</p></li>
<li><p><strong>ytdl_args</strong> Other arguments to be passed to the YoutubeDL object.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><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> of YtdlFiles.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlFile.delete_video_file">
<code class="sig-name descname">delete_video_file</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlFile.delete_video_file" title="Permalink to this definition"></a></dt>
<dd><p>Delete the file located at <code class="docutils literal notranslate"><span class="pre">self.video_filename</span></code>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>No checks are done when deleting, so it may try to delete a non-existing file and raise an exception or do some other weird stuff with weird filenames.</p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.audio.YtdlFile.ytdl_args">
<code class="sig-name descname">ytdl_args</code><em class="property"> = {'logger': &lt;Logger royalnet.audio.youtubedl (WARNING)&gt;, 'no_warnings': True, 'noplaylist': True, 'quiet': True}</em><a class="headerlink" href="#royalnet.audio.YtdlFile.ytdl_args" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.audio.YtdlInfo">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.audio.</code><code class="sig-name descname">YtdlInfo</code><span class="sig-paren">(</span><em class="sig-param">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="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">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.create_from_url" title="royalnet.audio.YtdlInfo.create_from_url"><code class="xref py py-func docutils literal notranslate"><span class="pre">royalnet.audio.YtdlInfo.create_from_url()</span></code></a>.</p>
</div>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlInfo.create_from_url">
<em class="property">static </em><code class="sig-name descname">create_from_url</code><span class="sig-paren">(</span><em class="sig-param">url</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.audio.youtubedl.YtdlInfo]<a class="headerlink" href="#royalnet.audio.YtdlInfo.create_from_url" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlInfo.download">
<code class="sig-name descname">download</code><span class="sig-paren">(</span><em class="sig-param">outtmpl='%(title)s-%(id)s.%(ext)s'</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span> &#x2192; royalnet.audio.youtubedl.YtdlFile<a class="headerlink" href="#royalnet.audio.YtdlInfo.download" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.audio.YtdlInfo.to_discord_embed">
<code class="sig-name 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></dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.audio.RoyalPCMFile">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.audio.</code><code class="sig-name descname">RoyalPCMFile</code><span class="sig-paren">(</span><em class="sig-param">info: royalnet.audio.youtubedl.YtdlInfo</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.RoyalPCMFile" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.audio.RoyalPCMFile.audio_filename">
<em class="property">property </em><code class="sig-name descname">audio_filename</code><a class="headerlink" href="#royalnet.audio.RoyalPCMFile.audio_filename" title="Permalink to this definition"></a></dt>
<dd><p>Returns:
The name of the downloaded and PCM-converted audio file.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.RoyalPCMFile.create_from_url">
<em class="property">static </em><code class="sig-name descname">create_from_url</code><span class="sig-paren">(</span><em class="sig-param">url: str</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.audio.royalpcmfile.RoyalPCMFile]<a class="headerlink" href="#royalnet.audio.RoyalPCMFile.create_from_url" title="Permalink to this definition"></a></dt>
<dd><p>Download a file with youtube_dl and create a list of <code class="xref py py-class docutils literal notranslate"><span class="pre">discord.audio.RoyalPCMFile</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>url</strong> The url of the file to download.</p></li>
<li><p><strong>ytdl_args</strong> Extra arguments to be passed to YoutubeDL while downloading.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><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> of RoyalPCMAudios, each corresponding to a downloaded video.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.RoyalPCMFile.create_from_ytsearch">
<em class="property">static </em><code class="sig-name descname">create_from_ytsearch</code><span class="sig-paren">(</span><em class="sig-param">search: str</em>, <em class="sig-param">amount: int = 1</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.audio.royalpcmfile.RoyalPCMFile]<a class="headerlink" href="#royalnet.audio.RoyalPCMFile.create_from_ytsearch" title="Permalink to this definition"></a></dt>
<dd><p>Search a string on YouTube and download the first <code class="docutils literal notranslate"><span class="pre">amount</span></code> number of videos, then download those with youtube_dl and create a list of <code class="xref py py-class docutils literal notranslate"><span class="pre">discord.audio.RoyalPCMFile</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>search</strong> The string to search on YouTube.</p></li>
<li><p><strong>amount</strong> The number of videos to download.</p></li>
<li><p><strong>ytdl_args</strong> Extra arguments to be passed to YoutubeDL while downloading.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><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> of RoyalPCMFiles, each corresponding to a downloaded video.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.RoyalPCMFile.delete_audio_file">
<code class="sig-name descname">delete_audio_file</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.RoyalPCMFile.delete_audio_file" title="Permalink to this definition"></a></dt>
<dd><p>Delete the PCM-converted audio file.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.audio.RoyalPCMFile.ytdl_args">
<code class="sig-name descname">ytdl_args</code><em class="property"> = {'format': 'bestaudio'}</em><a class="headerlink" href="#royalnet.audio.RoyalPCMFile.ytdl_args" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.audio.RoyalPCMFile.ytdl_filename">
<em class="property">property </em><code class="sig-name descname">ytdl_filename</code><a class="headerlink" href="#royalnet.audio.RoyalPCMFile.ytdl_filename" title="Permalink to this definition"></a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The name of the downloaded video file, as a <a class="reference external" href="https://docs.python.org/3.7/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>.</p>
</dd>
</dl>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Its going to be deleted as soon as the <code class="xref py py-func docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMFile.__init__()</span></code> function has completed, so its probably not going to be very useful…</p>
</div>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.audio.RoyalPCMAudio">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.audio.</code><code class="sig-name descname">RoyalPCMAudio</code><span class="sig-paren">(</span><em class="sig-param">rpf: royalnet.audio.royalpcmfile.RoyalPCMFile</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.RoyalPCMAudio" 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.2.3)"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.AudioSource</span></code></a> that keeps data in a file instead of in memory.</p>
<dl class="method">
<dt id="royalnet.audio.RoyalPCMAudio.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">rpf: royalnet.audio.royalpcmfile.RoyalPCMFile</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.RoyalPCMAudio.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Create a <code class="xref py py-class docutils literal notranslate"><span class="pre">discord.audio.RoyalPCMAudio</span></code> from a <a class="reference internal" href="#royalnet.audio.RoyalPCMFile" title="royalnet.audio.RoyalPCMFile"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMFile</span></code></a>.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Not recommended, use <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio.create_from_url" title="royalnet.audio.RoyalPCMAudio.create_from_url"><code class="xref py py-func docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio.create_from_url()</span></code></a> or <a class="reference internal" href="#royalnet.audio.RoyalPCMAudio.create_from_ytsearch" title="royalnet.audio.RoyalPCMAudio.create_from_ytsearch"><code class="xref py py-func docutils literal notranslate"><span class="pre">royalnet.audio.RoyalPCMAudio.create_from_ytsearch()</span></code></a> instead.</p>
</div>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.RoyalPCMAudio.create_from_url">
<em class="property">static </em><code class="sig-name descname">create_from_url</code><span class="sig-paren">(</span><em class="sig-param">url: str</em><span class="sig-paren">)</span> &#x2192; List[royalnet.audio.royalpcmaudio.RoyalPCMAudio]<a class="headerlink" href="#royalnet.audio.RoyalPCMAudio.create_from_url" title="Permalink to this definition"></a></dt>
<dd><p>Download a file with youtube_dl and create a list of RoyalPCMAudios.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>url</strong> The url of the file to download.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><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> of RoyalPCMAudios, each corresponding to a downloaded video.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.RoyalPCMAudio.create_from_ytsearch">
<em class="property">static </em><code class="sig-name descname">create_from_ytsearch</code><span class="sig-paren">(</span><em class="sig-param">search: str</em>, <em class="sig-param">amount: int = 1</em><span class="sig-paren">)</span> &#x2192; List[royalnet.audio.royalpcmaudio.RoyalPCMAudio]<a class="headerlink" href="#royalnet.audio.RoyalPCMAudio.create_from_ytsearch" title="Permalink to this definition"></a></dt>
<dd><p>Search a string on YouTube and download the first <code class="docutils literal notranslate"><span class="pre">amount</span></code> number of videos, then download those with youtube_dl and create a list of RoyalPCMAudios.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>search</strong> The string to search on YouTube.</p></li>
<li><p><strong>amount</strong> The number of videos to download.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><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> of RoyalPCMAudios, each corresponding to a downloaded video.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.RoyalPCMAudio.delete">
<code class="sig-name descname">delete</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.RoyalPCMAudio.delete" title="Permalink to this definition"></a></dt>
<dd><p>Permanently delete the downloaded file.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.audio.RoyalPCMAudio.is_opus">
<code class="sig-name descname">is_opus</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.RoyalPCMAudio.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.RoyalPCMAudio.read">
<code class="sig-name descname">read</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.RoyalPCMAudio.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>
</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>