11json = require " json"
2- -- MTFG LUA Wrappper Version 2.0.1
2+ -- MTFG LUA Wrappper Version 2.0.0
33
44-- global var
55processHandleMTFG = nil
@@ -52,9 +52,11 @@ function binding.start_funscript_generator()
5252 local video = player .CurrentVideo ()
5353 local script = ofs .Script (scriptIdx )
5454 local currentTimeMs = player .CurrentTime () * 1000
55+ local fps = player .FPS ()
5556
5657 print (" tmpFile: " , tmpFile )
5758 print (" video: " , video )
59+ print (" fps" , fps )
5860 print (" currentScriptIdx: " , scriptIdx )
5961 print (" currentTimeMs: " , currentTimeMs )
6062
@@ -125,6 +127,9 @@ function import_funscript_generator_json_result()
125127 json_body = json .decode (content )
126128 actions = json_body [" actions" ]
127129
130+ local fps = player .FPS ()
131+ local frame_time = 1.0 / fps
132+ print (" Frame Time:" , frame_time )
128133 local filtered = 0
129134 if multiaxis then
130135 local i = 1
@@ -136,10 +141,11 @@ function import_funscript_generator_json_result()
136141 script = ofs .Script (i )
137142 for _ , action in pairs (actions [k ]) do
138143 local closest_action , _ = script :closestAction (action [" at" ])
139- if filterSimilarTimestamps and closest_action and math.abs (closest_action .at - (action [" at" ]/ 1000.0 )) < 0.01 then
144+ local new_action = Action .new (action [" at" ]/ 1000.0 , action [" pos" ], true )
145+ if filterSimilarTimestamps and closest_action and math.abs (closest_action .at - new_action .at ) <= frame_time then
140146 filtered = filtered + 1
141147 else
142- script .actions :add (Action . new ( action [ " at " ] / 1000.0 , action [ " pos " ], true ) )
148+ script .actions :add (new_action )
143149 end
144150 end
145151 script :commit ()
@@ -155,10 +161,11 @@ function import_funscript_generator_json_result()
155161 print (' add ' , metric , ' to ' , ofs .ScriptName (scriptIdx ))
156162 for _ , action in pairs (actions_metric ) do
157163 local closest_action , _ = script :closestAction (action [" at" ]/ 1000.0 )
158- if filterSimilarTimestamps and closest_action and math.abs (closest_action .at - (action [" at" ]/ 1000.0 )) < 0.01 then
164+ local new_action = Action .new (action [" at" ]/ 1000.0 , action [" pos" ], true )
165+ if filterSimilarTimestamps and closest_action and math.abs (closest_action .at - new_action .at ) <= frame_time then
159166 filtered = filtered + 1
160167 else
161- script .actions :add (Action . new ( action [ " at " ] / 1000.0 , action [ " pos " ], true ) )
168+ script .actions :add (new_action )
162169 end
163170 end
164171 end
279286
280287
281288function init ()
289+ print (" OFS Version:" , ofs .Version ())
282290 print (" Detected OS: " , platform )
283291 local version_file_path = " "
284292 if platform == " Windows" then
0 commit comments