@@ -958,39 +958,44 @@ def create_funscript(self, idx_dict: dict) -> None:
958958
959959 def run (self ) -> None :
960960 """ The Funscript Generator Thread Function """
961- if self .params .direction == 'd' and not self .params .track_men :
962- self .finished ("Tracking with 'd' and no men tracker is not implemented!" , False )
963- return
964-
965- if self .video_info .fps < 31.0 and self .params .skip_frames > 0 :
966- self .logger .warning ("The Video has less than 30 frames per seconds and you have set skip_frames to %d " \
967- + "this can lead to inaccuracies when predicting the changepoint positions! (consider to set skip_frames to 0)" \
968- , self .params .skip_frames )
969-
970- if self .params .raw_output :
971- self .logger .warning ("Raw output is enabled!" )
972-
973- # NOTE: score['y'] and score['x'] should have the same number size so it should be enouth to check one score length
974- with Listener (on_press = self .on_key_press ) as listener :
975- status = self .tracking ()
976-
977- if self .params .use_kalman_filter :
978- self .apply_kalman_filter ()
979-
980- if len (self .score ['y' ]) >= HYPERPARAMETER ['min_frames' ]:
981- self .logger .info ("Scale score" )
982- self .scale_score (status , direction = self .params .direction )
983-
984- if len (self .score ['y' ]) < HYPERPARAMETER ['min_frames' ]:
985- self .finished (status + ' -> Tracking time insufficient' , False )
986- return
987-
988- idx_dict = self .determin_change_points ()
989-
990- if False :
991- idx_list = [x for k in ['min' , 'max' ] for x in idx_dict [k ]]
992- idx_list .sort ()
993- self .plot_y_score ('debug.png' , idx_list )
994-
995- self .create_funscript (idx_dict )
996- self .finished (status , True )
961+ try :
962+ if self .params .direction == 'd' and not self .params .track_men :
963+ self .finished ("Tracking with 'd' and no men tracker is not implemented!" , False )
964+ return
965+
966+ if self .video_info .fps < 31.0 and self .params .skip_frames > 0 :
967+ self .logger .warning ("The Video has less than 30 frames per seconds and you have set skip_frames to %d " \
968+ + "this can lead to inaccuracies when predicting the changepoint positions! (consider to set skip_frames to 0)" \
969+ , self .params .skip_frames )
970+
971+ if self .params .raw_output :
972+ self .logger .warning ("Raw output is enabled!" )
973+
974+ # NOTE: score['y'] and score['x'] should have the same number size so it should be enouth to check one score length
975+ with Listener (on_press = self .on_key_press ) as listener :
976+ status = self .tracking ()
977+
978+ if self .params .use_kalman_filter :
979+ self .apply_kalman_filter ()
980+
981+ if len (self .score ['y' ]) >= HYPERPARAMETER ['min_frames' ]:
982+ self .logger .info ("Scale score" )
983+ self .scale_score (status , direction = self .params .direction )
984+
985+ if len (self .score ['y' ]) < HYPERPARAMETER ['min_frames' ]:
986+ self .finished (status + ' -> Tracking time insufficient' , False )
987+ return
988+
989+ idx_dict = self .determin_change_points ()
990+
991+ if False :
992+ idx_list = [x for k in ['min' , 'max' ] for x in idx_dict [k ]]
993+ idx_list .sort ()
994+ self .plot_y_score ('debug.png' , idx_list )
995+
996+ self .create_funscript (idx_dict )
997+ self .finished (status , True )
998+ except Exception as ex :
999+ self .logger .critical ("The program crashed due to a fatal error. " \
1000+ + "Please open an issue on github with the corresponding log file and application configuration" , exc_info = ex )
1001+ self .finished ("The program crashed due to a fatal error" , False )
0 commit comments