fix yt-dlp not trimming

This commit is contained in:
Nexus 2024-02-28 18:17:55 +00:00
parent 7eff6c052c
commit 3625ff5d4a
Signed by: nex
GPG key ID: 0FA334385D0B689F
4 changed files with 25 additions and 23 deletions

View file

@ -1,19 +1,20 @@
wheel>=0.42
setuptools>=69
yt-dlp @ https://github.com/yt-dlp/yt-dlp/archive/master.tar.gz
# py-cord==2.4.1
py-cord @ git+https://github.com/Pycord-Development/pycord.git
httpx==0.26
psycopg==3.1.16
toml==0.10.2
pillow==10.2
selenium==4.16
rich==13.7
dnspython==2.4.2
aiosqlite==0.19.0
fastapi==0.108.0
uvicorn==0.25.0
psutil==5.9.7
pydantic==2.5.3
humanize==4.9.0
redis==5.0.1
httpx~=0.26
psycopg~=3.1
toml~=0.10
pillow~=10.2
selenium~=4.16
rich~=13.7
dnspython~=2.4
aiosqlite~=0.19
fastapi~=0.109
uvicorn~=0.26
psutil~=5.9
pydantic~=2.5
humanize~=4.9
redis~=5.0
beautifulsoup4~=4.12
lxml~=5.1

View file

@ -38,8 +38,6 @@ class ScreenshotCog(commands.Cog):
prefs = {
"download.open_pdf_in_system_reader": False,
# "download.prompt_for_download": True,
# "download.default_directory": "/dev/null",
"plugins.always_open_pdf_externally": False,
"download_restrictions": 3,
}

View file

@ -411,18 +411,18 @@ class YTDLCog(commands.Cog):
trim_start, trim_end = snip, None
trim_start = trim_start or "00:00:00"
trim_end = trim_end or extracted_info.get("duration_string", "00:30:00")
new_file = temp_dir / ("output." + file.suffix)
new_file = temp_dir / ("output" + file.suffix)
args = [
"-hwaccel",
"auto",
"-ss",
trim_start,
"-i",
str(file),
"-ss",
trim_start,
"-to",
trim_end,
"-preset",
"faster",
"fast",
"-crf",
"28",
"-deadline",
@ -447,7 +447,7 @@ class YTDLCog(commands.Cog):
timestamp=discord.utils.utcnow()
)
)
self.log.debug("Running command: ffmpeg %s", " ".join(args))
self.log.debug("Running command: 'ffmpeg %s'", " ".join(args))
process = await asyncio.create_subprocess_exec(
"ffmpeg",
*args,
@ -455,6 +455,8 @@ class YTDLCog(commands.Cog):
stderr=asyncio.subprocess.PIPE
)
stdout, stderr = await process.communicate()
self.log.debug("STDOUT:\n%r", stdout.decode())
self.log.debug("STDERR:\n%r", stderr.decode())
if process.returncode != 0:
return await ctx.edit(
embed=discord.Embed(
@ -466,7 +468,7 @@ class YTDLCog(commands.Cog):
)
file = new_file
if audio_only and file.suffix != ".m4a":
if audio_only and file.suffix != ".m4a":
self.log.info("Converting %r to m4a.", file)
file = await asyncio.to_thread(self.convert_to_m4a, file)

View file

@ -27,6 +27,7 @@ try:
CONFIG.setdefault("logging", {})
CONFIG.setdefault("jimmy", {})
CONFIG.setdefault("ollama", {})
CONFIG.setdefault("rss", {"meta": {"channel": None}})
CONFIG.setdefault(
"server",
{