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
11 changes: 10 additions & 1 deletion Source/CLI/CLI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void __stdcall Event_CallBackFunction(unsigned char* Data_Content, size_t Data_S

//--------------------------------------------------------------------------
CLI::CLI() : watch_folder_user(NULL), use_as_user(-1), use_daemon(false), asynchronous(false),
force_analyze(false), full_report(false), include_hidden_files(false), mil_analyze(true),
force_analyze(false), full_report(false), no_database(false), include_hidden_files(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), fixer(false)
Expand All @@ -146,6 +146,9 @@ void __stdcall Event_CallBackFunction(unsigned char* Data_Content, size_t Data_S
return CLI_RETURN_ERROR;
}

if (no_database)
MCL.set_no_database(no_database);

if (!no_needs_files_mode)
{
// If no filenames (and no options)
Expand Down Expand Up @@ -1045,6 +1048,12 @@ void __stdcall Event_CallBackFunction(unsigned char* Data_Content, size_t Data_S
force_analyze = force;
}

//--------------------------------------------------------------------------
void CLI::set_no_database(bool no_db)
{
no_database = no_db;
}

//--------------------------------------------------------------------------
void CLI::set_mil_analyze(bool analyze)
{
Expand Down
2 changes: 2 additions & 0 deletions Source/CLI/CLI.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ namespace MediaConch
int set_user_to_use(const std::string& user);
int set_compression_mode(const std::string& mode_str);
void set_force_analyze(bool force);
void set_no_database(bool no_db);
void set_mil_analyze(bool analyze);
void set_asynchronous(bool async);
void set_create_policy_mode();
Expand Down Expand Up @@ -103,6 +104,7 @@ namespace MediaConch
bool use_daemon;
bool asynchronous;
bool force_analyze;
bool no_database;
bool full_report;
bool include_hidden_files;
bool mil_analyze;
Expand Down
13 changes: 13 additions & 0 deletions Source/CLI/CommandLine_Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,14 @@ static void change_short_options_to_long(std::string& argument)
argument = "--help=Advanced";
if (argument=="-v")
argument = "--version";

// Main short options
if (argument=="-f")
argument = "--force";
if (argument=="-nmil")
argument = "--nomilanalyze";
if (argument=="-ndb")
argument = "--nodatabase";

// Backward compatibility
if (argument=="-tc")
Expand Down Expand Up @@ -272,6 +276,7 @@ int Parse(MediaConch::CLI* cli, std::string& argument)
OPTION("--full", Full)
OPTION("--includehidden", IncludeHidden)
OPTION("--nomilanalyze", NoMilAnalyze)
OPTION("--nodatabase", NoDatabase)
OPTION("--async", Asynchronous)
OPTION("--pluginslist", PluginsList)
OPTION("--useplugin", UsePlugin)
Expand Down Expand Up @@ -547,6 +552,14 @@ CL_OPTION(NoMilAnalyze)
return CLI_RETURN_NONE;
}

//---------------------------------------------------------------------------
CL_OPTION(NoDatabase)
{
(void)argument;
cli->set_no_database(true);
return CLI_RETURN_NONE;
}

//---------------------------------------------------------------------------
CL_OPTION(Asynchronous)
{
Expand Down
1 change: 1 addition & 0 deletions Source/CLI/CommandLine_Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ CL_OPTION(Force);
CL_OPTION(Full);
CL_OPTION(IncludeHidden);
CL_OPTION(NoMilAnalyze);
CL_OPTION(NoDatabase);
CL_OPTION(Asynchronous);
CL_OPTION(UsePlugin);
CL_OPTION(PluginsList);
Expand Down
2 changes: 2 additions & 0 deletions Source/CLI/Help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ int Help_Advanced()
TEXTOUT(" Full MediaInfo report (needed by some policies)");
TEXTOUT("--NoMilAnalyze, -nmil");
TEXTOUT(" Do not analyze with MediaInfoLib");
TEXTOUT("--NoDatabase, -ndb");
TEXTOUT(" Do not read or write to the persistant database");
TEXTOUT("--Async=yes, -as");
TEXTOUT(" Analyze asynchronously the files,");
TEXTOUT(" need to launch again the command to have the result");
Expand Down
36 changes: 26 additions & 10 deletions Source/Common/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Core::Core() : policies(this), reports(this)
watch_folders_manager = new WatchFoldersManager(this);
policies.create_values_from_csv();
compression_mode = MediaConchLib::compression_ZLib;
no_database = false;
}

Core::~Core()
Expand Down Expand Up @@ -154,18 +155,21 @@ void Core::load_plugins_configuration()
void Core::load_database()
{
#ifdef HAVE_SQLITE
std::string db_path;
if (!config || config->get("SQLite_Path", db_path) < 0)
db_path = get_database_path();
if (!no_database)
{
std::string db_path;
if (!config || config->get("SQLite_Path", db_path) < 0)
db_path = get_database_path();

db = new SQLLiteReport;
db = new SQLLiteReport;

((Database*)db)->set_database_directory(db_path);
db->set_database_filename(database_name);
if (db->init_report() < 0)
{
delete db;
db = NULL;
((Database*)db)->set_database_directory(db_path);
db->set_database_filename(database_name);
if (db->init_report() < 0)
{
delete db;
db = NULL;
}
}
#endif
if (!db)
Expand Down Expand Up @@ -264,6 +268,18 @@ void Core::set_compression_mode(MediaConchLib::compression compress)
compression_mode = compress;
}

//---------------------------------------------------------------------------
void Core::set_no_database(bool ndb)
{
no_database = ndb;
if (db)
{
delete db;
db = NULL;
}
load_database();
}

//---------------------------------------------------------------------------
int Core::get_ui_poll_request() const
{
Expand Down
4 changes: 3 additions & 1 deletion Source/Common/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class Core
void set_implementation_verbosity(const std::string& verbosity);
const std::string& get_implementation_verbosity();
void set_compression_mode(MediaConchLib::compression compress);
void set_no_database(bool no_database);
int get_ui_poll_request() const;
int get_ui_database_path(std::string& path) const;
bool is_using_daemon() const;
Expand Down Expand Up @@ -227,8 +228,9 @@ class Core
std::map<std::string, std::string> implementation_options;
Scheduler *scheduler;
PluginsManager *plugins_manager;
WatchFoldersManager *watch_folders_manager;
WatchFoldersManager *watch_folders_manager;
MediaConchLib::compression compression_mode;
bool no_database;

bool has_outcome_fail(const std::string& report);

Expand Down
7 changes: 7 additions & 0 deletions Source/Common/MediaConchLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,13 @@ void MediaConchLib::set_compression_mode(compression compress)
core->set_compression_mode(compress);
}

//---------------------------------------------------------------------------
void MediaConchLib::set_no_database(bool no_database)
{
if (core)
core->set_no_database(no_database);
}

//---------------------------------------------------------------------------
int MediaConchLib::get_ui_poll_request() const
{
Expand Down
1 change: 1 addition & 0 deletions Source/Common/MediaConchLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ class MediaConchLib
void load_plugins_configuration();
void set_plugins_configuration_file(const std::string& file);
void set_compression_mode(compression compress);
void set_no_database(bool no_database);
int get_ui_poll_request() const;
int get_ui_database_path(std::string& path) const;

Expand Down