Patch - Emailing red outlined image

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
bazso
Posts: 11
Joined: Wed May 14, 2008 6:50 pm

Patch - Emailing red outlined image

Post by bazso »

Hi,

This small patch adds a new email token %EI1O% which is the same than %EI1% (first alarmed frame) but sends the red outlined version instead.

Regards,
BaZso

Patch:
--- ./zmfilter.orig 2009-01-04 00:54:20.000000000 +0100
+++ /usr/bin/zmfilter.pl 2009-01-04 00:56:30.000000000 +0100
@@ -804,7 +804,7 @@
}

# Do we need the image information too?
- my $need_images = $text =~ /%(?:EPI1|EPIM|EI1|EIM)%/;
+ my $need_images = $text =~ /%(?:EPI1|EPIM|EI1|EI1O|EIM)%/;
my $first_alarm_frame;
my $max_alarm_frame;
my $max_alarm_score = 0;
@@ -862,6 +862,10 @@
{
push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", getEventPath( $event ), $first_alarm_frame->{FrameId} ) } );
}
+ if ( $attachments_ref && $text =~ s/%EI1O%//g )
+ {
+ push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-analyse.jpg", getEventPath( $event ), $first_alarm_frame->{FrameId} ) } );
+ }
if ( $attachments_ref && $text =~ s/%EIM%//g )
{
# Don't attach the same image twice
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

This patch is created for which ZM version? or applies to what version?
bazso
Posts: 11
Joined: Wed May 14, 2008 6:50 pm

Post by bazso »

Excuse me, you won, I've forgotten it.

1.23.3 latest stable release, installed from ubuntu official repo.

BaZso
chrilleman
Posts: 10
Joined: Tue Oct 07, 2008 12:38 pm

Post by chrilleman »

Hello, sounds great to send the alarm frame to email when something happends, but how do you add this feature??

I can some linux but not really elite.

Can you please make a small guide or something?

Thanks!

//Christian
bazso
Posts: 11
Joined: Wed May 14, 2008 6:50 pm

Post by bazso »

Hi,

it's simple. If you do not want to work with diff patch, or you have different version, do this:
Edit the zmfilter.pl file
find the firs line containing EI1 string, insert EI1O like that (look at the patch where and how)
find the second EI1 string, copy the whole "if" block, in one of them change EI1 to EI1O
Ooops, don't forget to change d-capture.jpg to d-analyse.jpg
Done

You have %EI1O% token what you can use in the email settings.

(Try to pair these steps to the patch, easy to learn)

BaZso
User avatar
Normando
Posts: 219
Joined: Sun Aug 17, 2008 5:34 am
Location: Rosario - Argentina

Post by Normando »

This hack shoul be enclosed in an if statement for ZM_CREATE_ANALYSIS_IMAGES
Post Reply