From ebd74d00fb59d4dd2bbf7348cfb1faa7647df624 Mon Sep 17 00:00:00 2001 From: Long Zheng Date: Sat, 17 Feb 2024 13:16:07 +1100 Subject: [PATCH] snapshot: black background (#1324) * Fix WritableDeviceState * Fix tsconfig error * Generate black background instead of using black.jpg Remove redundant blur --- plugins/snapshot/fs/black.jpg | Bin 36494 -> 0 bytes plugins/snapshot/src/main.ts | 9 ++++----- plugins/snapshot/tsconfig.json | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) delete mode 100644 plugins/snapshot/fs/black.jpg diff --git a/plugins/snapshot/fs/black.jpg b/plugins/snapshot/fs/black.jpg deleted file mode 100644 index dd39e540e5b7e4ef726dc66dc011a3c1bd529b1a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 36494 zcmeI1TTmNS7=X`SLIU_eD4=bbak~`7j$}6*C}gK0Q=k+&6NgePwGYlL$pR6QO_Oc2 zWz?bdQuWDtskawe@4mHKuMf6btM$Q=UTGa?#JkQoQt#G>_3S2qA;d>Ym`cLY5knt@Sw=kW zn2^oP^7--2OhYk;r8z-DkEEJDhxQ~1U(COio}HjqaaJmvdy|$vmeNckEA(a!K?yVk z6#5>2Kku$lMaPFGnT6|5vUBTsCnmYMG2cq_h$1VBDz~U1SqL_(imb|ET2JYT5!1}5 zl9bK`w1hFJ2jWIbvb2m849F5$6SXp0d{j4uL47!xj)>pC@unyw6A^KsIVQ(49r{SJ zdpxUe8o!}GK0X=`C&Xx*u*OoYR3@dHnqZ~I(mBA~3%8WY%rAS{+MUFV8l!ic&`hmUGxdn*^srHG zX$;Bzg&u}l=u1_W3&|Z>-C@;l7-JFfa_s(+rvJl=a=5snL^~lBTj31nd)g*oUE8&*c zudk(BPnNK?Y#Z@8n;E$!B-gT0QXXtpWOwT!%kI2-cV5N7k;D_nZ=X%?So%kkJk8hG zM~L6Yw|XZyMkK7C;rxt!j9g8(tRBVsB>2 zuWo4#s~w%|y4H91Y}nL)J@?-Cz=IDx zyzh}mAA9`3lTSVU%(Kru|H7dcUpoBqE3dxx`de=wd*}GO@11!6xS#i| z2$oc?-RRY}EfJMnzN+@U`wt#1tqb+dRu5*U%4$|N&D39XN^>jwcZKc#UzN=lwounc zq=Oob6D5Pol&o(Mt^nCd%-+XnPQ~KSaulmhRjqH)>BIWdM{%mKpA}*0%i1N2$a#6 zAy7tNhCms883JYe|1t#1=*ti&qc20CjJ^zkGWs$E%IM1wD5Eb!pp3o@fin6s1j^{k z5GbQBL!gYl41qHGG6c%#%Md7|FGHY=z6^mf`Z5H{=*ti&qc20CjJ^zkGWs$E%IM1w zD5Eb!pp3o@fin6s1j^{k5GbQBL!gYl41qHGG6c%#%Md7|FGHY=z6^mf`Z5H{=*ti& zqc20CjJ^zkGWs$E%IM1wD5Eb!pp3o@fin6s1j^{k5GbQBL!gYl41qHGG6c%#%Md7| WFGHY=z6^mf`Z5H{=*ti&pZ^o5IQQlN diff --git a/plugins/snapshot/src/main.ts b/plugins/snapshot/src/main.ts index a8a326e490..1c4f9facc3 100644 --- a/plugins/snapshot/src/main.ts +++ b/plugins/snapshot/src/main.ts @@ -2,7 +2,7 @@ import { AutoenableMixinProvider } from "@scrypted/common/src/autoenable-mixin-p import { AuthFetchCredentialState, authHttpFetch } from '@scrypted/common/src/http-auth-fetch'; import { RefreshPromise, TimeoutError, createMapPromiseDebouncer, singletonPromise, timeoutPromise } from "@scrypted/common/src/promise-utils"; import { SettingsMixinDeviceBase, SettingsMixinDeviceOptions } from "@scrypted/common/src/settings-mixin"; -import sdk, { BufferConverter, Camera, DeviceManifest, DeviceProvider, FFmpegInput, HttpRequest, HttpRequestHandler, HttpResponse, MediaObject, MediaObjectOptions, MixinProvider, RequestMediaStreamOptions, RequestPictureOptions, ResponsePictureOptions, ScryptedDevice, ScryptedDeviceType, ScryptedInterface, ScryptedMimeTypes, Setting, SettingValue, Settings, VideoCamera } from "@scrypted/sdk"; +import sdk, { BufferConverter, Camera, DeviceManifest, DeviceProvider, FFmpegInput, HttpRequest, HttpRequestHandler, HttpResponse, MediaObject, MediaObjectOptions, MixinProvider, RequestMediaStreamOptions, RequestPictureOptions, ResponsePictureOptions, ScryptedDevice, ScryptedDeviceType, ScryptedInterface, ScryptedMimeTypes, Setting, SettingValue, Settings, VideoCamera, WritableDeviceState } from "@scrypted/sdk"; import { StorageSettings } from "@scrypted/sdk/storage-settings"; import https from 'https'; import os from 'os'; @@ -519,13 +519,12 @@ class SnapshotMixin extends SettingsMixinDeviceBase implements Camera { const fontFile = path.join(unzippedFs, 'Lato-Bold.ttf'); if (!errorBackground) { - const black = path.join(unzippedFs, 'black.jpg'); return ffmpegFilterImage([ - '-i', black, + '-f', 'lavfi', + '-i', 'color=black:size=1920x1080', ], { console: this.debugConsole, ffmpegPath: await mediaManager.getFFmpegPath(), - blur: true, text: { fontFile, text, @@ -723,7 +722,7 @@ export class SnapshotPlugin extends AutoenableMixinProvider implements MixinProv return undefined; } - async getMixin(mixinDevice: any, mixinDeviceInterfaces: ScryptedInterface[], mixinDeviceState: { [key: string]: any; }): Promise { + async getMixin(mixinDevice: any, mixinDeviceInterfaces: ScryptedInterface[], mixinDeviceState: WritableDeviceState): Promise { const ret = new SnapshotMixin(this, { mixinDevice, mixinDeviceInterfaces, diff --git a/plugins/snapshot/tsconfig.json b/plugins/snapshot/tsconfig.json index 34a847ad82..a976b26c4c 100644 --- a/plugins/snapshot/tsconfig.json +++ b/plugins/snapshot/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { - "module": "commonjs", - "target": "ES2021", + "module": "NodeNext", + "target": "ESNext", "resolveJsonModule": true, - "moduleResolution": "Node16", + "moduleResolution": "NodeNext", "esModuleInterop": true, "sourceMap": true },