X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic_batch.cc;h=273078b8922c6aa832ed2244058f2d39c82e3fc6;hb=00e41726073ccaabe5cb0899cce74c7c72721a06;hp=b73d0a4184cefd39ad2ecaed34ea50178115df85;hpb=4e4968464eeef1956cb82392e1fc3b27a792ab89;p=dcpomatic.git diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index b73d0a418..273078b89 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -22,6 +22,7 @@ #include "wx/about_dialog.h" #include "wx/dcpomatic_button.h" #include "wx/full_config_dialog.h" +#include "wx/id.h" #include "wx/job_manager_view.h" #include "wx/servers_list_dialog.h" #include "wx/wx_ptr.h" @@ -31,12 +32,16 @@ #include "lib/config.h" #include "lib/dcpomatic_socket.h" #include "lib/film.h" +#ifdef DCPOMATIC_GROK +#include "lib/grok/context.h" +#endif #include "lib/job.h" #include "lib/job_manager.h" #include "lib/make_dcp.h" #include "lib/transcode_job.h" #include "lib/util.h" #include "lib/version.h" +#include #include LIBDCP_DISABLE_WARNINGS #include @@ -70,7 +75,7 @@ static list films_to_load; enum { - ID_file_add_film = 1, + ID_file_add_film = DCPOMATIC_MAIN_MENU, ID_tools_encoding_servers, ID_help_about }; @@ -129,7 +134,7 @@ public: if (filenames.GetCount() == 1) { /* Try to load a directory */ auto path = boost::filesystem::path(wx_to_std(filenames[0])); - if (boost::filesystem::is_directory(path)) { + if (dcp::filesystem::is_directory(path)) { _frame->start_job(wx_to_std(filenames[0])); return true; } @@ -287,6 +292,7 @@ private: } ev.Skip (); + JobManager::drop (); } void file_add_film () @@ -391,30 +397,30 @@ static const wxCmdLineEntryDesc command_line_description[] = { }; -class JobServer : public Server +class JobServer : public Server, public Signaller { public: - explicit JobServer (DOMFrame* frame) + JobServer() : Server (BATCH_JOB_PORT) - , _frame (frame) {} void handle (shared_ptr socket) override { try { - int const length = socket->read_uint32 (); - scoped_array buffer(new char[length]); - socket->read (reinterpret_cast(buffer.get()), length); - string s (buffer.get()); - _frame->start_job (s); - socket->write (reinterpret_cast("OK"), 3); + auto const length = socket->read_uint32(); + if (length < 65536) { + scoped_array buffer(new char[length]); + socket->read(reinterpret_cast(buffer.get()), length); + string s(buffer.get()); + emit(boost::bind(boost::ref(StartJob), s)); + socket->write (reinterpret_cast("OK"), 3); + } } catch (...) { } } -private: - DOMFrame* _frame; + boost::signals2::signal StartJob; }; @@ -469,7 +475,8 @@ class App : public wxApp _frame->Show (); try { - auto server = new JobServer (_frame); + auto server = new JobServer(); + server->StartJob.connect(bind(&DOMFrame::start_job, _frame, _1)); new thread (boost::bind (&JobServer::run, server)); } catch (boost::system::system_error& e) { error_dialog(_frame, _("Could not listen for new batch jobs. Perhaps another instance of the DCP-o-matic Batch Converter is running.")); @@ -480,7 +487,7 @@ class App : public wxApp shared_ptr film; for (auto i: films_to_load) { - if (boost::filesystem::is_directory(i)) { + if (dcp::filesystem::is_directory(i)) { try { film = make_shared(i); film->read_metadata (); @@ -495,6 +502,10 @@ class App : public wxApp } } +#ifdef DCPOMATIC_GROK + grk_plugin::setMessengerLogger(new grk_plugin::GrokLogger("[GROK] ")); +#endif + return true; }