mirror of
https://github.com/koush/scrypted.git
synced 2026-02-03 14:13:28 +00:00
cameras, etc: install pluginDependencies
This commit is contained in:
@@ -114,7 +114,7 @@ export async function scryptedEval(device: ScryptedDeviceBase, script: string, e
|
||||
export function createMonacoEvalDefaults(extraLibs: { [lib: string]: string }) {
|
||||
const bufferTypeDefs = fs.readFileSync('@types/node/buffer.d.ts').toString();
|
||||
|
||||
const safeLibs = {
|
||||
const safeLibs = {
|
||||
bufferTypeDefs,
|
||||
};
|
||||
|
||||
@@ -193,10 +193,10 @@ export interface ScriptDeviceImpl extends ScriptDevice {
|
||||
mergeHandler(device: ScryptedDeviceBase): string[];
|
||||
}
|
||||
|
||||
const methodInterfaces: { [method: string]: string } = {};
|
||||
const methodInterfaces = new Map<string, string>();
|
||||
for (const desc of Object.values(ScryptedInterfaceDescriptors)) {
|
||||
for (const method of desc.methods) {
|
||||
methodInterfaces[method] = desc.name;
|
||||
methodInterfaces.set(method, desc.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,12 +213,19 @@ export function createScriptDevice(baseInterfaces: string[]): ScriptDeviceImpl {
|
||||
},
|
||||
mergeHandler: (device: ScryptedDeviceBase) => {
|
||||
const handler = scriptHandler || {};
|
||||
for (const method of Object.keys(handler)) {
|
||||
const iface = methodInterfaces[method];
|
||||
if (iface)
|
||||
let keys: string[];
|
||||
if (handler.constructor === Object)
|
||||
keys = Object.keys(handler);
|
||||
else
|
||||
keys = Object.getOwnPropertyNames(handler.__proto__);
|
||||
|
||||
for (const method of keys) {
|
||||
const iface = methodInterfaces.get(method);
|
||||
if (iface) {
|
||||
allInterfaces.push(iface);
|
||||
device[method] = handler[method].bind(handler);
|
||||
}
|
||||
}
|
||||
Object.assign(device, handler);
|
||||
return allInterfaces;
|
||||
},
|
||||
};
|
||||
|
||||
2
external/ring-client-api
vendored
2
external/ring-client-api
vendored
Submodule external/ring-client-api updated: 5b9972b41c...1108c073ca
@@ -1,3 +1,5 @@
|
||||
# FFmpeg Camera Plugin for Scrypted
|
||||
|
||||
Add FFmpeg Camera video streams to Scrypted. Cameras often have still image snapshot URLs. To use these snapshots you will also need the [Snapshot Plugin](#/component/plugin/install/@scrypted/snapshot).
|
||||
|
||||
FFmpeg Cameras will need a software motion detector like [PAM-Diff](#/component/plugin/install/@scrypted/pam-diff) or [OpenCV](#/component/plugin/install/@scrypted/opencv) to enable HomeKit Secure Video.
|
||||
|
||||
4
plugins/ffmpeg-camera/package-lock.json
generated
4
plugins/ffmpeg-camera/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/ffmpeg-camera",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.15",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/ffmpeg-camera",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.15",
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
"@koush/axios-digest-auth": "^0.8.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/ffmpeg-camera",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.15",
|
||||
"description": "FFmpeg Camera Plugin for Scrypted",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache",
|
||||
@@ -27,6 +27,11 @@
|
||||
"interfaces": [
|
||||
"DeviceProvider",
|
||||
"DeviceCreator"
|
||||
],
|
||||
"pluginDependencies": [
|
||||
"@scrypted/prebuffer-mixin",
|
||||
"@scrypted/pam-diff",
|
||||
"@scrypted/snapshot"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import sdk, { ScryptedDeviceBase, DeviceProvider, Settings, Setting, ScryptedDeviceType, VideoCamera, MediaObject, MediaStreamOptions, ScryptedInterface, FFMpegInput, Camera, PictureOptions, SettingValue, DeviceCreator, DeviceCreatorSettings } from "@scrypted/sdk";
|
||||
import { recommendRebroadcast } from "./recommend";
|
||||
import AxiosDigestAuth from '@koush/axios-digest-auth';
|
||||
import https from 'https';
|
||||
import { randomBytes } from "crypto";
|
||||
@@ -200,8 +199,6 @@ export abstract class CameraProviderBase<T extends MediaStreamOptions> extends S
|
||||
if (camId)
|
||||
this.getDevice(camId);
|
||||
}
|
||||
|
||||
recommendRebroadcast();
|
||||
}
|
||||
|
||||
async createDevice(settings: DeviceCreatorSettings): Promise<string> {
|
||||
|
||||
@@ -3,7 +3,6 @@ import { CameraProviderBase, CameraBase, UrlMediaStreamOptions } from "./common"
|
||||
import { StorageSettings } from "../../../common/src/settings";
|
||||
import { ffmpegLogInitialOutput, safePrintFFmpegArguments } from "../../../common/src/media-helpers";
|
||||
import child_process, { ChildProcess } from "child_process";
|
||||
import { recommendDumbPlugins } from "./recommend";
|
||||
|
||||
const { mediaManager } = sdk;
|
||||
|
||||
@@ -124,11 +123,6 @@ class FFmpegCamera extends CameraBase<UrlMediaStreamOptions> implements Intercom
|
||||
}
|
||||
|
||||
class FFmpegProvider extends CameraProviderBase<UrlMediaStreamOptions> {
|
||||
constructor(nativeId?: string) {
|
||||
super(nativeId);
|
||||
recommendDumbPlugins();
|
||||
}
|
||||
|
||||
createCamera(nativeId: string): FFmpegCamera {
|
||||
return new FFmpegCamera(nativeId, this);
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import { alertRecommendedPlugins } from "@scrypted/common/src/alert-recommended-plugins";
|
||||
|
||||
export async function recommendRebroadcast() {
|
||||
alertRecommendedPlugins({
|
||||
'@scrypted/prebuffer-mixin': 'Rebroadcast',
|
||||
});
|
||||
}
|
||||
|
||||
export async function recommendDumbPlugins() {
|
||||
alertRecommendedPlugins({
|
||||
'@scrypted/snapshot': 'Snapshot Plugin',
|
||||
'@scrypted/opencv': 'OpenCV Motion Detection',
|
||||
});
|
||||
}
|
||||
4
plugins/opencv/package-lock.json
generated
4
plugins/opencv/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/opencv",
|
||||
"version": "0.0.40",
|
||||
"version": "0.0.43",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/opencv",
|
||||
"version": "0.0.40",
|
||||
"version": "0.0.43",
|
||||
"devDependencies": {
|
||||
"@scrypted/sdk": "file:../../sdk"
|
||||
}
|
||||
|
||||
@@ -25,10 +25,13 @@
|
||||
"type": "API",
|
||||
"interfaces": [
|
||||
"ObjectDetection"
|
||||
],
|
||||
"pluginDependencies": [
|
||||
"@scrypted/objectdetector"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@scrypted/sdk": "file:../../sdk"
|
||||
},
|
||||
"version": "0.0.40"
|
||||
"version": "0.0.43"
|
||||
}
|
||||
|
||||
@@ -3,22 +3,5 @@ from scrypted_sdk import systemManager, remote
|
||||
import asyncio
|
||||
from opencv import OpenCVPlugin
|
||||
|
||||
async def require_plugins(plugins: Any):
|
||||
api = remote.api
|
||||
logger = await api.getLogger(None)
|
||||
pluginsComponent = await systemManager.getComponent('plugins')
|
||||
for plugin in plugins:
|
||||
found = await pluginsComponent.getIdForPluginId(plugin)
|
||||
if found:
|
||||
continue
|
||||
name = plugins[plugin]
|
||||
await logger.log('a', 'Installation of the %s plugin is also recommended. origin:/#/component/plugin/install/%s' % (name, plugin))
|
||||
|
||||
|
||||
def create_scrypted_plugin():
|
||||
plugins = {
|
||||
'@scrypted/objectdetector': "Video Analysis Plugin",
|
||||
}
|
||||
asyncio.run_coroutine_threadsafe(require_plugins(plugins), loop=asyncio.get_event_loop())
|
||||
|
||||
return OpenCVPlugin()
|
||||
|
||||
4
plugins/pam-diff/package-lock.json
generated
4
plugins/pam-diff/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/pam-diff",
|
||||
"version": "0.0.6",
|
||||
"version": "0.0.8",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/pam-diff",
|
||||
"version": "0.0.6",
|
||||
"version": "0.0.8",
|
||||
"dependencies": {
|
||||
"@types/node": "^16.6.1",
|
||||
"pam-diff": "^1.1.0",
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
"type": "API",
|
||||
"interfaces": [
|
||||
"ObjectDetection"
|
||||
],
|
||||
"pluginDependencies": [
|
||||
"@scrypted/objectdetector"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -38,5 +41,5 @@
|
||||
"devDependencies": {
|
||||
"@scrypted/sdk": "file:../../sdk"
|
||||
},
|
||||
"version": "0.0.6"
|
||||
"version": "0.0.8"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { BufferConverter, FFMpegInput, MediaObject, ObjectDetection, ObjectDetectionModel, ObjectDetectionSession, ObjectsDetected, OnOff, ScryptedDeviceBase, ScryptedInterface, ScryptedMimeTypes } from '@scrypted/sdk';
|
||||
import { FFMpegInput, MediaObject, ObjectDetection, ObjectDetectionModel, ObjectDetectionSession, ObjectsDetected, ScryptedDeviceBase, ScryptedInterface, ScryptedMimeTypes } from '@scrypted/sdk';
|
||||
import sdk from '@scrypted/sdk';
|
||||
import { ffmpegLogInitialOutput } from "../../../common/src/media-helpers";
|
||||
import { alertRecommendedPlugins } from "../../../common/src/alert-recommended-plugins";
|
||||
|
||||
import child_process, { ChildProcess } from 'child_process';
|
||||
|
||||
@@ -23,13 +22,6 @@ interface PamDiffSession {
|
||||
class PamDiff extends ScryptedDeviceBase implements ObjectDetection {
|
||||
sessions = new Map<string, PamDiffSession>();
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
alertRecommendedPlugins({
|
||||
'@scrypted/objectdetector': 'Video Analysis Plugin',
|
||||
});
|
||||
}
|
||||
|
||||
endSession(pds: PamDiffSession) {
|
||||
this.sessions.delete(pds.id);
|
||||
const event: ObjectsDetected = {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# RTSP Camera Plugin for Scrypted
|
||||
|
||||
Add RTSP Camera video streams to Scrypted. RTSP Cameras often have still image snapshot URLs. To use these snapshots you will also need the [Snapshot Plugin](#/component/plugin/install/@scrypted/snapshot).
|
||||
|
||||
RTSP Cameras will need a software motion detector like [PAM-Diff](#/component/plugin/install/@scrypted/pam-diff) or [OpenCV](#/component/plugin/install/@scrypted/opencv) to enable HomeKit Secure Video.
|
||||
|
||||
4
plugins/rtsp/package-lock.json
generated
4
plugins/rtsp/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/rtsp",
|
||||
"version": "0.0.47",
|
||||
"version": "0.0.50",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/rtsp",
|
||||
"version": "0.0.47",
|
||||
"version": "0.0.50",
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
"@koush/axios-digest-auth": "^0.8.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/rtsp",
|
||||
"version": "0.0.47",
|
||||
"version": "0.0.50",
|
||||
"description": "RTSP Cameras and Streams Plugin for Scrypted",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache",
|
||||
@@ -27,6 +27,11 @@
|
||||
"interfaces": [
|
||||
"DeviceProvider",
|
||||
"DeviceCreator"
|
||||
],
|
||||
"pluginDependencies": [
|
||||
"@scrypted/prebuffer-mixin",
|
||||
"@scrypted/pam-diff",
|
||||
"@scrypted/snapshot"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Reference in New Issue
Block a user