Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force ParseSpeed to 1 when fixer #795

Merged
merged 1 commit into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion Source/CLI/CLI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "Common/Reports.h"
#include <Common/MediaConchLib.h>
#include <ZenLib/ZtringList.h>
#include <ZenLib/Ztring.h>
#include <ZenLib/File.h>
#include <ZenLib/Dir.h>

Expand Down Expand Up @@ -126,7 +127,7 @@ void __stdcall Event_CallBackFunction(unsigned char* Data_Content, size_t Data_S
force_analyze(false), mil_analyze(true),
watch_folder_recursive(true), create_policy_mode(false), file_information(false),
plugins_list_mode(false), list_watch_folders_mode(false), no_needs_files_mode(false),
list_mode(false)
list_mode(false), fixer(false)
{
format = MediaConchLib::format_Max;
}
Expand Down Expand Up @@ -931,6 +932,23 @@ void __stdcall Event_CallBackFunction(unsigned char* Data_Content, size_t Data_S
return CLI_RETURN_FINISH;
}

ZenLib::Ztring str = ZenLib::Ztring().From_UTF8(key.c_str());
if (str.Compare(__T("File_TryToFix")))
{
fixer = true;
options.push_back(std::make_pair(key, value));
options.push_back(std::make_pair("file_parsespeed", "1"));
}
else if (fixer && (str.Compare(__T("File_ParseSpeed")) || str.Compare(__T("ParseSpeed"))))
{
ZenLib::Ztring str = ZenLib::Ztring().From_UTF8(value.c_str());
if (str != __T("1"))
{
STRINGOUT(ZenLib::Ztring().From_UTF8("ParseSpeed option must be set to 1 with File_TryToFix option."));
return CLI_RETURN_ERROR;
}
}

options.push_back(std::make_pair(key, value));
return CLI_RETURN_NONE;
}
Expand Down
1 change: 1 addition & 0 deletions Source/CLI/CLI.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ namespace MediaConch
bool list_watch_folders_mode;
bool no_needs_files_mode;
bool list_mode;
bool fixer;
};

}
Expand Down
16 changes: 10 additions & 6 deletions Source/GUI/Qt/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,14 @@ int MainWindow::add_file_to_list(const QString& file, const QString& path,
uisettings.change_last_display(displays_list[display_i].toUtf8().data());
uisettings.change_last_verbosity(verbosity_i);

int parsespeed_idx = options.lastIndexOf("file_parsespeed");
if (parsespeed_idx != -1 && parsespeed_idx < options.size())
uisettings.change_last_parsespeed(options[parsespeed_idx + 1].toStdString());
else
uisettings.change_last_parsespeed("");
if (!fixer)
{
int parsespeed_idx = options.lastIndexOf("file_parsespeed");
if (!fixer && parsespeed_idx != -1 && parsespeed_idx < options.size())
uisettings.change_last_parsespeed(options[parsespeed_idx + 1].toStdString());
else
uisettings.change_last_parsespeed("");
}

std::string full_path = filepath;
#ifdef WINDOWS
Expand Down Expand Up @@ -1414,12 +1417,13 @@ int MainWindow::analyze(const std::vector<std::string>& files, bool with_fixer,
if (with_fixer)
{
options.push_back(std::make_pair("File_TryToFix", "1"));
options.push_back(std::make_pair("file_parsespeed", "1"));
force = true;
}

for (size_t i = 0; i + 1 < opt.size();)
{
if (opt[i] != "File_TryToFix")
if (opt[i] != "File_TryToFix" && opt[i] != "file_parsespeed")
options.push_back(std::make_pair(opt[i], opt[i + 1]));
i += 2;
}
Expand Down
26 changes: 26 additions & 0 deletions Source/Resource/html/js/checker/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@ var checker = (function() {
bindings();

//
var checkerUpload_parsespeed_val_save = $('#checkerUpload_parsespeed_selector').val()
$('#checkerUpload_fixer').on('click', function(e) {
if ($('#checkerUpload_fixer').is(':checked')) {
$('#checkerUpload_parsespeed_selector').prop( "disabled", true);
checkerUpload_parsespeed_val_save = $('#checkerUpload_parsespeed_selector').val()
$('#checkerUpload_parsespeed_selector').val('1');
}
else {
$('#checkerUpload_parsespeed_selector').prop( "disabled", false);
$('#checkerUpload_parsespeed_selector').val(checkerUpload_parsespeed_val_save);
}
})

var checkerRepository_parsespeed_val_save = $('#checkerRepository_parsespeed_selector').val()
$('#checkerRepository_fixer').on('click', function(e) {
if ($('#checkerRepository_fixer').is(':checked')) {
$('#checkerRepository_parsespeed_selector').prop( "disabled", true);
checkerRepository_parsespeed_val_save = $('#checkerRepository_parsespeed_selector').val()
$('#checkerRepository_parsespeed_selector').val('1');
}
else {
$('#checkerRepository_parsespeed_selector').prop( "disabled", false);
$('#checkerRepository_parsespeed_selector').val(checkerRepository_parsespeed_val_save);
}
})

webpage.set_parse_speed($('.parsespeedList').val());
$('.parsespeedList').change(function(){
webpage.set_parse_speed($(this).val());
Expand Down
Loading