Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
}],
"plugins": [
"html",
"php-markup",
// "php-markup",
],
"rules": {
"camelcase": "off",
Expand Down
5 changes: 4 additions & 1 deletion db/zm_create.sql.in
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ CREATE TABLE `Filters` (
`AutoMoveTo` smallint(5) unsigned NOT NULL default 0,
`AutoCopy` tinyint(3) unsigned NOT NULL default '0',
`AutoCopyTo` smallint(5) unsigned NOT NULL default 0,
`AutoPlateRecognize` tinyint(3) unsigned NOT NULL default '0',
`UpdateDiskSpace` tinyint(3) unsigned NOT NULL default '0',
`Background` tinyint(1) unsigned NOT NULL default '0',
`Concurrent` tinyint(1) unsigned NOT NULL default '0',
Expand All @@ -315,6 +316,7 @@ CREATE TABLE `Frames` (
`TimeStamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`Delta` decimal(8,2) NOT NULL default '0.00',
`Score` smallint(5) unsigned NOT NULL default '0',
`Data_json` TEXT,
PRIMARY KEY (`Id`),
INDEX `EventId_idx` (`EventId`),
KEY `Type` (`Type`),
Expand Down Expand Up @@ -769,8 +771,9 @@ insert into Filters values (NULL,'PurgeWhenFull','{"sort_field":"Id","terms":[{"
1/*AutoDelete*/,
0/*AutoMove*/,0/*MoveTo*/,
0/*AutoCopy*/,0/*CopyTo*/,
0/*AutoPlateRecognize*/,
0/*UpdateDiskSpace*/,1/*Background*/,0/*Concurrent*/);
insert into Filters values (NULL,'Update DiskSpace','{"terms":[{"attr":"DiskSpace","op":"IS","val":"NULL"}]}',0,0,0,0,0,0,'',0,0,0,0,0,1,1,0);
insert into Filters values (NULL,'Update DiskSpace','{"terms":[{"attr":"DiskSpace","op":"IS","val":"NULL"}]}',0,0,0,0,0,0,'',0,0,0,0,0,0,1,1,0);

--
-- Add in some sample control protocol definitions
Expand Down
27 changes: 27 additions & 0 deletions db/zm_update-pr.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--
-- Add PlateRecognizer.com stuff
--

SET @s = (SELECT IF(
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
AND table_name = 'Filters'
AND column_name = 'AutoPlateRecognize'
) > 0,
"SELECT 'Column AutoPlateRecognize already exists in Filters'",
"ALTER TABLE Filters ADD `AutoPlateRecognize` tinyint(3) unsigned NOT NULL default '0' AFTER `AutoCopy`"
));

PREPARE stmt FROM @s;
EXECUTE stmt;

SET @s = (SELECT IF(
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
AND table_name = 'Frames'
AND column_name = 'Data_json'
) > 0,
"SELECT 'Column Data_json already exists in Frames'",
"ALTER TABLE `Frames` ADD `Data_json` text AFTER `Score`"
));

PREPARE stmt FROM @s;
EXECUTE stmt;
34 changes: 34 additions & 0 deletions scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in
Original file line number Diff line number Diff line change
Expand Up @@ -4007,6 +4007,40 @@ our @options = (
type => $types{boolean},
category => 'logging',
},
{
name => 'ZM_PLATERECOGNIZER_ENABLE',
default => 'no',
type => $types{boolean},
description => 'Whether to enable support for platerecognizer.com\'s APLR service.',
help => 'This will cause options to appear in filters and frame
views to submit images to platereconizer.com\'s service
which will return detected license plate information which
will be stored in ZM and presented when viewing events.',
category => 'plugins',
},
{
name => 'ZM_PLATERECOGNIZER_API_TOKEN',
default => '',
type => $types{string},
description => 'Your Api Key token. You must register at platerecognizer.com and cutnpaste your API Token here.',
category => 'plugins',
},
{
name => 'ZM_PLATERECOGNIZER_URL',
default => 'https://api.platerecognizer.com/v1/plate-reader/',
type => $types{url},
description => 'Endpoint URL to submit images to',
help => 'Do not change this unless you are using a local SDK install. Please consult docs.platerecognizer.com.',
category => 'plugins',
},
{
name => 'ZM_PLATERECOGNIZER_REGION',
default => '',
type => $types{string},
description => 'Specify local region to improve plate detection',
help => 'See http://docs.platerecognizer.com/#regions-supported for values.',
category => 'plugins',
}
);

our %options_hash = map { ( $_->{name}, $_ ) } @options;
Expand Down
14 changes: 13 additions & 1 deletion scripts/ZoneMinder/lib/ZoneMinder/Frame.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ require ZoneMinder::Object;

use parent qw(ZoneMinder::Object);

use vars qw/ $table $primary_key %fields /;
use vars qw/ $table $primary_key %fields $debug /;
$debug = 1;
$table = 'Frames';
$primary_key = 'Id';

Expand All @@ -51,6 +52,17 @@ sub Event {
return new ZoneMinder::Event( $_[0]{EventId} );
} # end sub Event

sub Path {
my $self = shift;
my $show = @_ ? shift : 'capture';

return sprintf(
'%s/%0'.$ZoneMinder::Config{ZM_EVENT_IMAGE_DIGITS}.'d-%s.jpg',
$self->Event()->Path(), $$self{FrameId}, $show
);
}


1;
__END__

Expand Down
Loading