v0.2.2 : Cameradar now supports badly configured cameras
This commit is contained in:
+3
-3
@@ -21,7 +21,7 @@ project (${PROJECT_NAME})
|
||||
|
||||
set (${PROJECT_NAME}_VERSION_MAJOR 0)
|
||||
set (${PROJECT_NAME}_VERSION_MINOR 2)
|
||||
set (${PROJECT_NAME}_VERSION_PATCH 0)
|
||||
set (${PROJECT_NAME}_VERSION_PATCH 2)
|
||||
set (${PROJECT_NAME}_SUFFIX "-beta")
|
||||
set (${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}${${PROJECT_NAME}_SUFFIX}")
|
||||
|
||||
@@ -122,8 +122,8 @@ set (CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}_${${PROJECT_NAME}_VERSION}_${CMAKE
|
||||
set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
||||
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||
set (CPACK_PACKAGE_VERSION_MAJOR "0")
|
||||
set (CPACK_PACKAGE_VERSION_MINOR "1")
|
||||
set (CPACK_PACKAGE_VERSION_PATCH "0")
|
||||
set (CPACK_PACKAGE_VERSION_MINOR "2")
|
||||
set (CPACK_PACKAGE_VERSION_PATCH "2")
|
||||
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}_${${PROJECT_NAME}_VERSION}")
|
||||
set (CPACK_GENERATOR "TGZ")
|
||||
set (CPACK_SOURCE_GENERATOR "TGZ")
|
||||
|
||||
@@ -53,8 +53,10 @@ dumb_cache_manager::set_streams(std::vector<etix::cameradar::stream_model> model
|
||||
//! Inserts a single stream to the cache
|
||||
void
|
||||
dumb_cache_manager::update_stream(const etix::cameradar::stream_model& newmodel) {
|
||||
for (auto& it : this->streams) {
|
||||
if (it.address == newmodel.address && it.port == newmodel.port) { it = newmodel; }
|
||||
for (auto& stream : this->streams) {
|
||||
if (stream.address == newmodel.address && stream.port == newmodel.port) {
|
||||
stream = newmodel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,8 +64,9 @@ dumb_cache_manager::update_stream(const etix::cameradar::stream_model& newmodel)
|
||||
std::vector<etix::cameradar::stream_model>
|
||||
dumb_cache_manager::get_streams() {
|
||||
std::vector<stream_model> ret;
|
||||
for (const auto& it : this->streams) {
|
||||
if (not it.service_name.compare("rtsp") && not it.state.compare("open")) ret.push_back(it);
|
||||
for (const auto& stream : this->streams) {
|
||||
if (not stream.service_name.compare("rtsp") && not stream.state.compare("open"))
|
||||
ret.push_back(stream);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -72,10 +75,10 @@ dumb_cache_manager::get_streams() {
|
||||
std::vector<etix::cameradar::stream_model>
|
||||
dumb_cache_manager::get_valid_streams() {
|
||||
std::vector<stream_model> ret;
|
||||
for (const auto& it : this->streams) {
|
||||
if ((not it.service_name.compare("rtsp") && not it.state.compare("open")) && it.ids_found &&
|
||||
it.path_found)
|
||||
ret.push_back(it);
|
||||
for (const auto& stream : this->streams) {
|
||||
if ((not stream.service_name.compare("rtsp") && not stream.state.compare("open")) &&
|
||||
stream.ids_found && stream.path_found)
|
||||
ret.push_back(stream);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -71,12 +71,15 @@ curl_describe(const std::string& path, bool logs) {
|
||||
curl_easy_cleanup(csession);
|
||||
fclose(protofile);
|
||||
curl_global_cleanup();
|
||||
LOG_DEBUG_("Response code : " + std::to_string(rc), "describe");
|
||||
if (logs) {
|
||||
if (rc != 401 && pos == std::string::npos)
|
||||
// Some cameras return 400 instead of 401, don't know why.
|
||||
// Some cameras timeout and then curl considers the status as 0
|
||||
if (rc != 401 && rc != 400 && rc && pos == std::string::npos)
|
||||
LOG_INFO_("Unprotected camera discovered.", "brutelogs");
|
||||
return ((res == CURLE_OK) && rc != 401);
|
||||
return ((res == CURLE_OK) && rc != 401 && rc != 400 && rc);
|
||||
}
|
||||
return ((res == CURLE_OK) && rc != 404);
|
||||
return ((res == CURLE_OK) && rc != 404 && rc != 400 && rc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user