snapshot/videoanalysis: publish

This commit is contained in:
Koushik Dutta
2023-12-15 10:56:20 -08:00
parent 99d1dc7282
commit d7201a16a7
5 changed files with 16 additions and 15 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/objectdetector",
"version": "0.1.14",
"version": "0.1.15",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/objectdetector",
"version": "0.1.14",
"version": "0.1.15",
"license": "Apache-2.0",
"dependencies": {
"@scrypted/common": "file:../../common",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/objectdetector",
"version": "0.1.14",
"version": "0.1.15",
"description": "Scrypted Video Analysis Plugin. Installed alongside a detection service like OpenCV or TensorFlow.",
"author": "Scrypted",
"license": "Apache-2.0",

View File

@@ -15,7 +15,7 @@ import { getAllDevices, safeParseJson } from './util';
const { systemManager } = sdk;
const defaultMinimumDetectionDuration = 30;
const defaultPostMotionAnalysisDuration = 20;
const defaultMotionDuration = 30;
const BUILTIN_MOTION_SENSOR_ASSIST = 'Assist';
@@ -63,12 +63,12 @@ class ObjectDetectionMixin extends SettingsMixinDeviceBase<VideoCamera & Camera
this.maybeStartDetection();
}
},
minimumDetectionDuration: {
title: 'Minimum Detection Duration',
postMotionAnalysisDuration: {
title: 'Post Motion Analysis Duration',
subgroup: 'Advanced',
description: 'The minimum duration in seconds to analyze video when motion occurs.',
description: 'The duration in seconds to analyze video after motion ends.',
type: 'number',
defaultValue: defaultMinimumDetectionDuration,
defaultValue: defaultPostMotionAnalysisDuration,
},
motionDuration: {
title: 'Motion Duration',
@@ -204,8 +204,9 @@ class ObjectDetectionMixin extends SettingsMixinDeviceBase<VideoCamera & Camera
if (!this.hasMotionType) {
this.motionListener = this.cameraDevice.listen(ScryptedInterface.MotionSensor, async () => {
if (!this.cameraDevice.motionDetected) {
const minimumEndTme = this.detectionStartTime + this.storageSettings.values.minimumDetectionDuration * 1000;
const sleepTime = minimumEndTme - Date.now();
// const minimumEndTme = this.detectionStartTime + this.storageSettings.values.minimumDetectionDuration * 1000;
// const sleepTime = minimumEndTme - Date.now();
const sleepTime = this.storageSettings.values.postMotionAnalysisDuration * 1000;
if (sleepTime > 0) {
this.console.log('Motion stopped. Waiting additional time for minimum detection duration:', sleepTime);
@@ -665,7 +666,7 @@ class ObjectDetectionMixin extends SettingsMixinDeviceBase<VideoCamera & Camera
}
this.storageSettings.settings.motionSensorSupplementation.hide = !this.hasMotionType || !this.mixinDeviceInterfaces.includes(ScryptedInterface.MotionSensor);
this.storageSettings.settings.minimumDetectionDuration.hide = this.hasMotionType;
this.storageSettings.settings.postMotionAnalysisDuration.hide = this.hasMotionType;
this.storageSettings.settings.motionDuration.hide = !this.hasMotionType;
settings.push(...await this.storageSettings.getSettings());
@@ -807,7 +808,7 @@ class ObjectDetectionMixin extends SettingsMixinDeviceBase<VideoCamera & Camera
}
else {
const settings = this.getCurrentSettings();
if (settings && settings[key]) {
if (settings && key in settings) {
this.storage.setItem(key, vs);
settings[key] = value;
}

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/snapshot",
"version": "0.2.18",
"version": "0.2.21",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/snapshot",
"version": "0.2.18",
"version": "0.2.21",
"dependencies": {
"@koush/axios-digest-auth": "^0.8.5",
"@types/node": "^18.16.18",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/snapshot",
"version": "0.2.18",
"version": "0.2.21",
"description": "Snapshot Plugin for Scrypted",
"scripts": {
"scrypted-setup-project": "scrypted-setup-project",