From 73d0f204dcd94c07a66082f0f1b1b3ae92f6a3f4 Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Tue, 16 Apr 2024 00:43:25 +0100 Subject: [PATCH] Transcode any HEVC file under 10 minutes --- src/cogs/auto_responder.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cogs/auto_responder.py b/src/cogs/auto_responder.py index 6759f4a..e85f439 100644 --- a/src/cogs/auto_responder.py +++ b/src/cogs/auto_responder.py @@ -60,6 +60,13 @@ class AutoResponder(commands.Cog): info = await cog._run_ffprobe(uri, True) if not info: raise ValueError("No info found for %r" % uri) + if float(info["format"].get("duration", 600.1)) > 600.0: + self.log.warning( + "Video %r is %.2f seconds long (more than 10 minutes). Refusing to process further.", + uri, + float(info["format"].get("duration", 600.1)) + ) + return streams = info.get("streams", []) for stream in streams: self.log.info("Found stream: %s", stream.get("codec_name")) @@ -145,6 +152,7 @@ class AutoResponder(commands.Cog): 1229496078726860921, 421698654189912064 }: + # links = self.extract_links(message.content, "static-assets-1.truthsocial.com") links = self.extract_links(message.content, "static-assets-1.truthsocial.com") if links: for link in links: