fix
This commit is contained in:
parent
ed3af8c274
commit
e1b8ba678b
|
@ -128,6 +128,20 @@ class S:
|
|||
return lis[0]
|
||||
return None
|
||||
|
||||
def get_one_fail_compress_video(self):
|
||||
param = {
|
||||
"ids": [], # 52062
|
||||
"status": -100,
|
||||
"offset": 0,
|
||||
"limit": 1,
|
||||
}
|
||||
res = call_service(url_get_videos_by_status, param)
|
||||
data = safe_get_dict(res, "data")
|
||||
lis = safe_get_list(data, "video")
|
||||
if len(lis) > 0:
|
||||
return lis[0]
|
||||
return None
|
||||
|
||||
def set_compress_finish(self, video_id, size_src, src_id_h264, size_h264, src_id_720, size_720, status, resize_t):
|
||||
param = {
|
||||
"id": video_id,
|
||||
|
@ -245,11 +259,15 @@ def get_video_stat(video_path):
|
|||
|
||||
idx = 0
|
||||
while True:
|
||||
from_fail = False
|
||||
s = S()
|
||||
video = s.get_one_wait_compress_video()
|
||||
if not video:
|
||||
video = s.get_one_fail_compress_video()
|
||||
from_fail = True
|
||||
if not video:
|
||||
logger.Info("no video, sleep")
|
||||
time.sleep(10)
|
||||
time.sleep(5)
|
||||
continue
|
||||
idx += 1
|
||||
video_id = safe_get_int(video, "id")
|
||||
|
@ -257,8 +275,14 @@ while True:
|
|||
logger.Info("================== {}, {} start ==================".format(idx, video_id))
|
||||
ok = s.proc_one(video)
|
||||
if not ok:
|
||||
s.set_compress_finish(video_id, 0, "", 0, "", 0, -100, int(time.time()))
|
||||
if from_fail:
|
||||
s.set_compress_finish(video_id, 0, "", 0, "", 0, -200, int(time.time()))
|
||||
else:
|
||||
s.set_compress_finish(video_id, 0, "", 0, "", 0, -100, int(time.time()))
|
||||
logger.Info("================== {}, {} end ==================".format(idx, video_id))
|
||||
except Exception as e:
|
||||
logger.Error("{}, {} _Panic: {}".format(idx, video_id, str(e)))
|
||||
s.set_compress_finish(video_id, 0, "", 0, "", 0, -100, int(time.time()))
|
||||
if from_fail:
|
||||
s.set_compress_finish(video_id, 0, "", 0, "", 0, -200, int(time.time()))
|
||||
else:
|
||||
s.set_compress_finish(video_id, 0, "", 0, "", 0, -100, int(time.time()))
|
||||
|
|
Loading…
Reference in New Issue