Reduce the number of files that have an attempted transcode
This commit is contained in:
parent
ffd0b403d1
commit
e70056f2ff
1 changed files with 24 additions and 15 deletions
|
@ -107,9 +107,18 @@ class AutoResponder(commands.Cog):
|
||||||
links = self.extract_links(message.content, "static-assets-1.truthsocial.com")
|
links = self.extract_links(message.content, "static-assets-1.truthsocial.com")
|
||||||
if links:
|
if links:
|
||||||
for link in links:
|
for link in links:
|
||||||
|
if link.lower().endswith(
|
||||||
|
(".mp4", ".mov", ".qtff", ".mkv", ".asf", ".avi", ".mxf", ".ps", ".ts", ".3gp", ".3g2")
|
||||||
|
):
|
||||||
|
# All containers allowed to contain HEVC
|
||||||
|
# per https://en.wikipedia.org/wiki/Comparison_of_video_container_formats
|
||||||
self.log.info("Found link to transcode: %r", link)
|
self.log.info("Found link to transcode: %r", link)
|
||||||
try:
|
try:
|
||||||
file, _p = await self._transcode_hevc_to_h264(link)
|
async with message.channel.typing():
|
||||||
|
_r = await self._transcode_hevc_to_h264(link)
|
||||||
|
if not _r:
|
||||||
|
continue
|
||||||
|
file, _p = _r
|
||||||
if file:
|
if file:
|
||||||
if _p.stat().st_size <= 24.5 * 1024 * 1024:
|
if _p.stat().st_size <= 24.5 * 1024 * 1024:
|
||||||
await message.reply(file=file)
|
await message.reply(file=file)
|
||||||
|
|
Loading…
Reference in a new issue