mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2025-12-23 22:37:53 -05:00
Merge branch 'add_startup_delay' of github.com:ZoneMinder/zoneminder into add_startup_delay
This commit is contained in:
@@ -617,6 +617,7 @@ CREATE TABLE `Monitors` (
|
||||
`Importance` enum('Normal','Less','Not') NOT NULL default 'Normal',
|
||||
`MQTT_Enabled` BOOLEAN NOT NULL DEFAULT false,
|
||||
`MQTT_Subscriptions` varchar(255) default '',
|
||||
`StartupDelay` INT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
|
||||
18
db/zm_update-1.37.56.sql
Normal file
18
db/zm_update-1.37.56.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
--
|
||||
-- Update Monitors table to have StartupDelay
|
||||
--
|
||||
|
||||
SELECT 'Checking for StartupDelay in Monitors';
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE table_name = 'Monitors'
|
||||
AND table_schema = DATABASE()
|
||||
AND column_name = 'StartupDelay'
|
||||
) > 0,
|
||||
"SELECT 'Column StartupDelay already exists on Monitors'",
|
||||
"ALTER TABLE Monitors ADD `StartupDelay` INT NOT NULL DEFAULT 0 AFTER `MQTT_Subscriptions`"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
@@ -18,7 +18,7 @@
|
||||
%global zmtargetdistro %{?rhel:el%{rhel}}%{!?rhel:fc%{fedora}}
|
||||
|
||||
Name: zoneminder
|
||||
Version: 1.37.55
|
||||
Version: 1.37.56
|
||||
Release: 2%{?dist}
|
||||
Summary: A camera monitoring and analysis tool
|
||||
Group: System Environment/Daemons
|
||||
|
||||
@@ -111,6 +111,7 @@ std::string load_monitor_sql =
|
||||
#if MOSQUITTOPP_FOUND
|
||||
", `MQTT_Enabled`, `MQTT_Subscriptions`"
|
||||
#endif
|
||||
", `StartupDelay`"
|
||||
" FROM `Monitors`";
|
||||
|
||||
std::string CameraType_Strings[] = {
|
||||
@@ -365,7 +366,7 @@ Monitor::Monitor() :
|
||||
"FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, Exif,"
|
||||
"`RTSPServer`, `RTSPStreamName`, `SOAP_wsa_compl`,"
|
||||
"`ONVIF_URL`, `ONVIF_Username`, `ONVIF_Password`, `ONVIF_Options`, `ONVIF_Event_Listener`, `use_Amcrest_API`, "
|
||||
"SignalCheckPoints, SignalCheckColour, Importance-1, ZoneCount, `MQTT_Enabled`, `MQTT_Subscriptions` FROM Monitors";
|
||||
"SignalCheckPoints, SignalCheckColour, Importance-1, ZoneCount, `MQTT_Enabled`, `MQTT_Subscriptions`, StartupDelay FROM Monitors";
|
||||
*/
|
||||
|
||||
void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) {
|
||||
@@ -620,6 +621,7 @@ void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) {
|
||||
mqtt_subscriptions = Split(mqtt_subscriptions_string, ','); col++;
|
||||
Error("MQTT enabled ? %d, subs %s", mqtt_enabled, mqtt_subscriptions_string.c_str());
|
||||
#endif
|
||||
startup_delay = dbrow[col] ? atoi(dbrow[col]) : 0; col++;
|
||||
|
||||
// How many frames we need to have before we start analysing
|
||||
ready_count = std::max(warmup_count, pre_event_count);
|
||||
|
||||
@@ -509,6 +509,7 @@ protected:
|
||||
bool soap_wsa_compl; // Whether the camera supports soap_wsa or not.
|
||||
std::string onvif_alarm_txt; // def onvif_alarm_txt
|
||||
int importance; // Importance of this monitor, affects Connection logging errors.
|
||||
int startup_delay; // Seconds to sleep before connecting to camera
|
||||
unsigned int zone_count;
|
||||
|
||||
int capture_max_fps;
|
||||
@@ -909,6 +910,7 @@ public:
|
||||
return shared_data ? shared_data->analysis_fps : 0.0;
|
||||
}
|
||||
int Importance() const { return importance; }
|
||||
int StartupDelay() const { return startup_delay; }
|
||||
};
|
||||
|
||||
#define MOD_ADD( var, delta, limit ) (((var)+(limit)+(delta))%(limit))
|
||||
|
||||
@@ -252,6 +252,10 @@ int main(int argc, char *argv[]) {
|
||||
monitor->Id());
|
||||
zmDbDo(sql);
|
||||
|
||||
if (monitor->StartupDelay() > 0) {
|
||||
Debug(1, "Doing startup sleep for %ds", monitor->StartupDelay());
|
||||
std::this_thread::sleep_for(Seconds(monitor->StartupDelay()));
|
||||
}
|
||||
|
||||
Seconds sleep_time = Seconds(0);
|
||||
while ((monitor->PrimeCapture() <= 0) and !zm_terminate) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.37.55
|
||||
1.37.56
|
||||
|
||||
Reference in New Issue
Block a user