Skip to content
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
31 changes: 16 additions & 15 deletions Source/Common/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ void Core::register_report_xml_to_database(int user, long file, const std::strin
}

//---------------------------------------------------------------------------
void Core::register_report_mediainfo_text_to_database(int user, long file, MediaInfoNameSpace::MediaInfo* curMI)
void Core::register_report_mediainfo_text_to_database(int user, long file, const std::string& options, MediaInfoNameSpace::MediaInfo* curMI)
{
curMI->Option(__T("Details"), __T("0"));
curMI->Option(__T("Inform"), String());
Expand All @@ -841,12 +841,12 @@ void Core::register_report_mediainfo_text_to_database(int user, long file, Media
std::string err;
db_mutex.Enter();
get_db()->save_report(user, file, MediaConchLib::report_MediaInfo, MediaConchLib::format_Text,
"", report, mode, mil_version(), err);
options, report, mode, mil_version(), err);
db_mutex.Leave();
}

//---------------------------------------------------------------------------
void Core::register_report_mediainfo_xml_to_database(int user, long file, MediaInfoNameSpace::MediaInfo* curMI)
void Core::register_report_mediainfo_xml_to_database(int user, long file, const std::string& options, MediaInfoNameSpace::MediaInfo* curMI)
{
curMI->Option(__T("Details"), __T("0"));
curMI->Option(__T("Inform"), __T("MIXML"));
Expand All @@ -857,12 +857,12 @@ void Core::register_report_mediainfo_xml_to_database(int user, long file, MediaI
std::string err;
db_mutex.Enter();
get_db()->save_report(user, file, MediaConchLib::report_MediaInfo, MediaConchLib::format_Xml,
"", report, mode, mil_version(), err);
options, report, mode, mil_version(), err);
db_mutex.Leave();
}

//---------------------------------------------------------------------------
void Core::register_report_micromediatrace_xml_to_database(int user, long file, MediaInfoNameSpace::MediaInfo* curMI)
void Core::register_report_micromediatrace_xml_to_database(int user, long file, const std::string& options, MediaInfoNameSpace::MediaInfo* curMI)
{
curMI->Option(__T("Details"), __T("1"));
curMI->Option(__T("Inform"), __T("MICRO_XML"));
Expand Down Expand Up @@ -892,7 +892,7 @@ void Core::register_report_micromediatrace_xml_to_database(int user, long file,
std::string err;
db_mutex.Enter();
get_db()->save_report(user, file, MediaConchLib::report_MicroMediaTrace, MediaConchLib::format_Xml,
"", report, mode, mil_version(), err);
options, report, mode, mil_version(), err);
db_mutex.Leave();
}

Expand All @@ -914,29 +914,30 @@ void Core::register_reports_to_database(int user, long file, const std::string&
register_report_xml_to_database(user, file, report, report_kind, options);

//MI and MT
register_reports_to_database(user, file, curMI);
register_reports_to_database(user, file, options, curMI);
}

//---------------------------------------------------------------------------
void Core::register_reports_to_database(int user, long file, MediaInfoNameSpace::MediaInfo* curMI)
void Core::register_reports_to_database(int user, long file, const std::string& options,
MediaInfoNameSpace::MediaInfo* curMI)
{
// MediaInfo
register_report_mediainfo_text_to_database(user, file, curMI);
register_report_mediainfo_xml_to_database(user, file, curMI);
register_report_mediainfo_text_to_database(user, file, options, curMI);
register_report_mediainfo_xml_to_database(user, file, options, curMI);

// MicroMediaTrace
register_report_micromediatrace_xml_to_database(user, file, curMI);
register_report_micromediatrace_xml_to_database(user, file, options, curMI);
}

//---------------------------------------------------------------------------
void Core::register_reports_to_database(int user, long file)
void Core::register_reports_to_database(int user, long file, const std::string& options)
{
// MediaInfo
register_report_mediainfo_text_to_database(user, file, MI);
register_report_mediainfo_xml_to_database(user, file, MI);
register_report_mediainfo_text_to_database(user, file, options, MI);
register_report_mediainfo_xml_to_database(user, file, options, MI);

// MicroMediaTrace
register_report_micromediatrace_xml_to_database(user, file, MI);
register_report_micromediatrace_xml_to_database(user, file, options, MI);
}

//---------------------------------------------------------------------------
Expand Down
11 changes: 6 additions & 5 deletions Source/Common/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ class Core
// Report Database access
//***************************************************************************
void set_file_analyzed_to_database(int user, long id);
void register_reports_to_database(int user, long file, MediaInfoNameSpace::MediaInfo* MI);
void register_reports_to_database(int user, long file, const std::string& options,
MediaInfoNameSpace::MediaInfo* MI);
void register_reports_to_database(int user, long file, const std::string& report,
MediaConchLib::report report_kind, const std::string& options,
MediaInfoNameSpace::MediaInfo* curMI);
Expand Down Expand Up @@ -245,12 +246,12 @@ class Core
std::string get_last_modification_file(const std::string& file);
bool file_is_existing(const std::string& filename);

void register_reports_to_database(int user, long file);
void register_reports_to_database(int user, long file, const std::string& options);
void register_report_xml_to_database(int user, long file, const std::string& report,
MediaConchLib::report report_kind, const std::string& options);
void register_report_mediainfo_text_to_database(int user, long file, MediaInfoNameSpace::MediaInfo* MI);
void register_report_mediainfo_xml_to_database(int user, long file, MediaInfoNameSpace::MediaInfo* MI);
void register_report_micromediatrace_xml_to_database(int user, long file, MediaInfoNameSpace::MediaInfo* MI);
void register_report_mediainfo_text_to_database(int user, long file, const std::string& options, MediaInfoNameSpace::MediaInfo* MI);
void register_report_mediainfo_xml_to_database(int user, long file,const std::string& options, MediaInfoNameSpace::MediaInfo* MI);
void register_report_micromediatrace_xml_to_database(int user, long file,const std::string& options, MediaInfoNameSpace::MediaInfo* MI);

std::string get_config_file();
std::string get_database_path();
Expand Down
52 changes: 33 additions & 19 deletions Source/Common/SQLLiteReport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,9 @@ long SQLLiteReport::get_file_id(int user, const std::string& filename, const std
create << "SELECT " << key << " FROM MEDIACONCH_FILE";
create << " WHERE FILENAME = ?";
create << " AND USER = ?";
create << " AND OPTIONS = ?";
if (file_last_modification.size())
if (!options.empty())
create << " AND OPTIONS = ?";
if (!file_last_modification.empty())
create << " AND FILE_LAST_MODIFICATION = ?";
create << ";";
query = create.str();
Expand All @@ -402,16 +403,19 @@ long SQLLiteReport::get_file_id(int user, const std::string& filename, const std
return -1;
}

ret = sqlite3_bind_text(stmt, 3, options.c_str(), options.size(), SQLITE_STATIC);
if (ret != SQLITE_OK)
if (!options.empty())
{
err = get_sqlite_error(ret);
return -1;
ret = sqlite3_bind_text(stmt, 3, options.c_str(), options.size(), SQLITE_STATIC);
if (ret != SQLITE_OK)
{
err = get_sqlite_error(ret);
return -1;
}
}

if (file_last_modification.size())
if (!file_last_modification.empty())
{
ret = sqlite3_bind_blob(stmt, 4, file_last_modification.c_str(), file_last_modification.length(), SQLITE_STATIC);
ret = sqlite3_bind_blob(stmt, options.empty() ? 3 : 4, file_last_modification.c_str(), file_last_modification.length(), SQLITE_STATIC);
if (ret != SQLITE_OK)
{
err = get_sqlite_error(ret);
Expand Down Expand Up @@ -1133,7 +1137,9 @@ int SQLLiteReport::get_report(int user, long file_id, MediaConchLib::report repo
create << "FILE_ID = ? ";
create << "AND TOOL = ? ";
create << "AND FORMAT = ?";
create << "AND OPTIONS = ?;";
if (!options.empty())
create << " AND OPTIONS = ?";
create << ";";
query = create.str();

if (prepare_v2(query, err) < 0)
Expand All @@ -1160,11 +1166,14 @@ int SQLLiteReport::get_report(int user, long file_id, MediaConchLib::report repo
return -1;
}

ret = sqlite3_bind_text(stmt, 4, options.c_str(), options.size(), SQLITE_STATIC);
if (ret != SQLITE_OK)
if (!options.empty())
{
err = get_sqlite_error(ret);
return -1;
ret = sqlite3_bind_text(stmt, 4, options.c_str(), options.size(), SQLITE_STATIC);
if (ret != SQLITE_OK)
{
err = get_sqlite_error(ret);
return -1;
}
}

if (execute() < 0 || !reports.size())
Expand Down Expand Up @@ -1215,8 +1224,10 @@ int SQLLiteReport::report_is_registered(int user, long file_id, MediaConchLib::r
create << "SELECT " << key << " FROM MEDIACONCH_REPORT WHERE ";
create << "FILE_ID = ? ";
create << "AND TOOL = ? ";
create << "AND FORMAT = ? ";
create << "AND OPTIONS = ?;";
create << "AND FORMAT = ?";
if (!options.empty())
create << " AND OPTIONS = ?";
create << ";";
query = create.str();

if (prepare_v2(query, err) < 0)
Expand All @@ -1243,11 +1254,14 @@ int SQLLiteReport::report_is_registered(int user, long file_id, MediaConchLib::r
return -1;
}

ret = sqlite3_bind_text(stmt, 4, options.c_str(), options.size(), SQLITE_STATIC);
if (ret != SQLITE_OK)
if (!options.empty())
{
err = get_sqlite_error(ret);
return -1;
ret = sqlite3_bind_text(stmt, 4, options.c_str(), options.size(), SQLITE_STATIC);
if (ret != SQLITE_OK)
{
err = get_sqlite_error(ret);
return -1;
}
}

if (execute())
Expand Down
4 changes: 2 additions & 2 deletions Source/Common/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ namespace MediaConch {

CS.Enter();
if (!el->errored())
core->register_reports_to_database(el->user, el->file_id, MI);
core->register_reports_to_database(el->user, el->file_id, Core::serialize_string_from_options_vec(el->options), MI);
else
{
std::string err;
Expand Down Expand Up @@ -302,7 +302,7 @@ namespace MediaConch {
MediaConchLib::report report_kind = ((PluginFormat*)p)->get_report_kind();

CS.Enter();
core->register_reports_to_database(el->user, el->file_id, report, report_kind, "", MI);
core->register_reports_to_database(el->user, el->file_id, report, report_kind, Core::serialize_string_from_options_vec(el->options), MI);
remove_element(el);
CS.Leave();
run_element();
Expand Down
2 changes: 1 addition & 1 deletion Source/GUI/Qt/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ int MainWindow::analyze(const std::vector<std::string>& files, bool with_fixer,

for (size_t i = 0; i + 1 < opt.size();)
{
if (opt[i] != "File_TryToFix" && opt[i] != "file_parsespeed")
if (!(with_fixer && (opt[i] == "File_TryToFix" || opt[i] == "file_parsespeed")))
options.push_back(std::make_pair(opt[i], opt[i + 1]));
i += 2;
}
Expand Down
Loading