audio: rename from youtubedl
This commit is contained in:
parent
9a58bc964d
commit
af0896a6a0
@ -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)
|
||||
|
@ -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(
|
||||
|
@ -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",
|
||||
]
|
||||
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user