mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 18:27:59 -05:00
[Audio] Redefine max length with livestream exception (#3878)
* Redefine max length with livestream exception * Address review * is_track_too_long -> is_track_length_allowed for a more accurate description of what the function actually is doing * we now rely on Track.is_stream for determining whether item is a livestream (or unseekable/non-known audio length like OGG files) for determining whether it can bypass the user-set max track length * Removal of passing track length/an int to is_track_length_allowed - will always pass the full Track object now * Address review
This commit is contained in:
@@ -274,7 +274,7 @@ class PlayerCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
description=_("This track is not allowed in this server."),
|
||||
)
|
||||
elif guild_data["maxlength"] > 0:
|
||||
if self.is_track_too_long(single_track, guild_data["maxlength"]):
|
||||
if self.is_track_length_allowed(single_track, guild_data["maxlength"]):
|
||||
single_track.requester = ctx.author
|
||||
player.queue.insert(0, single_track)
|
||||
player.maybe_shuffle()
|
||||
@@ -763,7 +763,7 @@ class PlayerCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
log.debug(f"Query is not allowed in {ctx.guild} ({ctx.guild.id})")
|
||||
continue
|
||||
elif guild_data["maxlength"] > 0:
|
||||
if self.is_track_too_long(track, guild_data["maxlength"]):
|
||||
if self.is_track_length_allowed(track, guild_data["maxlength"]):
|
||||
track_len += 1
|
||||
player.add(ctx.author, track)
|
||||
self.bot.dispatch(
|
||||
|
||||
@@ -1489,7 +1489,7 @@ class PlaylistCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
pass
|
||||
if not local_path.exists() and not local_path.is_file():
|
||||
continue
|
||||
if maxlength > 0 and not self.is_track_too_long(track.length, maxlength):
|
||||
if maxlength > 0 and not self.is_track_length_allowed(track, maxlength):
|
||||
continue
|
||||
|
||||
player.add(author_obj, track)
|
||||
|
||||
Reference in New Issue
Block a user