mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-20 02:26:32 +01:00
Automatically determine best quality
This commit is contained in:
parent
f4ce92bec0
commit
0215986e54
1 changed files with 5 additions and 5 deletions
|
@ -748,7 +748,6 @@ class OtherCog(commands.Cog):
|
||||||
self,
|
self,
|
||||||
ctx: discord.ApplicationContext,
|
ctx: discord.ApplicationContext,
|
||||||
url: str,
|
url: str,
|
||||||
proxy: str = None,
|
|
||||||
video_format: str = "",
|
video_format: str = "",
|
||||||
upload_log: bool = True
|
upload_log: bool = True
|
||||||
):
|
):
|
||||||
|
@ -756,7 +755,7 @@ class OtherCog(commands.Cog):
|
||||||
with tempfile.TemporaryDirectory(prefix="jimmy-ytdl-") as tempdir:
|
with tempfile.TemporaryDirectory(prefix="jimmy-ytdl-") as tempdir:
|
||||||
video_format = video_format.lower()
|
video_format = video_format.lower()
|
||||||
OUTPUT_FILE = str(Path(tempdir) / f"{ctx.user.id}.%(ext)s")
|
OUTPUT_FILE = str(Path(tempdir) / f"{ctx.user.id}.%(ext)s")
|
||||||
MAX_SIZE = ctx.guild.filesize_limit / 1024 / 1024
|
MAX_SIZE = round(ctx.guild.filesize_limit / 1024 / 1024)
|
||||||
options = [
|
options = [
|
||||||
"--no-colors",
|
"--no-colors",
|
||||||
"--no-playlist",
|
"--no-playlist",
|
||||||
|
@ -764,11 +763,12 @@ class OtherCog(commands.Cog):
|
||||||
# "--max-filesize", str(MAX_SIZE) + "M",
|
# "--max-filesize", str(MAX_SIZE) + "M",
|
||||||
"--no-warnings",
|
"--no-warnings",
|
||||||
"--output", OUTPUT_FILE,
|
"--output", OUTPUT_FILE,
|
||||||
|
"--newline"
|
||||||
]
|
]
|
||||||
if proxy:
|
|
||||||
options.extend(["--proxy", proxy])
|
|
||||||
if video_format:
|
if video_format:
|
||||||
options.extend(["--format", video_format])
|
options.extend(["--format", f"({video_format})[filesize<={MAX_SIZE}M]"])
|
||||||
|
else:
|
||||||
|
options.extend(["--format", f"(bv*+ba/b/ba)[filesize<={MAX_SIZE}M]"])
|
||||||
|
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
await ctx.edit(content="Downloading video...")
|
await ctx.edit(content="Downloading video...")
|
||||||
|
|
Loading…
Reference in a new issue