From ba401342198ce91e142cbc636ddd4776b3aeeda6 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Wed, 17 Apr 2019 07:59:14 +0800 Subject: [PATCH] Limit upload too small file --- liveDownloader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/liveDownloader.py b/liveDownloader.py index 690c674..7d95f2c 100644 --- a/liveDownloader.py +++ b/liveDownloader.py @@ -53,6 +53,7 @@ def encode(): global isEncode Common.appendEncodeStatus("Encode Daemon Starting") while True: + isEncode = False i = Common.encodeQueue.get() if Common.forceNotEncode: Common.appendEncodeStatus("设置了不编码,所以[{}]不会编码".format(i)) @@ -60,6 +61,9 @@ def encode(): continue if os.path.exists(i): isEncode = True + if os.path.getsize(path) < 8 * 1024 * 1024: + Common.appendEncodeStatus("Encoded File >{}< is too small, will ignore it".format(path)) + continue Common.appendEncodeStatus("Encoding >{}< Start".format(i)) os.system("ffmpeg -i {} -c:v copy -c:a copy -f mp4 {} -y".format(i, i[:13] + ".mp4")) Common.uploadQueue.put(i[:13] + ".mp4") @@ -68,7 +72,6 @@ def encode(): shutil.move(i, Common.config["mtd"]) elif Common.config["del"]: os.remove(i) - isEncode = False def upload(date=datetime.strftime(datetime.now(), "%Y_%m_%d")):