/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
{
boost::asio::io_service io_service;
tcp::acceptor a (io_service, tcp::endpoint (tcp::v4 (), port));
- while (1) {
+ while (true) {
try {
shared_ptr<tcp::socket> s (new tcp::socket (io_service));
a.accept (*s);
string url;
State state = AWAITING_G;
- while (1) {
+ while (true) {
char data[MAX_LENGTH];
boost::system::error_code error;
size_t len = socket->read_some (boost::asio::buffer (data), error);
json << "\"dcp\": \"" << (*i)->film()->dcp_name() << "\", ";
}
- json << "\"name\": \"" << (*i)->json_name() << "\", "
- << "\"progress\": " << (*i)->progress () << ", "
- << "\"status\": \"" << (*i)->json_status() << "\"";
+ json << "\"name\": \"" << (*i)->json_name() << "\", ";
+ if ((*i)->progress ()) {
+ json << "\"progress\": " << (*i)->progress().get() << ", ";
+ } else {
+ json << "\"progress\": unknown, ";
+ }
+ json << "\"status\": \"" << (*i)->json_status() << "\"";
json << " }";
list<shared_ptr<Job> >::iterator j = i;