lower compression threshold for screenshots
This commit is contained in:
parent
c8019f3993
commit
45e85cfba4
2 changed files with 5 additions and 4 deletions
|
@ -62,7 +62,7 @@ class ScreenshotCog(commands.Cog):
|
||||||
img.save(file.name, "webp", quality=quality_r)
|
img.save(file.name, "webp", quality=quality_r)
|
||||||
file.seek(0)
|
file.seek(0)
|
||||||
value = io.BytesIO(file.read())
|
value = io.BytesIO(file.read())
|
||||||
if len(value.getvalue()) <= 24 * 1024 * 1024:
|
if len(value.getvalue()) <= 8 * 1024 * 1024:
|
||||||
self.log.debug("%d%% was sufficient.", quality_r)
|
self.log.debug("%d%% was sufficient.", quality_r)
|
||||||
break
|
break
|
||||||
quality -= 15
|
quality -= 15
|
||||||
|
@ -179,7 +179,7 @@ class ScreenshotCog(commands.Cog):
|
||||||
file.seek(0)
|
file.seek(0)
|
||||||
end_save = time.time()
|
end_save = time.time()
|
||||||
|
|
||||||
if len(await asyncio.to_thread(file.getvalue)) > 24 * 1024 * 1024:
|
if len(await asyncio.to_thread(file.getvalue)) > 8 * 1024 * 1024:
|
||||||
await ctx.edit(content="Compressing screenshot...")
|
await ctx.edit(content="Compressing screenshot...")
|
||||||
start_compress = time.time()
|
start_compress = time.time()
|
||||||
file = await asyncio.to_thread(self.compress_png, file)
|
file = await asyncio.to_thread(self.compress_png, file)
|
||||||
|
|
|
@ -43,7 +43,7 @@ class YTDLCog(commands.Cog):
|
||||||
"noprogress": True,
|
"noprogress": True,
|
||||||
"logger": self.log,
|
"logger": self.log,
|
||||||
"format": "((bv+ba/b)[vcodec!=h265][vcodec!=av01][filesize<15M]/b[filesize<=15M]/b)",
|
"format": "((bv+ba/b)[vcodec!=h265][vcodec!=av01][filesize<15M]/b[filesize<=15M]/b)",
|
||||||
"outtmpl": f"%(title).50s.%(ext)s",
|
"outtmpl": "%(title).50s.%(ext)s",
|
||||||
"format_sort": [
|
"format_sort": [
|
||||||
"vcodec:h264",
|
"vcodec:h264",
|
||||||
"acodec:aac",
|
"acodec:aac",
|
||||||
|
@ -60,6 +60,7 @@ class YTDLCog(commands.Cog):
|
||||||
}
|
}
|
||||||
self.colours = {
|
self.colours = {
|
||||||
"youtube.com": 0xff0000,
|
"youtube.com": 0xff0000,
|
||||||
|
"youtu.be": 0xff0000,
|
||||||
"tiktok.com": 0x25F5EF,
|
"tiktok.com": 0x25F5EF,
|
||||||
"instagram.com": 0xe1306c,
|
"instagram.com": 0xe1306c,
|
||||||
"shronk.net": 0xFFF952
|
"shronk.net": 0xFFF952
|
||||||
|
@ -318,7 +319,7 @@ class YTDLCog(commands.Cog):
|
||||||
title = extracted_info.get("title", url)
|
title = extracted_info.get("title", url)
|
||||||
title = textwrap.shorten(title, 100)
|
title = textwrap.shorten(title, 100)
|
||||||
thumbnail_url = extracted_info.get("thumbnail") or None
|
thumbnail_url = extracted_info.get("thumbnail") or None
|
||||||
webpage_url = extracted_info.get("webpage_url") or None
|
webpage_url = extracted_info.get("webpage_url", url)
|
||||||
|
|
||||||
chosen_format = extracted_info.get("format")
|
chosen_format = extracted_info.get("format")
|
||||||
chosen_format_id = extracted_info.get("format_id")
|
chosen_format_id = extracted_info.get("format_id")
|
||||||
|
|
Loading…
Reference in a new issue