From 3625ff5d4ae0c06d08ce7fa8baacb7753febd6df Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Wed, 28 Feb 2024 18:17:55 +0000 Subject: [PATCH] fix yt-dlp not trimming --- requirements.txt | 31 ++++++++++++++++--------------- src/cogs/screenshot.py | 2 -- src/cogs/ytdl.py | 14 ++++++++------ src/conf.py | 1 + 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/requirements.txt b/requirements.txt index 0ac76cd..b4b6d4a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/src/cogs/screenshot.py b/src/cogs/screenshot.py index 1e6fdbe..b04801a 100644 --- a/src/cogs/screenshot.py +++ b/src/cogs/screenshot.py @@ -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, } diff --git a/src/cogs/ytdl.py b/src/cogs/ytdl.py index ba7e776..13463df 100644 --- a/src/cogs/ytdl.py +++ b/src/cogs/ytdl.py @@ -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) diff --git a/src/conf.py b/src/conf.py index 7832493..88bd862 100644 --- a/src/conf.py +++ b/src/conf.py @@ -27,6 +27,7 @@ try: CONFIG.setdefault("logging", {}) CONFIG.setdefault("jimmy", {}) CONFIG.setdefault("ollama", {}) + CONFIG.setdefault("rss", {"meta": {"channel": None}}) CONFIG.setdefault( "server", {