Sorted out path creation and defines.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@20 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
9b79ad4f57
commit
6b455d160b
67
src/zm.cpp
67
src/zm.cpp
|
@ -1291,14 +1291,14 @@ Event::Event( Monitor *p_monitor, time_t p_start_time ) : monitor( p_monitor ),
|
||||||
alarm_frames = 0;
|
alarm_frames = 0;
|
||||||
tot_score = 0;
|
tot_score = 0;
|
||||||
max_score = 0;
|
max_score = 0;
|
||||||
sprintf( path, "%s/%04d", monitor->GetTimestampPath( 0 ), id );
|
sprintf( path, "%s/%04d", monitor->Name(), id );
|
||||||
|
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
stat( path, &statbuf );
|
stat( path, &statbuf );
|
||||||
if ( errno == ENOENT || errno == ENOTDIR )
|
if ( errno == ENOENT || errno == ENOTDIR )
|
||||||
{
|
{
|
||||||
if ( mkdir( path, 0777 ) )
|
if ( mkdir( path, 0755 ) )
|
||||||
{
|
{
|
||||||
Error(( "Can't make %s: %s\n", path, strerror(errno)));
|
Error(( "Can't make %s: %s\n", path, strerror(errno)));
|
||||||
}
|
}
|
||||||
|
@ -1470,6 +1470,33 @@ Monitor::Monitor( int p_id, char *p_name, int p_function, int p_device, int p_ch
|
||||||
if ( !capture )
|
if ( !capture )
|
||||||
{
|
{
|
||||||
ref_image.Assign( width, height, colours, image_buffer[shared_images->last_write_index].image->buffer );
|
ref_image.Assign( width, height, colours, image_buffer[shared_images->last_write_index].image->buffer );
|
||||||
|
|
||||||
|
static char path[256];
|
||||||
|
|
||||||
|
sprintf( path, EVENT_DIR );
|
||||||
|
|
||||||
|
struct stat statbuf;
|
||||||
|
errno = 0;
|
||||||
|
stat( path, &statbuf );
|
||||||
|
if ( errno == ENOENT || errno == ENOTDIR )
|
||||||
|
{
|
||||||
|
if ( mkdir( path, 0755 ) )
|
||||||
|
{
|
||||||
|
Error(( "Can't make %s: %s\n", path, strerror(errno)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf( path, EVENT_DIR "/%s", name );
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
stat( path, &statbuf );
|
||||||
|
if ( errno == ENOENT || errno == ENOTDIR )
|
||||||
|
{
|
||||||
|
if ( mkdir( path, 0755 ) )
|
||||||
|
{
|
||||||
|
Error(( "Can't make %s: %s\n", path, strerror(errno)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if ( capture )
|
//if ( capture )
|
||||||
|
@ -1626,42 +1653,6 @@ void Monitor::DumpZoneImage()
|
||||||
zone_image.WriteJpeg( filename );
|
zone_image.WriteJpeg( filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
char *Monitor::GetTimestampPath( time_t now )
|
|
||||||
{
|
|
||||||
static char path[256];
|
|
||||||
sprintf( path, "events/%s", name );
|
|
||||||
return( path );
|
|
||||||
|
|
||||||
static char timestamp[64];
|
|
||||||
static char event_path[256];
|
|
||||||
|
|
||||||
strftime( timestamp, sizeof(timestamp), "%Y%m%d", localtime( &now ) );
|
|
||||||
sprintf( event_path, "events/%s/%s", name, timestamp );
|
|
||||||
struct stat statbuf;
|
|
||||||
errno = 0;
|
|
||||||
stat( event_path, &statbuf );
|
|
||||||
if ( errno == ENOENT || errno == ENOTDIR )
|
|
||||||
{
|
|
||||||
if ( mkdir( event_path, 0777 ) )
|
|
||||||
{
|
|
||||||
Error(( "Can't make %s: %s\n", event_path, strerror(errno)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
strftime( timestamp, sizeof(timestamp), "%H%M%S", localtime( &now ) );
|
|
||||||
strcat( event_path, "/" );
|
|
||||||
strcat( event_path, timestamp );
|
|
||||||
errno = 0;
|
|
||||||
stat( event_path, &statbuf );
|
|
||||||
if ( errno == ENOENT || errno == ENOTDIR )
|
|
||||||
{
|
|
||||||
if ( mkdir( event_path, 0777 ) )
|
|
||||||
{
|
|
||||||
Error(( "Can't make %s: %s\n", event_path, strerror(errno)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return( event_path );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Monitor::DumpImage( Image *image ) const
|
void Monitor::DumpImage( Image *image ) const
|
||||||
{
|
{
|
||||||
if ( image_count && !(image_count%10) )
|
if ( image_count && !(image_count%10) )
|
||||||
|
|
1
src/zm.h
1
src/zm.h
|
@ -609,7 +609,6 @@ public:
|
||||||
return( function == ACTIVE && image_count > WARMUP_COUNT );
|
return( function == ACTIVE && image_count > WARMUP_COUNT );
|
||||||
}
|
}
|
||||||
|
|
||||||
char *GetTimestampPath( time_t now );
|
|
||||||
void DumpImage( Image *image ) const;
|
void DumpImage( Image *image ) const;
|
||||||
void Analyse();
|
void Analyse();
|
||||||
|
|
||||||
|
|
|
@ -5,3 +5,5 @@
|
||||||
#define ZM_DB_PASSA "zmadminzm"
|
#define ZM_DB_PASSA "zmadminzm"
|
||||||
#define ZM_DB_USERB "zmuser"
|
#define ZM_DB_USERB "zmuser"
|
||||||
#define ZM_DB_PASSB "zmuserzm"
|
#define ZM_DB_PASSB "zmuserzm"
|
||||||
|
|
||||||
|
#define EVENT_DIR "events"
|
||||||
|
|
Loading…
Reference in New Issue