audio: rename from youtubedl
This commit is contained in:
		@@ -4,9 +4,9 @@ import disnake
 | 
				
			|||||||
import disnake_paginator
 | 
					import disnake_paginator
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import arguments
 | 
					import arguments
 | 
				
			||||||
 | 
					import audio
 | 
				
			||||||
import commands
 | 
					import commands
 | 
				
			||||||
import utils
 | 
					import utils
 | 
				
			||||||
import youtubedl
 | 
					 | 
				
			||||||
from constants import EMBED_COLOR
 | 
					from constants import EMBED_COLOR
 | 
				
			||||||
from state import client, players
 | 
					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):
 | 
					async def queue_or_play(message, edited=False):
 | 
				
			||||||
    if message.guild.id not in players:
 | 
					    if message.guild.id not in players:
 | 
				
			||||||
        players[message.guild.id] = youtubedl.QueuedPlayer()
 | 
					        players[message.guild.id] = audio.QueuedPlayer()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    tokens = commands.tokenize(message.content)
 | 
					    tokens = commands.tokenize(message.content)
 | 
				
			||||||
    parser = arguments.ArgumentParser(
 | 
					    parser = arguments.ArgumentParser(
 | 
				
			||||||
@@ -154,7 +154,7 @@ async def queue_or_play(message, edited=False):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            async with message.channel.typing():
 | 
					            async with message.channel.typing():
 | 
				
			||||||
                player = await youtubedl.YTDLSource.from_url(
 | 
					                player = await audio.YTDLSource.from_url(
 | 
				
			||||||
                    " ".join(query), loop=client.loop, stream=True
 | 
					                    " ".join(query), loop=client.loop, stream=True
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
                player.volume = float(args.volume) / 100.0
 | 
					                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}`")
 | 
					            await utils.reply(message, f"**failed to queue:** `{e}`")
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        queued = youtubedl.QueuedSong(player, message)
 | 
					        queued = audio.QueuedSong(player, message)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if args.now or args.next:
 | 
					        if args.now or args.next:
 | 
				
			||||||
            players[message.guild.id].queue_add_front(queued)
 | 
					            players[message.guild.id].queue_add_front(queued)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,8 @@
 | 
				
			|||||||
import disnake
 | 
					import disnake
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import audio
 | 
				
			||||||
import sponsorblock
 | 
					import sponsorblock
 | 
				
			||||||
import utils
 | 
					import utils
 | 
				
			||||||
import youtubedl
 | 
					 | 
				
			||||||
from constants import EMBED_COLOR
 | 
					from constants import EMBED_COLOR
 | 
				
			||||||
from state import players
 | 
					from state import players
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -32,7 +32,7 @@ async def sponsorblock_command(message):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        current = "**" if progress >= begin and progress < end else ""
 | 
					        current = "**" if progress >= begin and progress < end else ""
 | 
				
			||||||
        text.append(
 | 
					        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(
 | 
					    await utils.reply(
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,6 +21,7 @@ OWNERS = [531392146767347712]
 | 
				
			|||||||
PREFIX = "%"
 | 
					PREFIX = "%"
 | 
				
			||||||
RELOADABLE_MODULES = [
 | 
					RELOADABLE_MODULES = [
 | 
				
			||||||
    "arguments",
 | 
					    "arguments",
 | 
				
			||||||
 | 
					    "audio",
 | 
				
			||||||
    "commands",
 | 
					    "commands",
 | 
				
			||||||
    "commands.bot",
 | 
					    "commands.bot",
 | 
				
			||||||
    "commands.tools",
 | 
					    "commands.tools",
 | 
				
			||||||
@@ -41,7 +42,6 @@ RELOADABLE_MODULES = [
 | 
				
			|||||||
    "tasks",
 | 
					    "tasks",
 | 
				
			||||||
    "utils",
 | 
					    "utils",
 | 
				
			||||||
    "voice",
 | 
					    "voice",
 | 
				
			||||||
    "youtubedl",
 | 
					 | 
				
			||||||
    "yt_dlp",
 | 
					    "yt_dlp",
 | 
				
			||||||
    "yt_dlp.version",
 | 
					    "yt_dlp.version",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,13 +1,13 @@
 | 
				
			|||||||
import unittest
 | 
					import unittest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import audio
 | 
				
			||||||
import utils
 | 
					import utils
 | 
				
			||||||
import youtubedl
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestFormatDuration(unittest.TestCase):
 | 
					class TestFormatDuration(unittest.TestCase):
 | 
				
			||||||
    def test_youtubedl(self):
 | 
					    def test_audio(self):
 | 
				
			||||||
        def f(s):
 | 
					        def f(s):
 | 
				
			||||||
            return youtubedl.format_duration(s)
 | 
					            return audio.format_duration(s)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.assertEqual(f(0), "00:00")
 | 
					        self.assertEqual(f(0), "00:00")
 | 
				
			||||||
        self.assertEqual(f(0.5), "00:00")
 | 
					        self.assertEqual(f(0.5), "00:00")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user