From ca25d44b9ed6a2952136c1be2781e94902059ba0 Mon Sep 17 00:00:00 2001 From: blank X Date: Sun, 2 Jan 2022 22:39:00 +0700 Subject: [PATCH] Pass -hide_banner -level error to ffmpeg --- sukuinote/plugins/saucenao.py | 6 +++--- sukuinote/plugins/whatanime.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sukuinote/plugins/saucenao.py b/sukuinote/plugins/saucenao.py index 5d20271..8eef5c9 100644 --- a/sukuinote/plugins/saucenao.py +++ b/sukuinote/plugins/saucenao.py @@ -47,18 +47,18 @@ async def saucenao(client, message): return if os.path.getsize(filename) > 20 * 1024: new_path = os.path.join(tempdir, '1.jpg') - proc = await asyncio.create_subprocess_exec('ffmpeg', '-an', '-sn', '-i', filename, '-frames:v', '1', new_path) + proc = await asyncio.create_subprocess_exec('ffmpeg', '-hide_banner', '-loglevel', 'error', '-an', '-sn', '-i', filename, '-frames:v', '1', new_path) await proc.communicate() os.remove(filename) filename = new_path elif mimetype.startswith('video/'): new_path = os.path.join(tempdir, '1.gif') - proc = await asyncio.create_subprocess_exec('ffmpeg', '-an', '-sn', '-i', filename, new_path) + proc = await asyncio.create_subprocess_exec('ffmpeg', '-hide_banner', '-loglevel', 'error', '-an', '-sn', '-i', filename, new_path) await proc.communicate() if os.path.getsize(new_path) > 20 * 1024: os.remove(new_path) new_path = os.path.join(tempdir, '1.jpg') - proc = await asyncio.create_subprocess_exec('ffmpeg', '-an', '-sn', '-i', filename, '-frames:v', '1', new_path) + proc = await asyncio.create_subprocess_exec('ffmpeg', '-hide_banner', '-loglevel', 'error', '-an', '-sn', '-i', filename, '-frames:v', '1', new_path) await proc.communicate() os.remove(filename) filename = new_path diff --git a/sukuinote/plugins/whatanime.py b/sukuinote/plugins/whatanime.py index dbf55ad..df1aac6 100644 --- a/sukuinote/plugins/whatanime.py +++ b/sukuinote/plugins/whatanime.py @@ -29,7 +29,7 @@ async def whatanime(client, message): reply = await message.reply_text('Downloading...') path = await client.download_media(media, file_name=os.path.join(tempdir, '0'), progress=progress_callback, progress_args=(reply, 'Downloading...', False)) new_path = os.path.join(tempdir, '1.png') - proc = await asyncio.create_subprocess_exec('ffmpeg', '-i', path, '-frames:v', '1', new_path) + proc = await asyncio.create_subprocess_exec('ffmpeg', '-hide_banner', '-loglevel', 'error', '-i', path, '-frames:v', '1', new_path) await proc.communicate() await reply.edit_text('Uploading...') with open(new_path, 'rb') as file: