<h1>royalnet.audio<aclass="headerlink"href="#royalnet-audio"title="Permalink to this headline">¶</a></h1>
<divclass="toctree-wrapper compound">
</div>
<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.PlayMode">
<emclass="property">class </em><codeclass="descclassname">royalnet.audio.</code><codeclass="descname">PlayMode</code><aclass="headerlink"href="#royalnet.audio.PlayMode"title="Permalink to this definition">¶</a></dt>
<dd><p>The base class for a PlayMode, such as <aclass="reference internal"href="#royalnet.audio.Playlist"title="royalnet.audio.Playlist"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.Playlist</span></code></a>. Inherit from this class if you want to create a custom PlayMode.</p>
<dlclass="method">
<dtid="royalnet.audio.PlayMode.__init__">
<codeclass="descname">__init__</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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>
<codeclass="descname">_generate_generator</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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 <codeclass="docutils literal notranslate"><spanclass="pre">now_playing</span></code> property either to a <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">discord.audio.RoyalPCMAudio</span></code> or to <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, then yields the value it changed it to.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Yields</dt>
<ddclass="field-odd"><p>The <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio</span></code></a> to be played next.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.PlayMode.add">
<codeclass="descname">add</code><spanclass="sig-paren">(</span><em>item: royalnet.audio.royalpcmaudio.RoyalPCMAudio</em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.audio.PlayMode.add"title="Permalink to this definition">¶</a></dt>
<dd><p>Add a new <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio</span></code></a> to the PlayMode.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>item</strong>– The item to add to the PlayMode.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.PlayMode.delete">
<codeclass="descname">delete</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.audio.PlayMode.delete"title="Permalink to this definition">¶</a></dt>
<dd><p>Delete all <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio</span></code></a> contained inside this PlayMode.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.PlayMode.next">
<codeclass="descname">next</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ Optional[royalnet.audio.royalpcmaudio.RoyalPCMAudio]<aclass="headerlink"href="#royalnet.audio.PlayMode.next"title="Permalink to this definition">¶</a></dt>
<dd><p>Get the next <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio</span></code></a> from the list and advance it.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The next <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio</span></code></a>.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.PlayMode.videos_left">
<codeclass="descname">videos_left</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ Union[int, float]<aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>Usually a <aclass="reference external"href="https://docs.python.org/3.7/library/functions.html#int"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">int</span></code></a>, but may return also <aclass="reference external"href="https://docs.python.org/3.7/library/math.html#math.inf"title="(in Python v3.7)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">math.inf</span></code></a> if the PlayMode is infinite.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.audio.Playlist">
<emclass="property">class </em><codeclass="descclassname">royalnet.audio.</code><codeclass="descname">Playlist</code><spanclass="sig-paren">(</span><em>starting_list: List[royalnet.audio.royalpcmaudio.RoyalPCMAudio] = None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.Playlist"title="Permalink to this definition">¶</a></dt>
<dd><p>A video list. <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio</span></code></a> played are removed from the list.</p>
<dlclass="method">
<dtid="royalnet.audio.Playlist.__init__">
<codeclass="descname">__init__</code><spanclass="sig-paren">(</span><em>starting_list: List[royalnet.audio.royalpcmaudio.RoyalPCMAudio] = None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.Playlist.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new Playlist.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>starting_list</strong>– A list of items with which the Playlist will be created.</p>
<codeclass="descname">_generate_generator</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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 <codeclass="docutils literal notranslate"><spanclass="pre">now_playing</span></code> property either to a <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">discord.audio.RoyalPCMAudio</span></code> or to <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, then yields the value it changed it to.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Yields</dt>
<ddclass="field-odd"><p>The <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio</span></code></a> to be played next.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.Playlist.add">
<codeclass="descname">add</code><spanclass="sig-paren">(</span><em>item</em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.audio.Playlist.add"title="Permalink to this definition">¶</a></dt>
<dd><p>Add a new <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio</span></code></a> to the PlayMode.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>item</strong>– The item to add to the PlayMode.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.Playlist.delete">
<codeclass="descname">delete</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.audio.Playlist.delete"title="Permalink to this definition">¶</a></dt>
<dd><p>Delete all <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio</span></code></a> contained inside this PlayMode.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.Playlist.videos_left">
<codeclass="descname">videos_left</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ Union[int, float]<aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>Usually a <aclass="reference external"href="https://docs.python.org/3.7/library/functions.html#int"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">int</span></code></a>, but may return also <aclass="reference external"href="https://docs.python.org/3.7/library/math.html#math.inf"title="(in Python v3.7)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">math.inf</span></code></a> if the PlayMode is infinite.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.audio.Pool">
<emclass="property">class </em><codeclass="descclassname">royalnet.audio.</code><codeclass="descname">Pool</code><spanclass="sig-paren">(</span><em>starting_pool: List[royalnet.audio.royalpcmaudio.RoyalPCMAudio] = None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.Pool"title="Permalink to this definition">¶</a></dt>
<dd><p>A <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio</span></code></a> pool. <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="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>
<dlclass="method">
<dtid="royalnet.audio.Pool.__init__">
<codeclass="descname">__init__</code><spanclass="sig-paren">(</span><em>starting_pool: List[royalnet.audio.royalpcmaudio.RoyalPCMAudio] = None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.Pool.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new Pool.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>starting_pool</strong>– A list of items the Pool will be created from.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.Pool._generate_generator">
<codeclass="descname">_generate_generator</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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 <codeclass="docutils literal notranslate"><spanclass="pre">now_playing</span></code> property either to a <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">discord.audio.RoyalPCMAudio</span></code> or to <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, then yields the value it changed it to.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Yields</dt>
<ddclass="field-odd"><p>The <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio</span></code></a> to be played next.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.Pool.add">
<codeclass="descname">add</code><spanclass="sig-paren">(</span><em>item</em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.audio.Pool.add"title="Permalink to this definition">¶</a></dt>
<dd><p>Add a new <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio</span></code></a> to the PlayMode.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>item</strong>– The item to add to the PlayMode.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.Pool.delete">
<codeclass="descname">delete</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.audio.Pool.delete"title="Permalink to this definition">¶</a></dt>
<dd><p>Delete all <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio"title="royalnet.audio.RoyalPCMAudio"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio</span></code></a> contained inside this PlayMode.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.Pool.videos_left">
<codeclass="descname">videos_left</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ Union[int, float]<aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>Usually a <aclass="reference external"href="https://docs.python.org/3.7/library/functions.html#int"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">int</span></code></a>, but may return also <aclass="reference external"href="https://docs.python.org/3.7/library/math.html#math.inf"title="(in Python v3.7)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">math.inf</span></code></a> if the PlayMode is infinite.</p>
</dd>
</dl>
</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>info: royalnet.audio.youtubedl.YtdlInfo</em>, <em>outtmpl='%(title)s-%(id)s.%(ext)s'</em>, <em>**ytdl_args</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.YtdlFile"title="Permalink to this definition">¶</a></dt>
<dd><p>A wrapper around a youtube_dl downloaded file.</p>
<dlclass="method">
<dtid="royalnet.audio.YtdlFile._stop_download">
<codeclass="descname">_stop_download</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.YtdlFile._stop_download"title="Permalink to this definition">¶</a></dt>
<emclass="property">static </em><codeclass="descname">create_from_url</code><spanclass="sig-paren">(</span><em>url</em>, <em>outtmpl='%(title)s-%(id)s.%(ext)s'</em>, <em>**ytdl_args</em><spanclass="sig-paren">)</span>→ List[royalnet.audio.youtubedl.YtdlFile]<aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="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 <aclass="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>
<codeclass="descname">delete_video_file</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.YtdlFile.delete_video_file"title="Permalink to this definition">¶</a></dt>
<dd><p>Delete the file located at <codeclass="docutils literal notranslate"><spanclass="pre">self.video_filename</span></code>.</p>
<divclass="admonition note">
<pclass="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>
<codeclass="descname">ytdl_args</code><emclass="property"> = {'logger': <Logger royalnet.audio.youtubedl (WARNING)>, 'no_warnings': True, 'noplaylist': True, 'quiet': True}</em><aclass="headerlink"href="#royalnet.audio.YtdlFile.ytdl_args"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<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.create_from_url"title="royalnet.audio.YtdlInfo.create_from_url"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">royalnet.audio.YtdlInfo.create_from_url()</span></code></a>.</p>
</div>
</dd></dl>
<dlclass="staticmethod">
<dtid="royalnet.audio.YtdlInfo.create_from_url">
<emclass="property">static </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.youtubedl.YtdlInfo]<aclass="headerlink"href="#royalnet.audio.YtdlInfo.create_from_url"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.audio.YtdlInfo.download">
<codeclass="descname">download</code><spanclass="sig-paren">(</span><em>outtmpl='%(title)s-%(id)s.%(ext)s'</em>, <em>**ytdl_args</em><spanclass="sig-paren">)</span>→ royalnet.audio.youtubedl.YtdlFile<aclass="headerlink"href="#royalnet.audio.YtdlInfo.download"title="Permalink to this definition">¶</a></dt>
<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>
<emclass="property">class </em><codeclass="descclassname">royalnet.audio.</code><codeclass="descname">RoyalPCMFile</code><spanclass="sig-paren">(</span><em>info: royalnet.audio.youtubedl.YtdlInfo</em>, <em>**ytdl_args</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.RoyalPCMFile"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">audio_filename</code><aclass="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>
<emclass="property">static </em><codeclass="descname">create_from_url</code><spanclass="sig-paren">(</span><em>url: str</em>, <em>**ytdl_args</em><spanclass="sig-paren">)</span>→ List[royalnet.audio.royalpcmfile.RoyalPCMFile]<aclass="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 <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">discord.audio.RoyalPCMFile</span></code>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="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>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><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> of RoyalPCMAudios, each corresponding to a downloaded video.</p>
<emclass="property">static </em><codeclass="descname">create_from_ytsearch</code><spanclass="sig-paren">(</span><em>search: str</em>, <em>amount: int = 1</em>, <em>**ytdl_args</em><spanclass="sig-paren">)</span>→ List[royalnet.audio.royalpcmfile.RoyalPCMFile]<aclass="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 <codeclass="docutils literal notranslate"><spanclass="pre">amount</span></code> number of videos, then download those with youtube_dl and create a list of <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">discord.audio.RoyalPCMFile</span></code>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="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>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><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> of RoyalPCMFiles, each corresponding to a downloaded video.</p>
<codeclass="descname">delete_audio_file</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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>
<dlclass="attribute">
<dtid="royalnet.audio.RoyalPCMFile.ytdl_args">
<codeclass="descname">ytdl_args</code><emclass="property"> = {'format': 'bestaudio'}</em><aclass="headerlink"href="#royalnet.audio.RoyalPCMFile.ytdl_args"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">ytdl_filename</code><aclass="headerlink"href="#royalnet.audio.RoyalPCMFile.ytdl_filename"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The name of the downloaded video file, as a <aclass="reference external"href="https://docs.python.org/3.7/library/stdtypes.html#str"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code></a>.</p>
</dd>
</dl>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>It’s going to be deleted as soon as the <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMFile.__init__()</span></code> function has completed, so it’s probably not going to be very useful…</p>
</div>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.audio.RoyalPCMAudio">
<emclass="property">class </em><codeclass="descclassname">royalnet.audio.</code><codeclass="descname">RoyalPCMAudio</code><spanclass="sig-paren">(</span><em>rpf: royalnet.audio.royalpcmfile.RoyalPCMFile</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.RoyalPCMAudio"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.2.0a)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">discord.AudioSource</span></code></a> that keeps data in a file instead of in memory.</p>
<codeclass="descname">__init__</code><spanclass="sig-paren">(</span><em>rpf: royalnet.audio.royalpcmfile.RoyalPCMFile</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.RoyalPCMAudio.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">discord.audio.RoyalPCMAudio</span></code> from a <aclass="reference internal"href="#royalnet.audio.RoyalPCMFile"title="royalnet.audio.RoyalPCMFile"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMFile</span></code></a>.</p>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>Not recommended, use <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio.create_from_url"title="royalnet.audio.RoyalPCMAudio.create_from_url"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio.create_from_url()</span></code></a> or <aclass="reference internal"href="#royalnet.audio.RoyalPCMAudio.create_from_ytsearch"title="royalnet.audio.RoyalPCMAudio.create_from_ytsearch"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">royalnet.audio.RoyalPCMAudio.create_from_ytsearch()</span></code></a> instead.</p>
<emclass="property">static </em><codeclass="descname">create_from_url</code><spanclass="sig-paren">(</span><em>url: str</em><spanclass="sig-paren">)</span>→ List[royalnet.audio.royalpcmaudio.RoyalPCMAudio]<aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>url</strong>– The url of the file to download.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><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> of RoyalPCMAudios, each corresponding to a downloaded video.</p>
<emclass="property">static </em><codeclass="descname">create_from_ytsearch</code><spanclass="sig-paren">(</span><em>search: str</em>, <em>amount: int = 1</em><spanclass="sig-paren">)</span>→ List[royalnet.audio.royalpcmaudio.RoyalPCMAudio]<aclass="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 <codeclass="docutils literal notranslate"><spanclass="pre">amount</span></code> number of videos, then download those with youtube_dl and create a list of RoyalPCMAudios.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="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>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><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> of RoyalPCMAudios, each corresponding to a downloaded video.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.RoyalPCMAudio.delete">
<codeclass="descname">delete</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.RoyalPCMAudio.delete"title="Permalink to this definition">¶</a></dt>
<dd><p>Permanently delete the downloaded file.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.audio.RoyalPCMAudio.is_opus">
<codeclass="descname">is_opus</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.RoyalPCMAudio.is_opus"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">read</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.audio.RoyalPCMAudio.read"title="Permalink to this definition">¶</a></dt>
<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>
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>.