@@ -111,7 +111,7 @@ void config_blur::create(const std::filesystem::path& filepath, const BlurSettin
111111 output << " blur amount tied to fps: " << (current_settings.blur_amount_tied_to_fps ? " true" : " false" ) << " \n " ;
112112}
113113
114- config_blur::ConfigValidationResponse config_blur::validate (BlurSettings& config, bool fix) {
114+ tl::expected< void , std::string> config_blur::validate (BlurSettings& config, bool fix) {
115115 std::set<std::string> errors;
116116
117117 if (!u::contains (SVP_INTERPOLATION_PRESETS, config.advanced .svp_interpolation_preset )) {
@@ -141,10 +141,10 @@ config_blur::ConfigValidationResponse config_blur::validate(BlurSettings& config
141141 config.advanced .interpolation_blocksize = DEFAULT_CONFIG.advanced .interpolation_blocksize ;
142142 }
143143
144- return ConfigValidationResponse{
145- . success = errors. empty (),
146- . error = u::join (errors, " " ),
147- };
144+ if (!errors. empty ())
145+ return tl::unexpected ( u::join (errors, " " ));
146+
147+ // ok:)
148148}
149149
150150BlurSettings config_blur::parse (const std::filesystem::path& config_filepath) {
@@ -294,7 +294,7 @@ BlurSettings config_blur::get_config(const std::filesystem::path& config_filepat
294294 return parse (cfg_path);
295295}
296296
297- BlurSettings::ToJsonResult BlurSettings::to_json () const {
297+ tl::expected<nlohmann::json, std::string> BlurSettings::to_json () const {
298298 nlohmann::json j;
299299
300300 j[" blur" ] = this ->blur ;
@@ -358,23 +358,17 @@ BlurSettings::ToJsonResult BlurSettings::to_json() const {
358358 j[" interpolation_mask_area" ] = this ->advanced .interpolation_mask_area ;
359359
360360 auto rife_model_path = get_rife_model_path ();
361- if (!rife_model_path.success ) {
362- return {
363- .success = false ,
364- .error_message = rife_model_path.error_message ,
365- };
366- }
367- j[" rife_model" ] = *rife_model_path.rife_model_path ;
361+ if (!rife_model_path)
362+ return tl::unexpected (rife_model_path.error ());
363+
364+ j[" rife_model" ] = *rife_model_path;
368365
369366 j[" manual_svp" ] = this ->advanced .manual_svp ;
370367 j[" super_string" ] = this ->advanced .super_string ;
371368 j[" vectors_string" ] = this ->advanced .vectors_string ;
372369 j[" smooth_string" ] = this ->advanced .smooth_string ;
373370
374- return {
375- .success = true ,
376- .json = j,
377- };
371+ return j;
378372}
379373
380374BlurSettings::BlurSettings () {
@@ -405,7 +399,7 @@ void BlurSettings::verify_gpu_encoding() {
405399}
406400
407401// NOLINTBEGIN(readability-convert-member-functions-to-static) other platforms need it
408- BlurSettings::GetRifeModelResult BlurSettings::get_rife_model_path () const {
402+ tl::expected<std::filesystem::path, std::string> BlurSettings::get_rife_model_path () const {
409403 // NOLINTEND(readability-convert-member-functions-to-static)
410404 std::filesystem::path rife_model_path;
411405
@@ -419,16 +413,10 @@ BlurSettings::GetRifeModelResult BlurSettings::get_rife_model_path() const {
419413# endif
420414
421415 if (!std::filesystem::exists (rife_model_path))
422- return {
423- .success = false ,
424- .error_message = std::format (" RIFE model '{}' could not be found" , this ->advanced .rife_model ),
425- };
416+ return tl::unexpected (std::format (" RIFE model '{}' could not be found" , this ->advanced .rife_model ));
426417#endif
427418
428- return {
429- .success = true ,
430- .rife_model_path = rife_model_path,
431- };
419+ return rife_model_path;
432420}
433421
434422void BlurSettings::set_fastest_rife_gpu () {
@@ -440,9 +428,10 @@ void BlurSettings::set_fastest_rife_gpu() {
440428
441429 if (sample_video_exists) {
442430 auto rife_model_path = BlurSettings::get_rife_model_path ();
443- if (rife_model_path.success ) {
431+
432+ if (rife_model_path) {
444433 int fastest_gpu_index =
445- u::get_fastest_rife_gpu_index (blur_copy.rife_gpus , *rife_model_path. rife_model_path , sample_video_path);
434+ u::get_fastest_rife_gpu_index (blur_copy.rife_gpus , *rife_model_path, sample_video_path);
446435
447436 this ->rife_gpu_index = fastest_gpu_index;
448437 u::log (" set rife_gpu_index to the fastest gpu ({})" , fastest_gpu_index);
0 commit comments