mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-20 02:26:32 +01:00
Debug
This commit is contained in:
parent
7e7822f679
commit
a035916254
1 changed files with 32 additions and 24 deletions
|
@ -1605,11 +1605,9 @@ class OtherCog(commands.Cog):
|
||||||
max_size = ctx.guild.filesize_limit if ctx.guild else 8 * 1024 * 1024
|
max_size = ctx.guild.filesize_limit if ctx.guild else 8 * 1024 * 1024
|
||||||
share = False
|
share = False
|
||||||
if os.path.exists("/mnt/vol/share/droplet.secret"):
|
if os.path.exists("/mnt/vol/share/droplet.secret"):
|
||||||
if hashlib.md5(Path("/mnt/vol/share/droplet.secret").read_bytes()) == "49c594007ed08a56b16301dca4dbfc10":
|
|
||||||
max_size = 250 * 1024 * 1024
|
|
||||||
share = True
|
share = True
|
||||||
|
|
||||||
if size_bytes > max_size:
|
if size_bytes > max_size or share is False or (share is True and size_mb >= 250):
|
||||||
return await ctx.respond(":x: Max file size is %dMB" % round(max_size / 1024 / 1024))
|
return await ctx.respond(":x: Max file size is %dMB" % round(max_size / 1024 / 1024))
|
||||||
|
|
||||||
ct, suffix = file.content_type.split("/")
|
ct, suffix = file.content_type.split("/")
|
||||||
|
@ -1658,7 +1656,8 @@ class OtherCog(commands.Cog):
|
||||||
return await ctx.respond(
|
return await ctx.respond(
|
||||||
":x: Target size too small (would've had a negative bitrate of %d)" % target_bitrate
|
":x: Target size too small (would've had a negative bitrate of %d)" % target_bitrate
|
||||||
)
|
)
|
||||||
end_br = min(bit_rate, target_bitrate, 255 * channels)
|
br_ceiling = 255 * channels
|
||||||
|
end_br = min(bit_rate, target_bitrate, br_ceiling)
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile(suffix=".ogg", prefix=file.filename) as output_file:
|
with tempfile.NamedTemporaryFile(suffix=".ogg", prefix=file.filename) as output_file:
|
||||||
command = [
|
command = [
|
||||||
|
@ -1693,13 +1692,22 @@ class OtherCog(commands.Cog):
|
||||||
|
|
||||||
output_location = Path(output_file.name)
|
output_location = Path(output_file.name)
|
||||||
stat = output_location.stat()
|
stat = output_location.stat()
|
||||||
|
content = ("\N{white heavy check mark} Transcoded from %r to opus @ %dkbps.\n"
|
||||||
|
"* Source: %dKbps\n* Target: %dKbps\n* Ceiling: %dKbps\n* Calculated: %dKbps\n"
|
||||||
|
"* Duration: %.1f seconds") % (
|
||||||
|
codec,
|
||||||
|
end_br,
|
||||||
|
bit_rate,
|
||||||
|
target_bitrate,
|
||||||
|
br_ceiling,
|
||||||
|
end_br,
|
||||||
|
duration
|
||||||
|
)
|
||||||
|
if stat.st_size <= max_size or share is False:
|
||||||
if stat.st_size >= (size_bytes - 100):
|
if stat.st_size >= (size_bytes - 100):
|
||||||
return await ctx.respond(
|
return await ctx.respond(
|
||||||
":x: File was too large."
|
":x: File was too large."
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
content = "\N{white heavy check mark} Transcoded from %r to opus @ %dkbps." % (codec, end_br)
|
|
||||||
if share is False:
|
|
||||||
return await ctx.respond(
|
return await ctx.respond(
|
||||||
content,
|
content,
|
||||||
file=discord.File(output_location)
|
file=discord.File(output_location)
|
||||||
|
|
Loading…
Reference in a new issue