projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add find_file from libdcp.
[dcpomatic.git]
/
src
/
tools
/
dcpomatic_server_cli.cc
diff --git
a/src/tools/dcpomatic_server_cli.cc
b/src/tools/dcpomatic_server_cli.cc
index 81c553ef7c3094aa57761f3f289ee27132bdd749..6d7f6aba729ae06113de78f76ae9bbd5ab8dba68 100644
(file)
--- a/
src/tools/dcpomatic_server_cli.cc
+++ b/
src/tools/dcpomatic_server_cli.cc
@@
-1,19
+1,20
@@
/*
Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
/*
Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
- This program is free software; you can redistribute it and/or modify
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
This program
is distributed in the hope that it will be useful,
+
DCP-o-matic
is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
*/
*/
@@
-26,7
+27,8
@@
#include "lib/file_log.h"
#include "lib/null_log.h"
#include "lib/version.h"
#include "lib/file_log.h"
#include "lib/null_log.h"
#include "lib/version.h"
-#include "lib/server.h"
+#include "lib/encode_server.h"
+#include "lib/dcpomatic_log.h"
#include <boost/array.hpp>
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/array.hpp>
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp>
@@
-44,7
+46,7
@@
using std::cerr;
using std::string;
using std::cout;
using std::cerr;
using std::string;
using std::cout;
-using
boost
::shared_ptr;
+using
std
::shared_ptr;
static void
help (string n)
static void
help (string n)
@@
-63,7
+65,7
@@
main (int argc, char* argv[])
dcpomatic_setup_path_encoding ();
dcpomatic_setup ();
dcpomatic_setup_path_encoding ();
dcpomatic_setup ();
- int num_threads = Config::instance()->
num_local
_encoding_threads ();
+ int num_threads = Config::instance()->
server
_encoding_threads ();
bool verbose = false;
bool write_log = false;
bool verbose = false;
bool write_log = false;
@@
-103,23
+105,22
@@
main (int argc, char* argv[])
}
}
}
}
- shared_ptr<Log> log;
if (write_log) {
if (write_log) {
- log.reset (new FileLog ("dcpomatic_server_cli.log"));
- } else {
- log.reset (new NullLog);
+ dcpomatic_log.reset (new FileLog("dcpomatic_server_cli.log"));
}
}
-
Server server (log, verbose
);
+
EncodeServer server (verbose, num_threads
);
try {
try {
- server.run (
num_threads
);
+ server.run ();
} catch (boost::system::system_error& e) {
if (e.code() == boost::system::errc::address_in_use) {
cerr << argv[0] << ": address already in use. Is another DCP-o-matic server instance already running?\n";
exit (EXIT_FAILURE);
}
cerr << argv[0] << ": " << e.what() << "\n";
} catch (boost::system::system_error& e) {
if (e.code() == boost::system::errc::address_in_use) {
cerr << argv[0] << ": address already in use. Is another DCP-o-matic server instance already running?\n";
exit (EXIT_FAILURE);
}
cerr << argv[0] << ": " << e.what() << "\n";
+ } catch (std::exception& e) {
+ cerr << argv[0] << ": failed to start server; " << e.what() << "\n";
}
return 0;
}
}
return 0;
}