fix checkboxes & video fps

This commit is contained in:
jmp909 2023-05-31 22:57:21 +01:00
parent 30fc498d7e
commit 43990c9367
2 changed files with 5 additions and 6 deletions

View File

@ -23,7 +23,7 @@ def detect_fps(input_path):
output = os.popen(f'ffprobe -v error -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate "{input_path}"').read()
if "/" in output:
try:
return int(output.split(os.sep)[0]) // int(output.split(os.sep)[1]), output.removesuffix('\n')
return int(output.split("/")[0]) // int(output.split("/")[1]), output.removesuffix('\n')
except:
pass
return 30, 30

9
run.py
View File

@ -153,11 +153,11 @@ def select_target():
def toggle_fps_limit():
args['keep_fps'] = limit_fps.get() != True
args['keep_fps'] = int(limit_fps.get() != True)a
def toggle_keep_frames():
args['keep_frames'] = keep_frames.get() != True
args['keep_frames'] = int(keep_frames.get())
def save_file():
@ -261,13 +261,12 @@ if __name__ == "__main__":
target_button.place(x=360,y=320,width=180,height=80)
# FPS limit checkbox
limit_fps = tk.IntVar()
limit_fps = tk.IntVar(None, not args['keep_fps'])
fps_checkbox = tk.Checkbutton(window, relief="groove", activebackground="#2d3436", activeforeground="#74b9ff", selectcolor="black", text="Limit FPS to 30", fg="#dfe6e9", borderwidth=0, highlightthickness=0, bg="#2d3436", variable=limit_fps, command=toggle_fps_limit)
fps_checkbox.place(x=30,y=500,width=240,height=31)
fps_checkbox.select()
# Keep frames checkbox
keep_frames = tk.IntVar()
keep_frames = tk.IntVar(None, args['keep_frames'])
frames_checkbox = tk.Checkbutton(window, relief="groove", activebackground="#2d3436", activeforeground="#74b9ff", selectcolor="black", text="Keep frames dir", fg="#dfe6e9", borderwidth=0, highlightthickness=0, bg="#2d3436", variable=keep_frames, command=toggle_keep_frames)
frames_checkbox.place(x=37,y=450,width=240,height=31)