fixed progressbar crashing on non-video media
This commit is contained in:
parent
2929725416
commit
e94c3d166f
3 changed files with 29 additions and 11 deletions
|
@ -262,9 +262,9 @@ if __name__ == "__main__":
|
|||
if out:
|
||||
output_buffer.append(out)
|
||||
|
||||
if b"frame=" in out:
|
||||
frame_id = re.findall(b"frame= *(\d+) ", out)[0]
|
||||
pb.set("a", int(frame_id) / info.video_fps.value)
|
||||
if b"time=" in out:
|
||||
t = aux.parse_time(out)
|
||||
pb.set("a", t)
|
||||
pb.render()
|
||||
|
||||
elif out is None:
|
||||
|
@ -398,11 +398,11 @@ if __name__ == "__main__":
|
|||
|
||||
if main.cfg.armed:
|
||||
pb = over.text.ProgressBar(
|
||||
"§%f §rs [§=f>§ F] §sf (§ss) (Sest=§zs, Trem=§TF)",
|
||||
"§%a §rs [§=a>§ A] §sa (§ss) (Sest=§zs, Trem=§TA)",
|
||||
{
|
||||
"f": {
|
||||
"unit": "f",
|
||||
"top": int(info.video_fps.value * info.duration),
|
||||
"a": {
|
||||
"unit": "s",
|
||||
"top": int(info.duration),
|
||||
"precision": 1,
|
||||
"min_width_rate": 9
|
||||
},
|
||||
|
@ -424,9 +424,9 @@ if __name__ == "__main__":
|
|||
out = encode_cmd.get_output()
|
||||
|
||||
if out:
|
||||
if b"frame=" in out:
|
||||
frame_id = re.findall(b"frame= *(\d+) ", out)[0]
|
||||
pb.set("f", int(frame_id))
|
||||
if b"time=" in out:
|
||||
t = aux.parse_time(out)
|
||||
pb.set("a", int(t))
|
||||
|
||||
elif out is None:
|
||||
break
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue