diff --git a/youtubedl.py b/audio.py similarity index 100% rename from youtubedl.py rename to audio.py diff --git a/commands/voice/queue.py b/commands/voice/queue.py index e62516d..9519ce9 100644 --- a/commands/voice/queue.py +++ b/commands/voice/queue.py @@ -4,9 +4,9 @@ import disnake import disnake_paginator import arguments +import audio import commands import utils -import youtubedl from constants import EMBED_COLOR from state import client, players @@ -16,7 +16,7 @@ from .utils import command_allowed, ensure_joined, play_next async def queue_or_play(message, edited=False): if message.guild.id not in players: - players[message.guild.id] = youtubedl.QueuedPlayer() + players[message.guild.id] = audio.QueuedPlayer() tokens = commands.tokenize(message.content) parser = arguments.ArgumentParser( @@ -154,7 +154,7 @@ async def queue_or_play(message, edited=False): try: async with message.channel.typing(): - player = await youtubedl.YTDLSource.from_url( + player = await audio.YTDLSource.from_url( " ".join(query), loop=client.loop, stream=True ) player.volume = float(args.volume) / 100.0 @@ -162,7 +162,7 @@ async def queue_or_play(message, edited=False): await utils.reply(message, f"**failed to queue:** `{e}`") return - queued = youtubedl.QueuedSong(player, message) + queued = audio.QueuedSong(player, message) if args.now or args.next: players[message.guild.id].queue_add_front(queued) diff --git a/commands/voice/sponsorblock.py b/commands/voice/sponsorblock.py index 3589296..2477806 100644 --- a/commands/voice/sponsorblock.py +++ b/commands/voice/sponsorblock.py @@ -1,8 +1,8 @@ import disnake +import audio import sponsorblock import utils -import youtubedl from constants import EMBED_COLOR from state import players @@ -32,7 +32,7 @@ async def sponsorblock_command(message): current = "**" if progress >= begin and progress < end else "" text.append( - f"{current}`{youtubedl.format_duration(begin)}` - `{youtubedl.format_duration(end)}`: {category_name if category_name else 'Unknown'}{current}" + f"{current}`{audio.format_duration(begin)}` - `{audio.format_duration(end)}`: {category_name if category_name else 'Unknown'}{current}" ) await utils.reply( diff --git a/constants.py b/constants.py index 0005335..1376a49 100644 --- a/constants.py +++ b/constants.py @@ -21,6 +21,7 @@ OWNERS = [531392146767347712] PREFIX = "%" RELOADABLE_MODULES = [ "arguments", + "audio", "commands", "commands.bot", "commands.tools", @@ -41,7 +42,6 @@ RELOADABLE_MODULES = [ "tasks", "utils", "voice", - "youtubedl", "yt_dlp", "yt_dlp.version", ] diff --git a/tests/test_format_duration.py b/tests/test_format_duration.py index f129634..a4d7b6f 100644 --- a/tests/test_format_duration.py +++ b/tests/test_format_duration.py @@ -1,13 +1,13 @@ import unittest +import audio import utils -import youtubedl class TestFormatDuration(unittest.TestCase): - def test_youtubedl(self): + def test_audio(self): def f(s): - return youtubedl.format_duration(s) + return audio.format_duration(s) self.assertEqual(f(0), "00:00") self.assertEqual(f(0.5), "00:00")