From b8ff3a003c1bf22ccb939b49b0d1929aee77eecb Mon Sep 17 00:00:00 2001
From: Sailor <>
Date: Tue, 26 Nov 2019 12:39:20 +0000
Subject: [PATCH] 73_DoorBird: Feature - Videos File Format as Attribute
git-svn-id: https://svn.fhem.de/fhem/trunk@20597 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/73_DoorBird.pm | 72 +++++++++++++++++++++++++++++++++++++---
1 file changed, 67 insertions(+), 5 deletions(-)
diff --git a/fhem/FHEM/73_DoorBird.pm b/fhem/FHEM/73_DoorBird.pm
index e2a34023c..eb0d2a166 100644
--- a/fhem/FHEM/73_DoorBird.pm
+++ b/fhem/FHEM/73_DoorBird.pm
@@ -84,6 +84,7 @@ sub DoorBird_Initialize($)
"ImageFileDir " .
"AudioFileDir " .
"VideoFileDir " .
+ "VideoFileFormat:mpeg,mpg,mp4,avi,mov,dvd,vob,ogg,ogv,mkv,flv,webm " .
"VideoDurationDoorbell " .
"VideoDurationMotion " .
"VideoDurationKeypad " .
@@ -180,6 +181,7 @@ sub DoorBird_Define($$)
$hash->{helper}{ImageFileDir} = AttrVal($name, "ImageFileDir", "");
$hash->{helper}{AudioFileDir} = AttrVal($name, "AudioFileDir", "");
$hash->{helper}{VideoFileDir} = AttrVal($name, "VideoFileDir", "");
+ $hash->{helper}{VideoFileFormat} = AttrVal($name, "VideoFileFormat","mpeg");
$hash->{helper}{VideoDurationDoorbell} = AttrVal($name, "VideoDurationDoorbell", 0);
$hash->{helper}{VideoDurationMotion} = AttrVal($name, "VideoDurationMotion", 0);
$hash->{helper}{VideoDurationKeypad} = AttrVal($name, "VideoDurationKeypad", 0);
@@ -501,7 +503,19 @@ sub DoorBird_Attr(@)
### Set helper in hash
$hash->{helper}{VideoDurationKeypad} = "0";
}
- }
+ }
+ ### Check whether VideoFileFormat attribute has been provided
+ elsif ($a[2] eq "VideoFileFormat") {
+ ### Check whether VideoFileFormat is defined
+ if (defined($a[3])) {
+ ### Set helper in hash
+ $hash->{helper}{VideoFileFormat} = $a[3];
+ }
+ else {
+ ### Set helper in hash
+ $hash->{helper}{VideoFileFormat} = "mpeg";
+ }
+ }
### Check whether EventReset attribute has been provided
elsif ($a[2] eq "EventReset") {
### Remove Timer for Event Reset
@@ -3521,10 +3535,10 @@ sub DoorBird_Video_Request($$$$) {
### Check whether the last "/" at the end of the path has been given otherwise add it an create complete path
if ($hash->{helper}{VideoFileDir} =~ /\/\z/) {
- $VideoFileName .= $VideoFileTimeStamp . "_" . $event . ".mpeg";
+ $VideoFileName .= $VideoFileTimeStamp . "_" . $event . "." . $hash->{helper}{VideoFileFormat};
}
else {
- $VideoFileName .= "/" . $VideoFileTimeStamp . "_" . $event . ".mpeg";
+ $VideoFileName .= "/" . $VideoFileTimeStamp . "_" . $event . "." . $hash->{helper}{VideoFileFormat};
}
### Log Entry for debugging purposes
@@ -3564,10 +3578,10 @@ sub DoorBird_Video_Request($$$$) {
### Check whether the last "/" at the end of the path has been given otherwise add it an create complete path
if ($hash->{helper}{VideoFileDir} =~ /\\\z/) {
- $VideoFileName .= $VideoFileTimeStamp . "_" . $event . ".mpeg";
+ $VideoFileName .= $VideoFileTimeStamp . "_" . $event . "." . $hash->{helper}{VideoFileFormat};
}
else {
- $VideoFileName .= "\\" . $VideoFileTimeStamp . "_" . $event . ".mpeg";
+ $VideoFileName .= "\\" . $VideoFileTimeStamp . "_" . $event . "." . $hash->{helper}{VideoFileFormat};
}
### Log Entry for debugging purposes
@@ -4202,6 +4216,30 @@ sub DoorBird_BlockGet($$$$) {
The default value is ""
= disabled
+
VideoFileDir
: ""
= disabledVideoFileFormat
: "mpeg"
VideoDurationDoorbell
: 0
= disabledVideoDurationMotion
: 0
= disabledEventReset
: 0
= deaktiviertVideoFileFormat
: "mpeg"
ImageFileDir
: 0
= deaktiviertVideoFileDir
: ""
= deaktiviertVideoDurationDoorbell
: 0
= deaktiviertVideoDurationMotion
: 0
= deaktiviertEventReset
: