fix yt-dlp not trimming
This commit is contained in:
parent
7eff6c052c
commit
3625ff5d4a
4 changed files with 25 additions and 23 deletions
|
@ -1,19 +1,20 @@
|
||||||
wheel>=0.42
|
wheel>=0.42
|
||||||
setuptools>=69
|
setuptools>=69
|
||||||
yt-dlp @ https://github.com/yt-dlp/yt-dlp/archive/master.tar.gz
|
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
|
py-cord @ git+https://github.com/Pycord-Development/pycord.git
|
||||||
httpx==0.26
|
httpx~=0.26
|
||||||
psycopg==3.1.16
|
psycopg~=3.1
|
||||||
toml==0.10.2
|
toml~=0.10
|
||||||
pillow==10.2
|
pillow~=10.2
|
||||||
selenium==4.16
|
selenium~=4.16
|
||||||
rich==13.7
|
rich~=13.7
|
||||||
dnspython==2.4.2
|
dnspython~=2.4
|
||||||
aiosqlite==0.19.0
|
aiosqlite~=0.19
|
||||||
fastapi==0.108.0
|
fastapi~=0.109
|
||||||
uvicorn==0.25.0
|
uvicorn~=0.26
|
||||||
psutil==5.9.7
|
psutil~=5.9
|
||||||
pydantic==2.5.3
|
pydantic~=2.5
|
||||||
humanize==4.9.0
|
humanize~=4.9
|
||||||
redis==5.0.1
|
redis~=5.0
|
||||||
|
beautifulsoup4~=4.12
|
||||||
|
lxml~=5.1
|
||||||
|
|
|
@ -38,8 +38,6 @@ class ScreenshotCog(commands.Cog):
|
||||||
|
|
||||||
prefs = {
|
prefs = {
|
||||||
"download.open_pdf_in_system_reader": False,
|
"download.open_pdf_in_system_reader": False,
|
||||||
# "download.prompt_for_download": True,
|
|
||||||
# "download.default_directory": "/dev/null",
|
|
||||||
"plugins.always_open_pdf_externally": False,
|
"plugins.always_open_pdf_externally": False,
|
||||||
"download_restrictions": 3,
|
"download_restrictions": 3,
|
||||||
}
|
}
|
||||||
|
|
|
@ -411,18 +411,18 @@ class YTDLCog(commands.Cog):
|
||||||
trim_start, trim_end = snip, None
|
trim_start, trim_end = snip, None
|
||||||
trim_start = trim_start or "00:00:00"
|
trim_start = trim_start or "00:00:00"
|
||||||
trim_end = trim_end or extracted_info.get("duration_string", "00:30: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 = [
|
args = [
|
||||||
"-hwaccel",
|
"-hwaccel",
|
||||||
"auto",
|
"auto",
|
||||||
"-ss",
|
|
||||||
trim_start,
|
|
||||||
"-i",
|
"-i",
|
||||||
str(file),
|
str(file),
|
||||||
|
"-ss",
|
||||||
|
trim_start,
|
||||||
"-to",
|
"-to",
|
||||||
trim_end,
|
trim_end,
|
||||||
"-preset",
|
"-preset",
|
||||||
"faster",
|
"fast",
|
||||||
"-crf",
|
"-crf",
|
||||||
"28",
|
"28",
|
||||||
"-deadline",
|
"-deadline",
|
||||||
|
@ -447,7 +447,7 @@ class YTDLCog(commands.Cog):
|
||||||
timestamp=discord.utils.utcnow()
|
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(
|
process = await asyncio.create_subprocess_exec(
|
||||||
"ffmpeg",
|
"ffmpeg",
|
||||||
*args,
|
*args,
|
||||||
|
@ -455,6 +455,8 @@ class YTDLCog(commands.Cog):
|
||||||
stderr=asyncio.subprocess.PIPE
|
stderr=asyncio.subprocess.PIPE
|
||||||
)
|
)
|
||||||
stdout, stderr = await process.communicate()
|
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:
|
if process.returncode != 0:
|
||||||
return await ctx.edit(
|
return await ctx.edit(
|
||||||
embed=discord.Embed(
|
embed=discord.Embed(
|
||||||
|
@ -466,7 +468,7 @@ class YTDLCog(commands.Cog):
|
||||||
)
|
)
|
||||||
file = new_file
|
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)
|
self.log.info("Converting %r to m4a.", file)
|
||||||
file = await asyncio.to_thread(self.convert_to_m4a, file)
|
file = await asyncio.to_thread(self.convert_to_m4a, file)
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ try:
|
||||||
CONFIG.setdefault("logging", {})
|
CONFIG.setdefault("logging", {})
|
||||||
CONFIG.setdefault("jimmy", {})
|
CONFIG.setdefault("jimmy", {})
|
||||||
CONFIG.setdefault("ollama", {})
|
CONFIG.setdefault("ollama", {})
|
||||||
|
CONFIG.setdefault("rss", {"meta": {"channel": None}})
|
||||||
CONFIG.setdefault(
|
CONFIG.setdefault(
|
||||||
"server",
|
"server",
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue