@@ -178,17 +178,45 @@ def __cut_completed(self, cut_values):
178178 def __scaling_completed (self , score ):
179179 self .score = score
180180 self .__logger .info ('scaling completed' )
181+
182+ # 1. Now first save the raw tracking data
183+
184+ print ("score" , score )
185+ for metric in self .funscripts :
186+ for idx , val in enumerate (self .score [metric ]):
187+ print ("add" , idx , val )
188+ self .funscripts [metric ].add_action (
189+ round (val ),
190+ FFmpegStream .frame_to_millisec (self .get_absolute_framenumber (idx ), self .video_info .fps ),
191+ True
192+ )
193+
194+ raw_tracking_data_json_output = {
195+ 'version' : 1 ,
196+ 'actions' : {}
197+ }
198+
199+ for key in self .funscripts :
200+ raw_tracking_data_json_output ['actions' ][key ] = []
201+ for item in self .funscripts [key ].get_actions ():
202+ print ("transfere" , item )
203+ raw_tracking_data_json_output ['actions' ][key ].append (item )
204+
205+ os .makedirs (definitions .CACHE_DIR , exist_ok = True )
206+ with open (definitions .RAW_TRACKING_DATA_CAHCE_FILE , 'w' ) as f :
207+ print ("dump" , raw_tracking_data_json_output )
208+ json .dump (raw_tracking_data_json_output , f )
209+
210+ # 2. Continue with selected user option on raw data
211+
181212 if not self .raw_output :
213+ self .__logger .info ("Post Processing Data" )
214+ #NOTE: delete the raw data from funscript
215+ for key in self .funscripts :
216+ self .funscripts [key ].clear_actions ()
182217 self .__next_postprocessing (None , [], [])
183218 else :
184219 self .__logger .info ("Raw Output" )
185- for metric in self .funscripts :
186- for idx , val in enumerate (self .score [metric ]):
187- self .funscripts [metric ].add_action (
188- round (val ),
189- FFmpegStream .frame_to_millisec (self .get_absolute_framenumber (idx ), self .video_info .fps )
190- )
191-
192220 self .__funscript_generated (self .funscripts , "OK" , True )
193221
194222
@@ -199,7 +227,8 @@ def __next_postprocessing(self, last_metric, idx_keep, val_keep):
199227 for idx , val in zip (idx_keep , val_keep ):
200228 self .funscripts [last_metric ].add_action (
201229 round (val ),
202- FFmpegStream .frame_to_millisec (self .get_absolute_framenumber (idx ), self .video_info .fps )
230+ FFmpegStream .frame_to_millisec (self .get_absolute_framenumber (idx ), self .video_info .fps ),
231+ True
203232 )
204233
205234 found_last = last_metric is None
0 commit comments