convert to using storage->getPath instaed of config.events_dir
parent
6aadd7330a
commit
010d7b3d64
|
@ -463,12 +463,13 @@ Monitor::Monitor(
|
|||
Debug( 1, "Monitor %s IBC = %d, WUC = %d, pEC = %d, PEC = %d, EAF = %d, FRI = %d, RBP = %d, ARBP = %d, FM = %d", name, image_buffer_count, warmup_count, pre_event_count, post_event_count, alarm_frame_count, fps_report_interval, ref_blend_perc, alarm_ref_blend_perc, track_motion );
|
||||
|
||||
storage = new Storage( storage_id );
|
||||
Debug(1, "Storage path: %s", storage->getPath() );
|
||||
|
||||
if ( purpose == ANALYSIS )
|
||||
{
|
||||
static char path[PATH_MAX];
|
||||
|
||||
strncpy( path, config.dir_events, sizeof(path) );
|
||||
strncpy( path, storage->getPath(), sizeof(path) );
|
||||
|
||||
struct stat statbuf;
|
||||
errno = 0;
|
||||
|
@ -481,7 +482,7 @@ Monitor::Monitor(
|
|||
}
|
||||
}
|
||||
|
||||
snprintf( path, sizeof(path), "%s/%d", config.dir_events, id );
|
||||
snprintf( path, sizeof(path), "%s/%d", storage->getPath(), id );
|
||||
|
||||
errno = 0;
|
||||
stat( path, &statbuf );
|
||||
|
@ -493,8 +494,8 @@ Monitor::Monitor(
|
|||
}
|
||||
char temp_path[PATH_MAX];
|
||||
snprintf( temp_path, sizeof(temp_path), "%d", id );
|
||||
if ( chdir( config.dir_events ) < 0 )
|
||||
Fatal( "Can't change directory to '%s': %s", config.dir_events, strerror(errno) );
|
||||
if ( chdir( storage->getPath() ) < 0 )
|
||||
Fatal( "Can't change directory to '%s': %s", storage->getPath(), strerror(errno) );
|
||||
if ( symlink( temp_path, name ) < 0 )
|
||||
Fatal( "Can't symlink '%s' to '%s': %s", temp_path, name, strerror(errno) );
|
||||
if ( chdir( ".." ) < 0 )
|
||||
|
@ -3416,12 +3417,14 @@ unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &z
|
|||
|
||||
if ( n_zones <= 0 ) return( alarm );
|
||||
|
||||
Storage *storage = this->getStorage();
|
||||
|
||||
if ( config.record_diag_images )
|
||||
{
|
||||
static char diag_path[PATH_MAX] = "";
|
||||
if ( !diag_path[0] )
|
||||
{
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%d/diag-r.jpg", config.dir_events, id );
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%d/diag-r.jpg", storage->getPath(), id );
|
||||
}
|
||||
ref_image.WriteJpeg( diag_path );
|
||||
}
|
||||
|
@ -3433,7 +3436,7 @@ unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &z
|
|||
static char diag_path[PATH_MAX] = "";
|
||||
if ( !diag_path[0] )
|
||||
{
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%d/diag-d.jpg", config.dir_events, id );
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%d/diag-d.jpg", storage->getPath(), id );
|
||||
}
|
||||
delta_image.WriteJpeg( diag_path );
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ void Zone::Setup( Monitor *p_monitor, int p_id, const char *p_label, ZoneType p_
|
|||
static char diag_path[PATH_MAX] = "";
|
||||
if ( !diag_path[0] )
|
||||
{
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%s/diag-%d-poly.jpg", config.dir_events, monitor->Name(), id);
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%s/diag-%d-poly.jpg", monitor->getStorage()->getPath(), monitor->Name(), id);
|
||||
}
|
||||
pg_image->WriteJpeg( diag_path );
|
||||
}
|
||||
|
@ -232,7 +232,8 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
unsigned int hi_y = polygon.HiY();
|
||||
|
||||
Debug( 4, "Checking alarms for zone %d/%s in lines %d -> %d", id, label, lo_y, hi_y );
|
||||
|
||||
|
||||
Storage *storage = monitor->getStorage();
|
||||
|
||||
Debug( 5, "Checking for alarmed pixels" );
|
||||
/* if(config.cpu_extensions && sseversion >= 20) {
|
||||
|
@ -247,7 +248,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
static char diag_path[PATH_MAX] = "";
|
||||
if ( !diag_path[0] )
|
||||
{
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%s/diag-%d-%d.jpg", config.dir_events, monitor->Name(), id, 1 );
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%s/diag-%d-%d.jpg", storage->getPath(), monitor->Name(), id, 1 );
|
||||
}
|
||||
diff_image->WriteJpeg( diag_path );
|
||||
}
|
||||
|
@ -344,7 +345,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
static char diag_path[PATH_MAX] = "";
|
||||
if ( !diag_path[0] )
|
||||
{
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%d/diag-%d-%d.jpg", config.dir_events, monitor->Id(), id, 2 );
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%d/diag-%d-%d.jpg", storage->getPath(), monitor->Id(), id, 2 );
|
||||
}
|
||||
diff_image->WriteJpeg( diag_path );
|
||||
}
|
||||
|
@ -585,7 +586,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
static char diag_path[PATH_MAX] = "";
|
||||
if ( !diag_path[0] )
|
||||
{
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%d/diag-%d-%d.jpg", config.dir_events, monitor->Id(), id, 3 );
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%d/diag-%d-%d.jpg", storage->getPath(), monitor->Id(), id, 3 );
|
||||
}
|
||||
diff_image->WriteJpeg( diag_path );
|
||||
}
|
||||
|
@ -644,7 +645,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
static char diag_path[PATH_MAX] = "";
|
||||
if ( !diag_path[0] )
|
||||
{
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%d/diag-%d-%d.jpg", config.dir_events, monitor->Id(), id, 4 );
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%d/diag-%d-%d.jpg", storage->getPath(), monitor->Id(), id, 4 );
|
||||
}
|
||||
diff_image->WriteJpeg( diag_path );
|
||||
}
|
||||
|
|
|
@ -211,11 +211,12 @@ int main( int argc, char *argv[] )
|
|||
fprintf( stderr, "Can't find monitor with id of %d\n", id );
|
||||
exit( -1 );
|
||||
}
|
||||
Storage *Storage = monitor->getStorage();
|
||||
|
||||
char capt_path[PATH_MAX];
|
||||
char anal_path[PATH_MAX];
|
||||
snprintf( capt_path, sizeof(capt_path), "%s/%d/%%s/%%0%dd-capture.jpg", config.dir_events, monitor->Id(), config.event_image_digits );
|
||||
snprintf( anal_path, sizeof(anal_path), "%s/%d/%%s/%%0%dd-analyse.jpg", config.dir_events, monitor->Id(), config.event_image_digits );
|
||||
snprintf( capt_path, sizeof(capt_path), "%s/%d/%%s/%%0%dd-capture.jpg", Storage->getPath(), monitor->Id(), config.event_image_digits );
|
||||
snprintf( anal_path, sizeof(anal_path), "%s/%d/%%s/%%0%dd-analyse.jpg", Storage->getPath(), monitor->Id(), config.event_image_digits );
|
||||
zmSetDefaultTermHandler();
|
||||
zmSetDefaultDieHandler();
|
||||
|
||||
|
|
Loading…
Reference in New Issue