[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
590f292275
commit
ef3b8f4b1d
|
|
@ -315,7 +315,7 @@ class Music(commands.Cog):
|
||||||
player.loop_mode = pomice.LoopMode.QUEUE
|
player.loop_mode = pomice.LoopMode.QUEUE
|
||||||
else:
|
else:
|
||||||
player.loop_mode = None
|
player.loop_mode = None
|
||||||
|
|
||||||
await ctx.send(f"Loop mode set to **{mode}**")
|
await ctx.send(f"Loop mode set to **{mode}**")
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
|
|
@ -324,7 +324,7 @@ class Music(commands.Cog):
|
||||||
player: Player = ctx.voice_client
|
player: Player = ctx.voice_client
|
||||||
if not player:
|
if not player:
|
||||||
return
|
return
|
||||||
|
|
||||||
player.autoplay = not player.autoplay
|
player.autoplay = not player.autoplay
|
||||||
await ctx.send(f"Autoplay is now **{'on' if player.autoplay else 'off'}**")
|
await ctx.send(f"Autoplay is now **{'on' if player.autoplay else 'off'}**")
|
||||||
|
|
||||||
|
|
@ -333,8 +333,8 @@ class Music(commands.Cog):
|
||||||
"""Moves a track's position in the queue (e.g., !move 5 1)."""
|
"""Moves a track's position in the queue (e.g., !move 5 1)."""
|
||||||
player: Player = ctx.voice_client
|
player: Player = ctx.voice_client
|
||||||
if not player or player.queue.is_empty:
|
if not player or player.queue.is_empty:
|
||||||
return await ctx.send("The queue is empty.")
|
return await ctx.send("The queue is empty.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
player.queue.move(from_index - 1, to_index - 1)
|
player.queue.move(from_index - 1, to_index - 1)
|
||||||
await ctx.send(f"Moved track from #{from_index} to #{to_index}.")
|
await ctx.send(f"Moved track from #{from_index} to #{to_index}.")
|
||||||
|
|
@ -347,7 +347,7 @@ class Music(commands.Cog):
|
||||||
player: Player = ctx.voice_client
|
player: Player = ctx.voice_client
|
||||||
if not player:
|
if not player:
|
||||||
return
|
return
|
||||||
|
|
||||||
removed = player.queue.remove_duplicates()
|
removed = player.queue.remove_duplicates()
|
||||||
await ctx.send(f"All cleaned up! Removed **{removed}** duplicate tracks.")
|
await ctx.send(f"All cleaned up! Removed **{removed}** duplicate tracks.")
|
||||||
|
|
||||||
|
|
@ -360,7 +360,7 @@ class Music(commands.Cog):
|
||||||
|
|
||||||
preset = preset.lower()
|
preset = preset.lower()
|
||||||
await player.reset_filters()
|
await player.reset_filters()
|
||||||
|
|
||||||
if preset == "off":
|
if preset == "off":
|
||||||
return await ctx.send("Filters cleared.")
|
return await ctx.send("Filters cleared.")
|
||||||
|
|
||||||
|
|
@ -371,7 +371,7 @@ class Music(commands.Cog):
|
||||||
"boost": pomice.Equalizer.boost(),
|
"boost": pomice.Equalizer.boost(),
|
||||||
"nightcore": pomice.Timescale.nightcore(),
|
"nightcore": pomice.Timescale.nightcore(),
|
||||||
"vaporwave": pomice.Timescale.vaporwave(),
|
"vaporwave": pomice.Timescale.vaporwave(),
|
||||||
"bass": pomice.Equalizer.bass_boost_light()
|
"bass": pomice.Equalizer.bass_boost_light(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if preset not in presets:
|
if preset not in presets:
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,9 @@ class IntegratedMusic(commands.Cog):
|
||||||
return await ctx.send("Queue is empty.")
|
return await ctx.send("Queue is empty.")
|
||||||
|
|
||||||
pomice.PlaylistManager.export_queue(
|
pomice.PlaylistManager.export_queue(
|
||||||
player.queue, f"playlists/{filename}", name=f"{ctx.guild.name}'s Playlist",
|
player.queue,
|
||||||
|
f"playlists/{filename}",
|
||||||
|
name=f"{ctx.guild.name}'s Playlist",
|
||||||
)
|
)
|
||||||
await ctx.send(f"✅ Queue exported to `playlists/{filename}`")
|
await ctx.send(f"✅ Queue exported to `playlists/{filename}`")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ class TrackInvalidPosition(PomiceException):
|
||||||
|
|
||||||
class TrackLoadError(PomiceException):
|
class TrackLoadError(PomiceException):
|
||||||
"""There was an error while loading a track."""
|
"""There was an error while loading a track."""
|
||||||
|
|
||||||
def __init__(self, message: str = "Sorry, I ran into trouble trying to load that track."):
|
def __init__(self, message: str = "Sorry, I ran into trouble trying to load that track."):
|
||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
|
|
||||||
|
|
@ -111,13 +112,17 @@ class QueueException(Exception):
|
||||||
|
|
||||||
class QueueFull(QueueException):
|
class QueueFull(QueueException):
|
||||||
"""Exception raised when attempting to add to a full Queue."""
|
"""Exception raised when attempting to add to a full Queue."""
|
||||||
|
|
||||||
def __init__(self, message: str = "Whoops! The queue is completely full right now."):
|
def __init__(self, message: str = "Whoops! The queue is completely full right now."):
|
||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
|
|
||||||
|
|
||||||
class QueueEmpty(QueueException):
|
class QueueEmpty(QueueException):
|
||||||
"""Exception raised when attempting to retrieve from an empty Queue."""
|
"""Exception raised when attempting to retrieve from an empty Queue."""
|
||||||
def __init__(self, message: str = "It looks like the queue is empty. There's no more music to play!"):
|
|
||||||
|
def __init__(
|
||||||
|
self, message: str = "It looks like the queue is empty. There's no more music to play!",
|
||||||
|
):
|
||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,9 +169,21 @@ class Equalizer(Filter):
|
||||||
Perfect for mainstream hits.
|
Perfect for mainstream hits.
|
||||||
"""
|
"""
|
||||||
levels = [
|
levels = [
|
||||||
(0, -0.02), (1, -0.01), (2, 0.08), (3, 0.1), (4, 0.15),
|
(0, -0.02),
|
||||||
(5, 0.1), (6, 0.05), (7, 0.0), (8, 0.0), (9, 0.0),
|
(1, -0.01),
|
||||||
(10, 0.05), (11, 0.1), (12, 0.15), (13, 0.1), (14, 0.05)
|
(2, 0.08),
|
||||||
|
(3, 0.1),
|
||||||
|
(4, 0.15),
|
||||||
|
(5, 0.1),
|
||||||
|
(6, 0.05),
|
||||||
|
(7, 0.0),
|
||||||
|
(8, 0.0),
|
||||||
|
(9, 0.0),
|
||||||
|
(10, 0.05),
|
||||||
|
(11, 0.1),
|
||||||
|
(12, 0.15),
|
||||||
|
(13, 0.1),
|
||||||
|
(14, 0.05),
|
||||||
]
|
]
|
||||||
return cls(tag="pop", levels=levels)
|
return cls(tag="pop", levels=levels)
|
||||||
|
|
||||||
|
|
@ -181,9 +193,21 @@ class Equalizer(Filter):
|
||||||
Ideal for acoustic tracks or when you just want a more relaxed listening experience.
|
Ideal for acoustic tracks or when you just want a more relaxed listening experience.
|
||||||
"""
|
"""
|
||||||
levels = [
|
levels = [
|
||||||
(0, 0.0), (1, 0.0), (2, 0.0), (3, -0.05), (4, -0.1),
|
(0, 0.0),
|
||||||
(5, -0.1), (6, -0.05), (7, 0.0), (8, 0.05), (9, 0.1),
|
(1, 0.0),
|
||||||
(10, 0.1), (11, 0.05), (12, 0.0), (13, 0.0), (14, 0.0)
|
(2, 0.0),
|
||||||
|
(3, -0.05),
|
||||||
|
(4, -0.1),
|
||||||
|
(5, -0.1),
|
||||||
|
(6, -0.05),
|
||||||
|
(7, 0.0),
|
||||||
|
(8, 0.05),
|
||||||
|
(9, 0.1),
|
||||||
|
(10, 0.1),
|
||||||
|
(11, 0.05),
|
||||||
|
(12, 0.0),
|
||||||
|
(13, 0.0),
|
||||||
|
(14, 0.0),
|
||||||
]
|
]
|
||||||
return cls(tag="soft", levels=levels)
|
return cls(tag="soft", levels=levels)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -776,7 +776,7 @@ class Player(VoiceProtocol):
|
||||||
async def do_next(self) -> Optional[Track]:
|
async def do_next(self) -> Optional[Track]:
|
||||||
"""Automatically picks the next track from the queue and plays it.
|
"""Automatically picks the next track from the queue and plays it.
|
||||||
If the queue is empty and autoplay is on, it will search for recommended tracks.
|
If the queue is empty and autoplay is on, it will search for recommended tracks.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
Optional[Track]
|
Optional[Track]
|
||||||
|
|
@ -790,7 +790,7 @@ class Player(VoiceProtocol):
|
||||||
track = recommendations.tracks[0]
|
track = recommendations.tracks[0]
|
||||||
else:
|
else:
|
||||||
track = recommendations[0]
|
track = recommendations[0]
|
||||||
|
|
||||||
await self.play(track)
|
await self.play(track)
|
||||||
return track
|
return track
|
||||||
return None
|
return None
|
||||||
|
|
|
||||||
|
|
@ -348,7 +348,7 @@ class Queue(Iterable[Track]):
|
||||||
|
|
||||||
def move(self, from_index: int, to_index: int) -> None:
|
def move(self, from_index: int, to_index: int) -> None:
|
||||||
"""Moves a track from one spot in the queue to another.
|
"""Moves a track from one spot in the queue to another.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
from_index: int
|
from_index: int
|
||||||
|
|
@ -357,8 +357,8 @@ class Queue(Iterable[Track]):
|
||||||
Where you want to put the track.
|
Where you want to put the track.
|
||||||
"""
|
"""
|
||||||
if from_index == to_index:
|
if from_index == to_index:
|
||||||
return
|
return
|
||||||
|
|
||||||
track = self._queue.pop(from_index)
|
track = self._queue.pop(from_index)
|
||||||
self._queue.insert(to_index, track)
|
self._queue.insert(to_index, track)
|
||||||
|
|
||||||
|
|
@ -369,12 +369,12 @@ class Queue(Iterable[Track]):
|
||||||
initial_count = len(self._queue)
|
initial_count = len(self._queue)
|
||||||
seen_ids = set()
|
seen_ids = set()
|
||||||
unique_queue = []
|
unique_queue = []
|
||||||
|
|
||||||
for track in self._queue:
|
for track in self._queue:
|
||||||
if track.track_id not in seen_ids:
|
if track.track_id not in seen_ids:
|
||||||
unique_queue.append(track)
|
unique_queue.append(track)
|
||||||
seen_ids.add(track.track_id)
|
seen_ids.add(track.track_id)
|
||||||
|
|
||||||
self._queue = unique_queue
|
self._queue = unique_queue
|
||||||
return initial_count - len(self._queue)
|
return initial_count - len(self._queue)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue