Merge branch 'master' into storageareas

This commit is contained in:
Isaac Connor 2017-05-19 13:35:31 -04:00
commit aab08db84b
1 changed files with 29 additions and 39 deletions

View File

@ -561,45 +561,35 @@ void Event::AddFrame( Image *image, struct timeval timestamp, int score, Image *
}
/* This makes viewing the diagnostic images impossible because it keeps deleting them
if ( config.record_diag_images )
{
char diag_glob[PATH_MAX] = "";
if ( config.record_diag_images ) {
char diag_glob[PATH_MAX] = "";
snprintf( diag_glob, sizeof(diag_glob), "%s/%d/diag-*.jpg", config.dir_events, monitor->Id() );
glob_t pglob;
int glob_status = glob( diag_glob, 0, 0, &pglob );
if ( glob_status != 0 )
{
if ( glob_status < 0 )
{
Error( "Can't glob '%s': %s", diag_glob, strerror(errno) );
}
else
{
Debug( 1, "Can't glob '%s': %d", diag_glob, glob_status );
}
}
else
{
char new_diag_path[PATH_MAX] = "";
for ( int i = 0; i < pglob.gl_pathc; i++ )
{
char *diag_path = pglob.gl_pathv[i];
snprintf( diag_glob, sizeof(diag_glob), "%s/%d/diag-*.jpg", config.dir_events, monitor->Id() );
glob_t pglob;
int glob_status = glob( diag_glob, 0, 0, &pglob );
if ( glob_status != 0 ) {
if ( glob_status < 0 ) {
Error( "Can't glob '%s': %s", diag_glob, strerror(errno) );
} else {
Debug( 1, "Can't glob '%s': %d", diag_glob, glob_status );
}
} else {
char new_diag_path[PATH_MAX] = "";
for ( int i = 0; i < pglob.gl_pathc; i++ ) {
char *diag_path = pglob.gl_pathv[i];
char *diag_file = strstr( diag_path, "diag-" );
char *diag_file = strstr( diag_path, "diag-" );
if ( diag_file )
{
snprintf( new_diag_path, sizeof(new_diag_path), general_file_format, path, frames, diag_file );
if ( diag_file ) {
snprintf( new_diag_path, sizeof(new_diag_path), general_file_format, path, frames, diag_file );
if ( rename( diag_path, new_diag_path ) < 0 )
{
Error( "Can't rename '%s' to '%s': %s", diag_path, new_diag_path, strerror(errno) );
}
}
}
}
globfree( &pglob );
if ( rename( diag_path, new_diag_path ) < 0 ) {
Error( "Can't rename '%s' to '%s': %s", diag_path, new_diag_path, strerror(errno) );
}
}
}
}
globfree( &pglob );
}
*/
}