From 6400de6136722d44ac71adad84b7503b65ed2d2f Mon Sep 17 00:00:00 2001 From: xtaodada Date: Mon, 24 Jan 2022 14:41:58 +0800 Subject: [PATCH] =?UTF-8?q?autocaption=20=E6=94=AF=E6=8C=81=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autocaption.py | 15 ++++++++++++++- list.json | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/autocaption.py b/autocaption.py index 6be8b15..95d5d18 100644 --- a/autocaption.py +++ b/autocaption.py @@ -2,7 +2,7 @@ from pagermaid import version from pagermaid.listener import listener from telethon.tl.custom.message import Message from telethon.tl.types import MessageMediaDocument, DocumentAttributeFilename, DocumentAttributeImageSize, \ - DocumentAttributeAudio + DocumentAttributeAudio, DocumentAttributeSticker, DocumentAttributeVideo, DocumentAttributeAnimated def unit_convert(byte): @@ -56,6 +56,19 @@ async def auto_caption_file(context: Message): text += f"`音乐时长:{duration_convert(i.duration)}`\n" else: text += f"`语音时长:{duration_convert(i.duration)}`\n" + # 视频时长、尺寸 + if isinstance(i, DocumentAttributeVideo): + text += f"`视频尺寸:{i.w}x{i.h}`\n" + text += f"`视频时长:{duration_convert(i.duration)}`\n" + text += f"`应用内播放:{'是' if i.supports_streaming else '否'}`\n" + # 过滤○视频 + if i.round_message: + return + # 过滤 sticker + if isinstance(i, DocumentAttributeSticker): + return + if isinstance(i, DocumentAttributeAnimated): + return # 文件类型 text += f"`文件类型:{context.media.document.mime_type}`\n" # 文件大小 diff --git a/list.json b/list.json index bc78243..9e7b909 100644 --- a/list.json +++ b/list.json @@ -852,10 +852,10 @@ }, { "name": "autocaption", - "version": "1.001", + "version": "1.01", "section": "chat", "maintainer": "xtaodada", - "size": "2.2 kb", + "size": "2.83 kb", "supported": true, "des-short": "自动获取所发送文件的信息。", "des": "自动获取所发送文件的信息。"