mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-07 09:52:30 -05:00
Audio cleanup (#5618)
* add different logging level callbacks for task exception logging * Add callback to tasks which didn't have them * The boring stuff - (apply .trace() and .verbose() to audio, stop using debug_exc_log, delete audio_logging.py) * Unsured import cleanup * use new lavalink method * return so it doesn't log this twice. * improve logging on main event handler
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import asyncio
|
||||
import contextlib
|
||||
import datetime
|
||||
import logging
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import contextlib
|
||||
import datetime
|
||||
import logging
|
||||
import math
|
||||
import time
|
||||
@@ -18,7 +17,6 @@ from redbot.core.utils import AsyncIter
|
||||
from redbot.core.utils.menus import DEFAULT_CONTROLS, close_menu, menu, next_page, prev_page
|
||||
|
||||
from ...audio_dataclasses import _PARTIALLY_SUPPORTED_MUSIC_EXT, Query
|
||||
from ...audio_logging import IS_DEBUG
|
||||
from ...errors import (
|
||||
DatabaseError,
|
||||
QueryUnauthorized,
|
||||
@@ -129,9 +127,9 @@ class PlayerCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
return await self._get_spotify_tracks(ctx, query)
|
||||
try:
|
||||
await self._enqueue_tracks(ctx, query)
|
||||
except QueryUnauthorized as err:
|
||||
except QueryUnauthorized as exc:
|
||||
return await self.send_embed_msg(
|
||||
ctx, title=_("Unable To Play Tracks"), description=err.message
|
||||
ctx, title=_("Unable To Play Tracks"), description=exc.message
|
||||
)
|
||||
except Exception as e:
|
||||
self.update_player_lock(ctx, False)
|
||||
@@ -238,9 +236,9 @@ class PlayerCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
tracks = await self._get_spotify_tracks(ctx, query)
|
||||
else:
|
||||
tracks = await self._enqueue_tracks(ctx, query, enqueue=False)
|
||||
except QueryUnauthorized as err:
|
||||
except QueryUnauthorized as exc:
|
||||
return await self.send_embed_msg(
|
||||
ctx, title=_("Unable To Play Tracks"), description=err.message
|
||||
ctx, title=_("Unable To Play Tracks"), description=exc.message
|
||||
)
|
||||
except Exception as e:
|
||||
self.update_player_lock(ctx, False)
|
||||
@@ -287,8 +285,7 @@ class PlayerCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
f"{single_track.title} {single_track.author} {single_track.uri} {str(query)}",
|
||||
query_obj=query,
|
||||
):
|
||||
if IS_DEBUG:
|
||||
log.debug("Query is not allowed in %r (%d)", ctx.guild.name, ctx.guild.id)
|
||||
log.debug("Query is not allowed in %r (%d)", ctx.guild.name, ctx.guild.id)
|
||||
self.update_player_lock(ctx, False)
|
||||
return await self.send_embed_msg(
|
||||
ctx,
|
||||
@@ -818,10 +815,7 @@ class PlayerCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
f"{track.title} {track.author} {track.uri} " f"{str(query)}",
|
||||
query_obj=query,
|
||||
):
|
||||
if IS_DEBUG:
|
||||
log.debug(
|
||||
"Query is not allowed in %r (%d)", ctx.guild.name, ctx.guild.id
|
||||
)
|
||||
log.debug("Query is not allowed in %r (%d)", ctx.guild.name, ctx.guild.id)
|
||||
continue
|
||||
elif guild_data["maxlength"] > 0:
|
||||
if self.is_track_length_allowed(track, guild_data["maxlength"]):
|
||||
|
||||
@@ -25,7 +25,6 @@ from redbot.core.utils.predicates import MessagePredicate
|
||||
from ...apis.api_utils import FakePlaylist
|
||||
from ...apis.playlist_interface import Playlist, create_playlist, delete_playlist, get_all_playlist
|
||||
from ...audio_dataclasses import LocalPath, Query
|
||||
from ...audio_logging import IS_DEBUG, debug_exc_log
|
||||
from ...converters import ComplexScopeParser, ScopeParser
|
||||
from ...errors import MissingGuild, TooManyMatches, TrackEnqueueError
|
||||
from ...utils import PlaylistScope
|
||||
@@ -778,7 +777,7 @@ class PlaylistCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
file=discord.File(str(temp_tar)),
|
||||
)
|
||||
except Exception as exc:
|
||||
debug_exc_log(log, exc, "Failed to send playlist to channel")
|
||||
log.verbose("Failed to send playlist to channel", exc_info=exc)
|
||||
temp_file.unlink()
|
||||
temp_tar.unlink()
|
||||
else:
|
||||
@@ -1524,10 +1523,7 @@ class PlaylistCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
f"{track.title} {track.author} {track.uri} " f"{str(query)}",
|
||||
query_obj=query,
|
||||
):
|
||||
if IS_DEBUG:
|
||||
log.debug(
|
||||
"Query is not allowed in %r (%d)", ctx.guild.name, ctx.guild.id
|
||||
)
|
||||
log.debug("Query is not allowed in %r (%d)", ctx.guild.name, ctx.guild.id)
|
||||
continue
|
||||
query = Query.process_input(track.uri, self.local_folder_current_path)
|
||||
if query.is_local:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import asyncio
|
||||
import contextlib
|
||||
import datetime
|
||||
import logging
|
||||
import math
|
||||
from pathlib import Path
|
||||
|
||||
Reference in New Issue
Block a user