string
ABTranscodeJob::name () const
{
- stringstream s;
- s << "A/B transcode " << _fs->name;
- return s.str ();
+ return String::compose ("A/B transcode %1", _fs->name);
}
void
string
CheckHashesJob::name () const
{
- stringstream s;
- s << "Check hashes of " << _fs->name;
- return s.str ();
+ return String::compose ("Check hashes of %1", _fs->name);
}
void
throw EncodeError ("jpeg2000 encoding failed");
}
- {
- stringstream s;
- s << "Finished locally-encoded frame " << _frame;
- _log->log (s.str ());
- }
+ _log->log (String::compose ("Finished locally-encoded frame %1", _frame));
return shared_ptr<EncodedData> (new LocallyEncodedData (_cio->buffer, cio_tell (_cio)));
}
/* now read the rest */
socket.read_definite_and_consume (e->data(), e->size(), 30);
- {
- stringstream s;
- s << "Finished remotely-encoded frame " << _frame;
- _log->log (s.str ());
- }
+ _log->log (String::compose ("Finished remotely-encoded frame %1", _frame));
return e;
}
string
ExamineContentJob::name () const
{
- stringstream s;
- s << "Examine content of " << _fs->name;
- return s.str ();
+ return String::compose ("Examine content of %1", _fs->name);
}
void
throw BadSettingError ("name", "cannot contain slashes");
}
- {
- stringstream s;
- s << "DVD-o-matic " << DVDOMATIC_VERSION << " using " << dependency_version_summary ();
- log()->log (s.str ());
- }
+ log()->log (String::compose ("DVD-o-matic %1 using %2", DVDOMATIC_VERSION, dependency_version_summary()));
{
char buffer[128];
gethostname (buffer, sizeof (buffer));
- stringstream s;
- s << "Starting to make a DCP on " << buffer;
- log()->log (s.str ());
+ log()->log (String::compose ("Starting to make DCP on %1", buffer));
}
if (format() == 0) {
encoded = vf->encode_remotely (server);
if (remote_backoff > 0) {
- stringstream s;
- s << server->host_name() << " was lost, but now she is found; removing backoff";
- _log->log (s.str ());
+ _log->log (String::compose ("%1 was lost, but now she is found; removing backoff", server->host_name ()));
}
/* This job succeeded, so remove any backoff */
/* back off more */
remote_backoff += 10;
}
- stringstream s;
- s << "Remote encode of " << vf->frame() << " on " << server->host_name() << " failed (" << e.what() << "); thread sleeping for " << remote_backoff << "s.";
- _log->log (s.str ());
+ _log->log (
+ String::compose (
+ "Remote encode of %1 on %2 failed (%3); thread sleeping for %4s",
+ vf->frame(), server->host_name(), e.what(), remote_backoff)
+ );
}
} else {
encoded = vf->encode_locally ();
TIMING ("encoder thread %1 finishes local encode of %2", pthread_self(), vf->frame());
} catch (std::exception& e) {
- stringstream s;
- s << "Local encode failed " << e.what() << ".";
- _log->log (s.str ());
+ _log->log (String::compose ("Local encode failed (%1)", e.what ()));
}
}
*/
for (list<shared_ptr<DCPVideoFrame> >::iterator i = _queue.begin(); i != _queue.end(); ++i) {
- stringstream s;
- s << "Encode left-over frame " << (*i)->frame();
- _log->log (s.str ());
+ _log->log (String::compose ("Encode left-over frame %1", (*i)->frame ()));
try {
shared_ptr<EncodedData> e = (*i)->encode_locally ();
e->write (_opt, (*i)->frame ());
frame_done ((*i)->frame ());
} catch (std::exception& e) {
- stringstream s;
- s << "Local encode failed " << e.what() << ".";
- _log->log (s.str ());
+ _log->log (String::compose ("Local encode failed (%1)", e.what ()));
}
}
set_progress (1);
set_state (FINISHED_ERROR);
- stringstream s;
- s << e.what() << "(" << filesystem::path (e.filename()).leaf() << ")";
- set_error (s.str ());
+ set_error (String::compose ("%1 (%2)", e.what(), filesystem::path (e.filename()).leaf()));
} catch (std::exception& e) {
string
MakeDCPJob::name () const
{
- stringstream s;
- s << "Make DCP for " << _fs->name;
- return s.str ();
+ return String::compose ("Make DCP for %1", _fs->name);
}
string
{
scp = ssh_scp_new (s, SSH_SCP_WRITE | SSH_SCP_RECURSIVE, Config::instance()->tms_path().c_str ());
if (!scp) {
- stringstream s;
- s << "Could not start SCP session (" << ssh_get_error (s) << ")";
- throw NetworkError (s.str ());
+ throw NetworkError (String::compose ("Could not start SCP session (%1)", ssh_get_error (s)));
}
}
string
SCPDCPJob::name () const
{
- stringstream s;
- s << "Copy DCP to TMS";
- return s.str ();
+ return "Copy DCP to TMS";
}
void
int r = ss.connect ();
if (r != SSH_OK) {
- stringstream s;
- s << "Could not connect to server " << Config::instance()->tms_ip() << " (" << ssh_get_error (ss.session) << ")";
- throw NetworkError (s.str ());
+ throw NetworkError (String::compose ("Could not connect to server %1 (%2)", Config::instance()->tms_ip(), ssh_get_error (ss.session)));
}
int const state = ssh_is_server_known (ss.session);
if (state == SSH_SERVER_ERROR) {
- stringstream s;
- s << "SSH error (" << ssh_get_error (ss.session) << ")";
- throw NetworkError (s.str ());
+ throw NetworkError (String::compose ("SSH error (%1)", ssh_get_error (ss.session)));
}
r = ssh_userauth_password (ss.session, 0, Config::instance()->tms_password().c_str ());
if (r != SSH_AUTH_SUCCESS) {
- stringstream s;
- s << "Failed to authenticate with server (" << ssh_get_error (ss.session) << ")";
- throw NetworkError (s.str ());
+ throw NetworkError (String::compose ("Failed to authenticate with server (%1)", ssh_get_error (ss.session)));
}
SSHSCP sc (ss.session);
r = ssh_scp_init (sc.scp);
if (r != SSH_OK) {
- stringstream s;
- s << "Could not start SCP session (" << ssh_get_error (ss.session) << ")";
- throw NetworkError (s.str ());
+ throw NetworkError (String::compose ("Could not start SCP session (%1)", ssh_get_error (ss.session)));
}
r = ssh_scp_push_directory (sc.scp, _fs->name.c_str(), S_IRWXU);
if (r != SSH_OK) {
- stringstream s;
- s << "Could not create remote directory " << _fs->name << "(" << ssh_get_error (ss.session) << ")";
- throw NetworkError (s.str ());
+ throw NetworkError (String::compose ("Could not create remote directory %1 (%2)", _fs->name, ssh_get_error (ss.session)));
}
string const dcp_dir = _fs->dir (_fs->name);
FILE* f = fopen (filesystem::path (*i).string().c_str(), "rb");
if (f == 0) {
- stringstream s;
- s << "Could not open " << *i << " to send";
- throw NetworkError (s.str ());
+ throw NetworkError (String::compose ("Could not open %1 to send", *i));
}
while (to_do > 0) {
r = ssh_scp_write (sc.scp, buffer, t);
if (r != SSH_OK) {
- stringstream s;
- s << "Could not write to remote file (" << ssh_get_error (ss.session) << ")";
- throw NetworkError (s.str ());
+ throw NetworkError (String::compose ("Could not write to remote file (%1)", ssh_get_error (ss.session)));
}
to_do -= t;
bytes_transferred += t;
if (frame >= 0) {
struct timeval end;
gettimeofday (&end, 0);
- stringstream s;
- s << "Encoded frame " << frame << " in " << (seconds (end) - seconds (start));
- _log->log (s.str ());
+ _log->log (String::compose ("Encoded frame %1 in %2", frame, seconds (end) - seconds (start)));
}
_worker_condition.notify_all ();
void
Server::run (int num_threads)
{
- stringstream s;
- s << "Server starting with " << num_threads << " threads.";
- _log->log (s.str ());
+ _log->log (String::compose ("Server starting with %1 threads", num_threads));
for (int i = 0; i < num_threads; ++i) {
_worker_threads.push_back (new thread (bind (&Server::worker_thread, this)));
string
ThumbsJob::name () const
{
- stringstream s;
- s << "Update thumbs for " << _fs->name;
- return s.str ();
+ return String::compose ("Update thumbs for %1", _fs->name);
}
void
string
TranscodeJob::name () const
{
- stringstream s;
- s << "Transcode " << _fs->name;
- return s.str ();
+ return String::compose ("Transcode %1", _fs->name);
}
void
} catch (std::exception& e) {
- stringstream s;
set_progress (1);
set_state (FINISHED_ERROR);
-
- s << "Transcode job failed (" << e.what() << ")";
- _log->log (s.str ());
+ _log->log (String::compose ("Transcode job failed (%1)", e.what()));
throw;
}
_film->set_content (wx_to_std (_content->GetPath ()));
} catch (std::exception& e) {
_content->SetPath (std_to_wx (_film->directory ()));
- stringstream m;
- m << "Could not set content: " << e.what() << ".";
- error_dialog (this, m.str ());
+ error_dialog (this, String::compose ("Could not set content: %1", e.what ()));
}
_ignore_changes = Film::NONE;
try {
(*i)->emit_finished ();
} catch (OpenFileError& e) {
- stringstream s;
- s << "Error: " << e.what();
- error_dialog (this, s.str ());
+ error_dialog (this, String::compose ("Error: %1", e.what ()));
}
_job_records[*i].informed_of_finish = true;
try {
film->make_dcp (transcode);
} catch (BadSettingError& e) {
- stringstream s;
- s << "Bad setting for " << e.setting() << "(" << e.what() << ")";
- error_dialog (parent, s.str ());
+ error_dialog (parent, String::compose ("Bad setting for %1 (%2)", e.setting(), e.what ()));
} catch (std::exception& e) {
- stringstream s;
- s << "Could not make DCP: " << e.what () << ".";
- error_dialog (parent, s.str ());
+ error_dialog (parent, String::compose ("Could not make DCP: %1", e.what ()));
}
}