Fix functional tests & multiple bugfixes & use CES

This commit is contained in:
Brendan LE GLAUNEC
2018-03-12 14:57:49 +01:00
committed by Brendan Le Glaunec
parent 5be5124e70
commit 58bcfb9ee5
34 changed files with 663 additions and 356 deletions
+7 -16
View File
@@ -1,25 +1,16 @@
{
"mysql_db" : {
"host" : "0.0.0.0",
"host" : "cameradar-database",
"port" : 3306,
"user": "root",
"password": "root",
"db_name": "cctv_dev"
"db_name": "cmrdr"
},
"subnets" : "172.16.100.11",
// If not specified, will scan all ports (1-65535)
"subnets" : "localhost",
"ports" : "554,8554",
"rtsp_url_file" : "conf/url.json",
"rtsp_ids_file" : "conf/ids.json",
// You must give an accessible path to an already existing directory
"thumbnail_storage_path" : "/tmp",
// This is the path that will be used in the Docker container
// if you're not familiar with Docker, only change the
// cache_manager_name value
"cache_manager_path" : "../cache_managers",
"rtsp_url_file" : "/cameradar/conf/url.json",
"rtsp_ids_file" : "/cameradar/conf/ids.json",
"thumbnail_storage_path" : "/tmp/thumbs",
"cache_manager_path" : "/cameradar/cache_managers",
"cache_manager_name" : "dumb"
}
+2 -2
View File
@@ -92,12 +92,12 @@ bool
configuration::load_url() {
std::string content;
LOG_DEBUG_("Trying to open ids file from " + this->rtsp_ids_file, "configuration");
LOG_DEBUG_("Trying to open url file from " + this->rtsp_url_file, "configuration");
if (this->rtsp_url_file.size()) {
content = read_file(this->rtsp_url_file.c_str()).second;
} else {
LOG_WARN_(
"No ids file detected in your configuration, Cameradar will use "
"No url file detected in your configuration, Cameradar will use "
"the default one "
"instead.",
"configuration");
+3 -3
View File
@@ -25,8 +25,8 @@ size_t
write_data(void* buffer, size_t size, size_t nmemb, void* userp) {
// I'm sorry for this
// Forget you ever saw it
(void)buffer;
(void)userp;
if (not buffer || not size || not nmemb) return 0;
return size * nmemb;
}
@@ -88,7 +88,7 @@ curl_describe(const std::string& path, bool logs) {
m.lock();
curl_global_cleanup();
m.unlock();
LOG_DEBUG_("Response code : " + std::to_string(rc), "describe");
LOG_DEBUG_("[" + path + "] Response code : " + std::to_string(rc), "describe");
if (logs) {
// Some cameras return 400 instead of 401, don't know why.
// Some cameras timeout and then curl considers the status as 0
+12 -5
View File
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <rtsp_path.h>
#include <logger.h>
#include <rtsp_path.h>
namespace etix {
@@ -21,10 +21,17 @@ namespace cameradar {
const std::string
make_path(const stream_model& model) {
std::string ret(model.service_name + "://" + model.username + ":" + model.password + "@" +
model.address + ":" + std::to_string(model.port) + model.route);
LOG_DEBUG_(ret, "debug");
return ret;
if (model.password != "" || model.username != "") {
std::string ret(model.service_name + "://" + model.username + ":" + model.password + "@" +
model.address + ":" + std::to_string(model.port) + model.route);
LOG_DEBUG_(ret, "debug");
return ret;
} else {
std::string ret(model.service_name + "://" + model.address + ":" +
std::to_string(model.port) + model.route);
LOG_DEBUG_(ret, "debug");
return ret;
}
}
}
}