upgrade ALL dependencies

This commit is contained in:
leander committed 2026-03-05 18:30:02 +01:00
1 parent 373875b69a
commit 8515515bac
4 files changed
+52 -120

No files matched your search

+2 -4
View File
@@ -1,4 +1,4 @@
FROM python:3.12
FROM python:3.14
WORKDIR /app
@@ -6,12 +6,10 @@ COPY requirements.txt .
RUN python3 -m pip install --no-cache-dir -r requirements.txt
RUN apt-get update && apt-get install -y imagemagick ffmpeg libsm6 libxext6 graphviz pandoc
RUN apt-get update && apt-get install -y ffmpeg graphviz pandoc
COPY . .
RUN mkdir -p /etc/ImageMagick-7 && mv /app/src/assets/policy.xml /etc/ImageMagick-7/policy.xml
VOLUME logs
CMD ["python3", "src/run.py"]
+10 -11
View File
@@ -1,19 +1,18 @@
asyncio==3.4.*
dateparser==1.2.*
discord.py==2.3.*
graphviz==0.20.*
dateparser==1.3.*
discord.py==2.7.*
graphviz==0.21.*
Japanera==2.1.*
mcrcon==0.7.*
moviepy==1.0.*
moviepy==2.2.*
nltk==3.9.*
numpy==1.26.*
opencv-python==4.8.*
pillow==12.1.*
psutil==5.9.*
numpy==2.4.*
opencv-python==4.13.*
pillow>=9.2,<12.0
psutil==7.2.*
psycopg2-binary==2.9.*
pypandoc==1.13.*
pypandoc==1.16.*
pyyaml==6.0.*
regex==2023.12.25
regex==2026.2.28
requests==2.32.*
tzdata # This only needed if run on windows. I haven't set a version either to ensure it's up to date.
wordcloud==1.9.*
-83
View File
@@ -1,83 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policymap [
<!ELEMENT policymap (policy)*>
<!ATTLIST policymap xmlns CDATA #FIXED ''>
<!ELEMENT policy EMPTY>
<!ATTLIST policy xmlns CDATA #FIXED '' domain NMTOKEN #REQUIRED
name NMTOKEN #IMPLIED pattern CDATA #IMPLIED rights NMTOKEN #IMPLIED
stealth NMTOKEN #IMPLIED value CDATA #IMPLIED>
]>
<!--
Configure ImageMagick policies.
Domains include system, delegate, coder, filter, path, or resource.
Rights include none, read, write, execute and all. Use | to combine them,
for example: "read | write" to permit read from, or write to, a path.
Use a glob expression as a pattern.
Suppose we do not want users to process MPEG video images:
<policy domain="delegate" rights="none" pattern="mpeg:decode" />
Here we do not want users reading images from HTTP:
<policy domain="coder" rights="none" pattern="HTTP" />
The /repository file system is restricted to read only. We use a glob
expression to match all paths that start with /repository:
<policy domain="path" rights="read" pattern="/repository/*" />
Lets prevent users from executing any image filters:
<policy domain="filter" rights="none" pattern="*" />
Any large image is cached to disk rather than memory:
<policy domain="resource" name="area" value="1GP"/>
Use the default system font unless overridden by the application:
<policy domain="system" name="font" value="/usr/share/fonts/favorite.ttf"/>
Define arguments for the memory, map, area, width, height and disk resources
with SI prefixes (.e.g 100MB). In addition, resource policies are maximums
for each instance of ImageMagick (e.g. policy memory limit 1GB, -limit 2GB
exceeds policy maximum so memory limit is 1GB).
Rules are processed in order. Here we want to restrict ImageMagick to only
read or write a small subset of proven web-safe image types:
<policy domain="delegate" rights="none" pattern="*" />
<policy domain="filter" rights="none" pattern="*" />
<policy domain="coder" rights="none" pattern="*" />
<policy domain="coder" rights="read|write" pattern="{GIF,JPEG,PNG,WEBP}" />
-->
<policymap>
<!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
<!-- <policy domain="resource" name="memory" value="2GiB"/> -->
<!-- <policy domain="resource" name="map" value="4GiB"/> -->
<!-- <policy domain="resource" name="width" value="10KP"/> -->
<!-- <policy domain="resource" name="height" value="10KP"/> -->
<!-- <policy domain="resource" name="list-length" value="128"/> -->
<!-- <policy domain="resource" name="area" value="100MP"/> -->
<!-- <policy domain="resource" name="disk" value="16EiB"/> -->
<!-- <policy domain="resource" name="file" value="768"/> -->
<!-- <policy domain="resource" name="thread" value="4"/> -->
<!-- <policy domain="resource" name="throttle" value="0"/> -->
<!-- <policy domain="resource" name="time" value="3600"/> -->
<!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
<!-- <policy domain="module" rights="none" pattern="{PS,PDF,XPS}" /> -->
<!-- <policy domain="delegate" rights="none" pattern="HTTPS" /> -->
<!-- <policy domain="path" rights="none" pattern="@*" /> -->
<!-- <policy domain="cache" name="memory-map" value="anonymous"/> -->
<!-- <policy domain="cache" name="synchronize" value="True"/> -->
<!-- <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/> -->
<!-- <policy domain="system" name="max-memory-request" value="256MiB"/> -->
<!-- <policy domain="cache" name="synchronize" value="true"/> -->
<!-- <policy domain="system" name="shred" value="1"/> -->
<!-- <policy domain="system" name="font" value="/path/to/unicode-font.ttf"/> -->
<policy domain="Undefined" rights="none"/>
</policymap>
+40 -22
View File
@@ -7,9 +7,10 @@ import discord
import numpy as np
from discord import app_commands
from discord.ext import commands
from moviepy.editor import CompositeVideoClip
from moviepy.editor import TextClip
from moviepy.editor import VideoFileClip
from moviepy import CompositeVideoClip
from moviepy import TextClip
from moviepy import VideoFileClip
from moviepy import vfx
from PIL import Image
from PIL import ImageEnhance
from PIL import UnidentifiedImageError
@@ -168,7 +169,15 @@ class Meme(commands.Cog):
await self.bot.loop.run_in_executor(None, generation_task)
temp_file = f"./src/assets/temp/{interaction.user.id}_crab.mp4"
await interaction.followup.send(file=discord.File(temp_file))
try:
await interaction.followup.send(file=discord.File(temp_file))
except discord.errors.HTTPException:
self.bot.logger.warning(f"Failed to send temporary file {temp_file}")
await interaction.followup.send(
embed=embed_templates.error_warning("Failed to send video. File is probably too big."),
ephemeral=True,
)
try:
os.remove(temp_file)
except (FileNotFoundError, PermissionError):
@@ -187,39 +196,48 @@ class Meme(commands.Cog):
user_id (int): The user ID
"""
font_path = "DejaVu-Sans-Bold"
clip = VideoFileClip("./src/assets/crab.mp4")
top_part = (
TextClip(top_text, fontsize=60, color="white", stroke_width=2, stroke_color="black", font=font_path)
.set_start(11.0)
.set_position(("center", 300))
.set_duration(26.0)
TextClip(text=top_text, font_size=60, color="white", stroke_width=2, stroke_color="black")
.with_start(11.0)
.with_position(("center", 300))
.with_duration(26.0)
)
middle_part = (
TextClip(
"____________________",
fontsize=48,
text="____________________",
font_size=48,
color="white",
font=font_path,
)
.set_start(11.0)
.set_position(("center", "center"))
.set_duration(26.0)
.with_start(11.0)
.with_position(("center", "center"))
.with_duration(26.0)
)
bottom_part = (
TextClip(bottom_text, fontsize=60, color="white", stroke_width=2, stroke_color="black", font=font_path)
.set_start(11.0)
.set_position(("center", 400))
.set_duration(26.0)
TextClip(text=bottom_text, font_size=60, color="white", stroke_width=2, stroke_color="black")
.with_start(11.0)
.with_position(("center", 400))
.with_duration(26.0)
)
top_part = top_part.with_effects([vfx.CrossFadeIn(1)])
middle_part = middle_part.with_effects([vfx.CrossFadeIn(1)])
bottom_part = bottom_part.with_effects([vfx.CrossFadeIn(1)])
video = CompositeVideoClip(
[clip, top_part.crossfadein(1), middle_part.crossfadein(1), bottom_part.crossfadein(1)]
).set_duration(26.0)
[
clip,
top_part,
middle_part,
bottom_part,
]
).with_duration(26.0)
video.write_videofile(
f"./src/assets/temp/{user_id}_crab.mp4", threads=1, preset="superfast", verbose=False, logger=None
f"./src/assets/temp/{user_id}_crab.mp4",
preset="superfast",
logger=None,
)
clip.close()
video.close()