camera.ui3 0.0.30-alpha.0 → 0.0.30-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/interface/@camera.ui.KA9bRSoR.0.0.30-alpha.0.js +3 -0
- package/dist/interface/@tanstack.CTzdjGxD.0.0.30-alpha.0.js +1 -0
- package/dist/interface/{@vee-validate.0Cv0x9aN.0.0.30-alpha.0.js → @vee-validate.BJKTyKHK.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/@vue.BeJw0wEm.0.0.30-alpha.0.js +17 -0
- package/dist/interface/{@vueform.Du_niMHk.0.0.30-alpha.0.js → @vueform.DIw88mcs.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/{@vueuse.Dv9U068T.0.0.30-alpha.0.js → @vueuse.DK7Mz0BT.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/Account.D23CSQgK.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Adminpanel.CbDtQWxn.0.0.30-alpha.0.js +2 -0
- package/dist/interface/Appearance.az1S-8rV.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Backup.BxjbY7JO.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Camera.CWxxie6C.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Cameras.Cs1dXd-W.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Camview.uyIq-pxm.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Config.DnuL5NIv.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Console.C1dI5f9x.0.0.30-alpha.0.js +4 -0
- package/dist/interface/FirstSteps.C_TTm4lX.0.0.30-alpha.0.js +1 -0
- package/dist/interface/{NewCamera.Kn9biZIb.0.0.30-alpha.0.js → NewCamera.DjMFd-OB.0.0.30-alpha.0.js} +2 -2
- package/dist/interface/Plugin.rLO6u13g.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Plugins.Dr-sUa9o.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Recordings.4iG-hK8g.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Recordings.Dxh2d-IQ.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Settings.DAletWZO.0.0.30-alpha.0.js +1 -0
- package/dist/interface/System.Pv01yz8u.0.0.30-alpha.0.js +4 -0
- package/dist/interface/User.VLcbTFm_.0.0.30-alpha.0.js +1 -0
- package/dist/interface/{VConfigEditor.vue_vue_type_script_setup_true_lang.Br68bfQJ.0.0.30-alpha.0.js → VConfigEditor.vue_vue_type_script_setup_true_lang.pXHIBxVl.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/{VConsole.BT0UxZb1.0.0.30-alpha.0.js → VConsole.BUZLhyeb.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/VPlayer.DW5rNren.0.0.30-alpha.0.js +1 -0
- package/dist/interface/{VPluginCard.Bz3GmzAE.0.0.30-alpha.0.js → VPluginCard.D5f85QIk.0.0.30-alpha.0.js} +2 -2
- package/dist/interface/index.html +15 -14
- package/dist/interface/main.CNzh1Rg5.0.0.30-alpha.0.js +2 -0
- package/dist/interface/{pinia.DRjp4GU7.0.0.30-alpha.0.js → pinia.BPnxDxQ3.0.0.30-alpha.0.js} +2 -2
- package/dist/interface/{plugins.Ur_7V4x8.0.0.30-alpha.0.js → plugins.DIEspWyc.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/sw.js +1 -1
- package/dist/interface/{system.CRn9Cy3C.0.0.30-alpha.0.js → system.23ZKsQ9W.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/{ui.C-XbEPHk.0.0.30-alpha.0.js → ui.9t-Av5-L.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/{v-calendar.CapJoEkJ.0.0.30-alpha.0.js → v-calendar.u5cKUC4g.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/{vee-validate.DcgOEpak.0.0.30-alpha.0.js → vee-validate.DLoDjJ2f.0.0.30-alpha.0.js} +2 -2
- package/dist/interface/{vue-i18n.D2pqkMP3.0.0.30-alpha.0.js → vue-i18n.1W5jhc7l.0.0.30-alpha.0.js} +2 -2
- package/dist/interface/{vue-inline-svg.DorOTPIf.0.0.30-alpha.0.js → vue-inline-svg.Cc6uL4nI.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/{vue-router.BVs4qaVs.0.0.30-alpha.0.js → vue-router.CgUDt9kL.0.0.30-alpha.0.js} +2 -2
- package/dist/interface/{vue3-apexcharts.CBV9x5vk.0.0.30-alpha.0.js → vue3-apexcharts.D8ONfVUq.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/{vue3-dnd.CXMddGIZ.0.0.30-alpha.0.js → vue3-dnd.V9l5pvP2.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/{vue3-toastify.DE7YmDSX.0.0.30-alpha.0.js → vue3-toastify.CjNgo6aC.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/{vuetify.CYxxHEVN.0.0.30-alpha.0.js → vuetify.Box3fVLm.0.0.30-alpha.0.js} +1 -1
- package/dist/interface/zod.DnW1_kUe.0.0.30-alpha.0.js +1 -0
- package/dist/server/bin/cameraui.js +10 -7
- package/dist/server/bin/cameraui.js.map +1 -1
- package/dist/server/bin/fork.js +2 -2
- package/dist/server/bin/fork.js.map +1 -1
- package/dist/server/bin/installer/darwin.js +1 -1
- package/dist/server/bin/installer/darwin.js.map +1 -1
- package/dist/server/bin/installer/linux.js +1 -1
- package/dist/server/bin/installer/linux.js.map +1 -1
- package/dist/server/package.json +11 -15
- package/dist/server/src/api/controllers/backup.controller.js.map +1 -1
- package/dist/server/src/api/controllers/cameras.controller.js +1 -1
- package/dist/server/src/api/controllers/cameras.controller.js.map +1 -1
- package/dist/server/src/api/controllers/frameWorkers.controller.js +1 -1
- package/dist/server/src/api/controllers/frameWorkers.controller.js.map +1 -1
- package/dist/server/src/api/controllers/plugins.controller.js +1 -2
- package/dist/server/src/api/controllers/plugins.controller.js.map +1 -1
- package/dist/server/src/api/controllers/system.controller.js +1 -3
- package/dist/server/src/api/controllers/system.controller.js.map +1 -1
- package/dist/server/src/api/controllers/users.controller.js +2 -2
- package/dist/server/src/api/controllers/users.controller.js.map +1 -1
- package/dist/server/src/api/database/constants.d.ts +8 -0
- package/dist/server/src/api/database/constants.js +9 -0
- package/dist/server/src/api/database/constants.js.map +1 -0
- package/dist/server/src/api/database/index.d.ts +0 -8
- package/dist/server/src/api/database/index.js +14 -21
- package/dist/server/src/api/database/index.js.map +1 -1
- package/dist/server/src/api/database/migration.js +5 -4
- package/dist/server/src/api/database/migration.js.map +1 -1
- package/dist/server/src/api/database/types.d.ts +6 -6
- package/dist/server/src/api/go2rtc/api/application.js +1 -1
- package/dist/server/src/api/go2rtc/api/application.js.map +1 -1
- package/dist/server/src/api/index.js.map +1 -1
- package/dist/server/src/api/plugins/logger.plugin.js.map +1 -1
- package/dist/server/src/api/schemas/cameras.schema.d.ts +71 -71
- package/dist/server/src/api/schemas/config.schema.d.ts +6 -6
- package/dist/server/src/api/schemas/go2rtc.schema.d.ts +98 -98
- package/dist/server/src/api/schemas/users.schema.d.ts +116 -116
- package/dist/server/src/api/services/auth.service.js +1 -1
- package/dist/server/src/api/services/auth.service.js.map +1 -1
- package/dist/server/src/api/services/backup.service.js.map +1 -1
- package/dist/server/src/api/services/cameras.service.js +1 -1
- package/dist/server/src/api/services/cameras.service.js.map +1 -1
- package/dist/server/src/api/services/system.service.js +1 -1
- package/dist/server/src/api/services/system.service.js.map +1 -1
- package/dist/server/src/api/services/users.service.js +1 -1
- package/dist/server/src/api/services/users.service.js.map +1 -1
- package/dist/server/src/api/types/index.d.ts +2 -2
- package/dist/server/src/api/types/index.js.map +1 -1
- package/dist/server/src/api/utils/cert.js.map +1 -1
- package/dist/server/src/api/websocket/index.js.map +1 -1
- package/dist/server/src/api/websocket/nsp/notifications.js.map +1 -1
- package/dist/server/src/api/websocket/nsp/server.js +1 -1
- package/dist/server/src/api/websocket/nsp/server.js.map +1 -1
- package/dist/server/src/api.d.ts +1 -7
- package/dist/server/src/api.js.map +1 -1
- package/dist/server/src/camera/controller.d.ts +4 -6
- package/dist/server/src/camera/controller.js +5 -8
- package/dist/server/src/camera/controller.js.map +1 -1
- package/dist/server/src/camera/types.d.ts +140 -13
- package/dist/server/src/camera/types.js.map +1 -1
- package/dist/server/src/decoder/index.js.map +1 -1
- package/dist/server/src/decoder/types.d.ts +1 -18
- package/dist/server/src/decoder/worker.d.ts +3 -2
- package/dist/server/src/decoder/worker.js +10 -22
- package/dist/server/src/decoder/worker.js.map +1 -1
- package/dist/server/src/go2rtc/index.js +2 -3
- package/dist/server/src/go2rtc/index.js.map +1 -1
- package/dist/server/src/main.js +3 -3
- package/dist/server/src/main.js.map +1 -1
- package/dist/server/src/nats/index.d.ts +3 -4
- package/dist/server/src/nats/index.js +1 -3
- package/dist/server/src/nats/index.js.map +1 -1
- package/dist/server/src/nats/proxy/cameraDevice.d.ts +2 -2
- package/dist/server/src/nats/proxy/coreManager.d.ts +4 -2
- package/dist/server/src/nats/proxy/coreManager.js +7 -0
- package/dist/server/src/nats/proxy/coreManager.js.map +1 -1
- package/dist/server/src/nats/proxy/deviceManager.d.ts +5 -5
- package/dist/server/src/nats/proxy/deviceManager.js +4 -2
- package/dist/server/src/nats/proxy/deviceManager.js.map +1 -1
- package/dist/server/src/nats/server.js +2 -3
- package/dist/server/src/nats/server.js.map +1 -1
- package/dist/server/src/nats/types.d.ts +19 -32
- package/dist/server/src/nats/utils.d.ts +1 -1
- package/dist/server/src/nats/websocket.js.map +1 -1
- package/dist/server/src/plugins/index.js +11 -9
- package/dist/server/src/plugins/index.js.map +1 -1
- package/dist/server/src/plugins/interfaces/base.d.ts +1 -1
- package/dist/server/src/plugins/plugin.d.ts +1 -1
- package/dist/server/src/plugins/plugin.js +4 -4
- package/dist/server/src/plugins/plugin.js.map +1 -1
- package/dist/server/src/plugins/types.d.ts +36 -3
- package/dist/server/src/plugins/types.js.map +1 -1
- package/dist/server/src/plugins/worker.js +7 -16
- package/dist/server/src/plugins/worker.js.map +1 -1
- package/dist/server/src/services/config/constants.js +2 -2
- package/dist/server/src/services/config/constants.js.map +1 -1
- package/dist/server/src/services/config/index.d.ts +2 -0
- package/dist/server/src/services/config/index.js +10 -2
- package/dist/server/src/services/config/index.js.map +1 -1
- package/dist/server/src/services/logger/index.d.ts +4 -16
- package/dist/server/src/services/logger/index.js +4 -83
- package/dist/server/src/services/logger/index.js.map +1 -1
- package/dist/server/src/services/logger/types.d.ts +8 -0
- package/dist/server/src/services/logger/types.js +2 -0
- package/dist/server/src/services/logger/types.js.map +1 -0
- package/localdeps.txt +4 -0
- package/package.json +11 -15
- package/dist/interface/@tanstack.DYQ7Jj8U.0.0.30-alpha.0.js +0 -1
- package/dist/interface/@vue.CvjRlaU6.0.0.30-alpha.0.js +0 -17
- package/dist/interface/Account.Dm2FouAU.0.0.30-alpha.0.js +0 -1
- package/dist/interface/Adminpanel.B2Aiobnt.0.0.30-alpha.0.js +0 -2
- package/dist/interface/Appearance.EfH0tMdM.0.0.30-alpha.0.js +0 -1
- package/dist/interface/Backup.D8SRclhB.0.0.30-alpha.0.js +0 -1
- package/dist/interface/Camera.D-cOf4sS.0.0.30-alpha.0.js +0 -1
- package/dist/interface/Cameras.oolxbmXU.0.0.30-alpha.0.js +0 -1
- package/dist/interface/Camview.BHw8Pe3v.0.0.30-alpha.0.js +0 -1
- package/dist/interface/Config.DmPTI5iz.0.0.30-alpha.0.js +0 -1
- package/dist/interface/Console.Dq4khHFF.0.0.30-alpha.0.js +0 -4
- package/dist/interface/FirstSteps.Bo467abx.0.0.30-alpha.0.js +0 -1
- package/dist/interface/Plugin.BLTVcTt1.0.0.30-alpha.0.js +0 -1
- package/dist/interface/Plugins.Cp8mK__o.0.0.30-alpha.0.js +0 -1
- package/dist/interface/Recordings.B_JIFk_G.0.0.30-alpha.0.js +0 -1
- package/dist/interface/Recordings.gMbvwmk_.0.0.30-alpha.0.js +0 -1
- package/dist/interface/Settings.EhHJjGrl.0.0.30-alpha.0.js +0 -1
- package/dist/interface/System.VodoK0U6.0.0.30-alpha.0.js +0 -4
- package/dist/interface/User.DpcN7DEC.0.0.30-alpha.0.js +0 -1
- package/dist/interface/VPlayer.DYua3Eh_.0.0.30-alpha.0.js +0 -1
- package/dist/interface/main.19pRAqPU.0.0.30-alpha.0.js +0 -4
- package/dist/interface/zod.BaF2dDCd.0.0.30-alpha.0.js +0 -1
- package/dist/server/src/camera/device.d.ts +0 -29
- package/dist/server/src/camera/device.js +0 -20
- package/dist/server/src/camera/device.js.map +0 -1
- package/dist/server/src/camera/index.d.ts +0 -90
- package/dist/server/src/camera/index.js +0 -581
- package/dist/server/src/camera/index.js.map +0 -1
- package/dist/server/src/camera/interfaces/camera.d.ts +0 -10
- package/dist/server/src/camera/interfaces/camera.js +0 -23
- package/dist/server/src/camera/interfaces/camera.js.map +0 -1
- package/dist/server/src/camera/interfaces/prebuffer.d.ts +0 -11
- package/dist/server/src/camera/interfaces/prebuffer.js +0 -31
- package/dist/server/src/camera/interfaces/prebuffer.js.map +0 -1
- package/dist/server/src/camera/interfaces/ptz.d.ts +0 -13
- package/dist/server/src/camera/interfaces/ptz.js +0 -47
- package/dist/server/src/camera/interfaces/ptz.js.map +0 -1
- package/dist/server/src/camera/iou.d.ts +0 -2
- package/dist/server/src/camera/iou.js +0 -53
- package/dist/server/src/camera/iou.js.map +0 -1
- package/dist/server/src/camera/polygon.d.ts +0 -6
- package/dist/server/src/camera/polygon.js +0 -151
- package/dist/server/src/camera/polygon.js.map +0 -1
- package/dist/server/src/camera/streaming/peer-connection.d.ts +0 -55
- package/dist/server/src/camera/streaming/peer-connection.js +0 -203
- package/dist/server/src/camera/streaming/peer-connection.js.map +0 -1
- package/dist/server/src/camera/streaming/webrtc-connection.d.ts +0 -35
- package/dist/server/src/camera/streaming/webrtc-connection.js +0 -170
- package/dist/server/src/camera/streaming/webrtc-connection.js.map +0 -1
- package/dist/server/src/camera/streaming/werift-session.d.ts +0 -41
- package/dist/server/src/camera/streaming/werift-session.js +0 -179
- package/dist/server/src/camera/streaming/werift-session.js.map +0 -1
- package/dist/server/src/camera/videoFrame.d.ts +0 -24
- package/dist/server/src/camera/videoFrame.js +0 -104
- package/dist/server/src/camera/videoFrame.js.map +0 -1
- package/dist/server/src/index.d.ts +0 -18
- package/dist/server/src/index.js +0 -5
- package/dist/server/src/index.js.map +0 -1
- package/dist/server/src/nats/connection.d.ts +0 -17
- package/dist/server/src/nats/connection.js +0 -66
- package/dist/server/src/nats/connection.js.map +0 -1
- package/dist/server/src/nats/constants.d.ts +0 -1
- package/dist/server/src/nats/constants.js +0 -2
- package/dist/server/src/nats/constants.js.map +0 -1
- package/dist/server/src/nats/error.d.ts +0 -9
- package/dist/server/src/nats/error.js +0 -11
- package/dist/server/src/nats/error.js.map +0 -1
- package/dist/server/src/nats/messageQueue.d.ts +0 -20
- package/dist/server/src/nats/messageQueue.js +0 -132
- package/dist/server/src/nats/messageQueue.js.map +0 -1
- package/dist/server/src/nats/subscription.d.ts +0 -12
- package/dist/server/src/nats/subscription.js +0 -21
- package/dist/server/src/nats/subscription.js.map +0 -1
- package/dist/server/src/polyglot/node/decoder/child.d.ts +0 -1
- package/dist/server/src/polyglot/node/decoder/child.js +0 -644
- package/dist/server/src/polyglot/node/decoder/child.js.map +0 -1
- package/dist/server/src/polyglot/node/decoder/imageUtils.d.ts +0 -24
- package/dist/server/src/polyglot/node/decoder/imageUtils.js +0 -205
- package/dist/server/src/polyglot/node/decoder/imageUtils.js.map +0 -1
- package/dist/server/src/polyglot/node/decoder/wasm/build/decoder.d.ts +0 -144
- package/dist/server/src/polyglot/node/decoder/wasm/build/decoder.js +0 -65
- package/dist/server/src/polyglot/node/decoder/wasm/build/decoder.wasm +0 -0
- package/dist/server/src/polyglot/node/decoder/wasm/test/imageUtils.py +0 -106
- package/dist/server/src/polyglot/node/plugins/cameraStorage.d.ts +0 -107
- package/dist/server/src/polyglot/node/plugins/cameraStorage.js +0 -292
- package/dist/server/src/polyglot/node/plugins/cameraStorage.js.map +0 -1
- package/dist/server/src/polyglot/node/plugins/child.d.ts +0 -28
- package/dist/server/src/polyglot/node/plugins/child.js +0 -222
- package/dist/server/src/polyglot/node/plugins/child.js.map +0 -1
- package/dist/server/src/polyglot/node/plugins/configService.d.ts +0 -104
- package/dist/server/src/polyglot/node/plugins/configService.js +0 -213
- package/dist/server/src/polyglot/node/plugins/configService.js.map +0 -1
- package/dist/server/src/polyglot/node/plugins/pluginApi.d.ts +0 -35
- package/dist/server/src/polyglot/node/plugins/pluginApi.js +0 -23
- package/dist/server/src/polyglot/node/plugins/pluginApi.js.map +0 -1
- package/dist/server/src/polyglot/node/plugins/pluginLogger.d.ts +0 -18
- package/dist/server/src/polyglot/node/plugins/pluginLogger.js +0 -89
- package/dist/server/src/polyglot/node/plugins/pluginLogger.js.map +0 -1
- package/dist/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +0 -69
- package/dist/server/src/polyglot/node/plugins/proxy/cameraDevice.js +0 -423
- package/dist/server/src/polyglot/node/plugins/proxy/cameraDevice.js.map +0 -1
- package/dist/server/src/polyglot/node/plugins/proxy/coreManager.d.ts +0 -40
- package/dist/server/src/polyglot/node/plugins/proxy/coreManager.js +0 -105
- package/dist/server/src/polyglot/node/plugins/proxy/coreManager.js.map +0 -1
- package/dist/server/src/polyglot/node/plugins/proxy/deviceManager.d.ts +0 -47
- package/dist/server/src/polyglot/node/plugins/proxy/deviceManager.js +0 -164
- package/dist/server/src/polyglot/node/plugins/proxy/deviceManager.js.map +0 -1
- package/dist/server/src/polyglot/node/plugins/schema.d.ts +0 -293
- package/dist/server/src/polyglot/node/plugins/schema.js +0 -740
- package/dist/server/src/polyglot/node/plugins/schema.js.map +0 -1
- package/dist/server/src/polyglot/node/plugins/storageController.d.ts +0 -30
- package/dist/server/src/polyglot/node/plugins/storageController.js +0 -40
- package/dist/server/src/polyglot/node/plugins/storageController.js.map +0 -1
- package/dist/server/src/polyglot/python/camera/interfaces/camera.py +0 -20
- package/dist/server/src/polyglot/python/camera/interfaces/prebuffer.py +0 -28
- package/dist/server/src/polyglot/python/camera/interfaces/ptz.py +0 -38
- package/dist/server/src/polyglot/python/camera/iou.py +0 -80
- package/dist/server/src/polyglot/python/camera/polygon.py +0 -173
- package/dist/server/src/polyglot/python/camera/video_frame.py +0 -188
- package/dist/server/src/polyglot/python/camera_ui_types/__init__.py +0 -1200
- package/dist/server/src/polyglot/python/decoder/child.py +0 -882
- package/dist/server/src/polyglot/python/decoder/image_utils.py +0 -149
- package/dist/server/src/polyglot/python/decoder/typings.py +0 -99
- package/dist/server/src/polyglot/python/plugins/camera_storage.py +0 -391
- package/dist/server/src/polyglot/python/plugins/child.py +0 -394
- package/dist/server/src/polyglot/python/plugins/config_service.py +0 -187
- package/dist/server/src/polyglot/python/plugins/constants.py +0 -1
- package/dist/server/src/polyglot/python/plugins/message_queue.py +0 -182
- package/dist/server/src/polyglot/python/plugins/plugin_api.py +0 -34
- package/dist/server/src/polyglot/python/plugins/plugin_logger.py +0 -111
- package/dist/server/src/polyglot/python/plugins/proxy/camera_device.py +0 -1599
- package/dist/server/src/polyglot/python/plugins/proxy/core_manager.py +0 -145
- package/dist/server/src/polyglot/python/plugins/proxy/device_manager.py +0 -226
- package/dist/server/src/polyglot/python/plugins/schema.py +0 -181
- package/dist/server/src/polyglot/python/plugins/storage_controller.py +0 -58
- package/dist/server/src/polyglot/python/plugins/typings.py +0 -253
- package/dist/server/src/polyglot/python/utilities/connection.py +0 -86
- package/dist/server/src/polyglot/python/utilities/json_lmdb.py +0 -19
- package/dist/server/src/polyglot/python/utilities/object_path.py +0 -195
- package/dist/server/src/polyglot/python/utilities/packer.py +0 -11
- package/dist/server/src/polyglot/python/utilities/subscriptions.py +0 -22
- package/dist/server/src/polyglot/python/utilities/task.py +0 -35
- package/dist/server/src/polyglot/python/utilities/thread.py +0 -10
- package/dist/server/src/polyglot/python/utilities/utils.py +0 -73
- package/dist/server/src/utils/ffmpeg.d.ts +0 -2
- package/dist/server/src/utils/ffmpeg.js +0 -61
- package/dist/server/src/utils/ffmpeg.js.map +0 -1
- package/dist/server/src/utils/network.d.ts +0 -12
- package/dist/server/src/utils/network.js +0 -92
- package/dist/server/src/utils/network.js.map +0 -1
- package/dist/server/src/utils/npm.d.ts +0 -4
- package/dist/server/src/utils/npm.js +0 -128
- package/dist/server/src/utils/npm.js.map +0 -1
- package/dist/server/src/utils/packer.d.ts +0 -2
- package/dist/server/src/utils/packer.js +0 -17
- package/dist/server/src/utils/packer.js.map +0 -1
- package/dist/server/src/utils/pythonInstaller.d.ts +0 -48
- package/dist/server/src/utils/pythonInstaller.js +0 -494
- package/dist/server/src/utils/pythonInstaller.js.map +0 -1
- package/dist/server/src/utils/reader.d.ts +0 -5
- package/dist/server/src/utils/reader.js +0 -41
- package/dist/server/src/utils/reader.js.map +0 -1
- package/dist/server/src/utils/subscribed.d.ts +0 -9
- package/dist/server/src/utils/subscribed.js +0 -17
- package/dist/server/src/utils/subscribed.js.map +0 -1
- package/dist/server/src/utils/utils.d.ts +0 -10
- package/dist/server/src/utils/utils.js +0 -165
- package/dist/server/src/utils/utils.js.map +0 -1
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
from typing import Any, Literal, Union
|
|
2
|
-
|
|
3
|
-
import numpy as np
|
|
4
|
-
from camera_ui_types import DecoderFormat, ImageCrop, ImageFormat, ImageOptions, ImageResize
|
|
5
|
-
from PIL import Image
|
|
6
|
-
from utilities.thread import to_thread
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
async def process_image_threaded(
|
|
10
|
-
image_data: bytes,
|
|
11
|
-
input_width: int,
|
|
12
|
-
input_height: int,
|
|
13
|
-
input_format: Union[DecoderFormat, Literal["rgba"], Literal["gray"]],
|
|
14
|
-
options: ImageOptions,
|
|
15
|
-
) -> bytes:
|
|
16
|
-
return await to_thread(
|
|
17
|
-
lambda: process_image(image_data, input_width, input_height, input_format, options)
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def process_image(
|
|
22
|
-
image_data: bytes,
|
|
23
|
-
input_width: int,
|
|
24
|
-
input_height: int,
|
|
25
|
-
input_format: Union[DecoderFormat, Literal["rgba"], Literal["gray"]],
|
|
26
|
-
options: ImageOptions,
|
|
27
|
-
) -> bytes:
|
|
28
|
-
image: Union[Image.Image, None] = None
|
|
29
|
-
|
|
30
|
-
crop = options.get("crop", None)
|
|
31
|
-
resize = options.get("resize", None)
|
|
32
|
-
format = options.get("format", None)
|
|
33
|
-
|
|
34
|
-
if format and format["to"] == "gray":
|
|
35
|
-
if input_format == "yuv":
|
|
36
|
-
gray = yuv420_to_gray(image_data, input_width, input_height)
|
|
37
|
-
image = Image.fromarray(gray)
|
|
38
|
-
elif input_format == "rgb":
|
|
39
|
-
image = Image.frombytes("RGB", (input_width, input_height), image_data).convert("L")
|
|
40
|
-
elif input_format == "rgba":
|
|
41
|
-
image = Image.frombytes("RGBA", (input_width, input_height), image_data).convert("L")
|
|
42
|
-
else:
|
|
43
|
-
image = Image.frombytes("L", (input_width, input_height), image_data)
|
|
44
|
-
|
|
45
|
-
format = None
|
|
46
|
-
elif format and format["to"] == "rgba":
|
|
47
|
-
if input_format == "yuv":
|
|
48
|
-
rgba = yuv420_to_rgba(image_data, input_width, input_height)
|
|
49
|
-
image = Image.fromarray(rgba)
|
|
50
|
-
elif input_format == "rgb":
|
|
51
|
-
image = Image.frombytes("RGB", (input_width, input_height), image_data).convert("RGBA")
|
|
52
|
-
elif input_format == "gray":
|
|
53
|
-
image = Image.frombytes("L", (input_width, input_height), image_data).convert("RGBA")
|
|
54
|
-
else:
|
|
55
|
-
image = Image.frombytes("RGBA", (input_width, input_height), image_data)
|
|
56
|
-
|
|
57
|
-
format = None
|
|
58
|
-
else:
|
|
59
|
-
if input_format == "yuv":
|
|
60
|
-
rgb = yuv420_to_rgb(image_data, input_width, input_height)
|
|
61
|
-
image = Image.fromarray(rgb)
|
|
62
|
-
elif input_format == "rgb":
|
|
63
|
-
image = Image.frombytes("RGB", (input_width, input_height), image_data)
|
|
64
|
-
elif input_format == "gray":
|
|
65
|
-
image = Image.frombytes("L", (input_width, input_height), image_data)
|
|
66
|
-
else:
|
|
67
|
-
image = Image.frombytes("RGBA", (input_width, input_height), image_data)
|
|
68
|
-
|
|
69
|
-
if crop:
|
|
70
|
-
image = crop_image(image, crop)
|
|
71
|
-
input_width = crop["width"]
|
|
72
|
-
input_height = crop["height"]
|
|
73
|
-
|
|
74
|
-
if resize:
|
|
75
|
-
image = resize_image(image, input_width, input_height, resize)
|
|
76
|
-
input_width = resize.get("width", input_width)
|
|
77
|
-
input_height = resize.get("height", input_height)
|
|
78
|
-
|
|
79
|
-
if format:
|
|
80
|
-
image = format_image(image, format)
|
|
81
|
-
|
|
82
|
-
return image.tobytes()
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def crop_image(image: Image.Image, crop: ImageCrop) -> Image.Image:
|
|
86
|
-
crop_box = (
|
|
87
|
-
int(crop["left"]),
|
|
88
|
-
int(crop["top"]),
|
|
89
|
-
int(crop["left"] + crop["width"]),
|
|
90
|
-
int(crop["top"] + crop["height"]),
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
return image.crop(crop_box)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
def resize_image(image: Image.Image, input_width: int, input_height: int, resize: ImageResize) -> Image.Image:
|
|
97
|
-
width = resize.get("width", input_width)
|
|
98
|
-
height = resize.get("height", input_height)
|
|
99
|
-
|
|
100
|
-
if width and height and (width != input_width and height != input_height):
|
|
101
|
-
image = image.resize((int(width), int(height)), resample=Image.Resampling.BILINEAR)
|
|
102
|
-
|
|
103
|
-
return image
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def format_image(image: Image.Image, format: ImageFormat) -> Image.Image:
|
|
107
|
-
if format["to"] == "rgba":
|
|
108
|
-
image = image.convert("RGBA")
|
|
109
|
-
elif format["to"] == "gray":
|
|
110
|
-
image = image.convert("L")
|
|
111
|
-
|
|
112
|
-
return image
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
def yuv420_to_rgb(yuv_bytes: bytes, width: int, height: int) -> np.ndarray[Any, Any]:
|
|
116
|
-
frame_size = width * height
|
|
117
|
-
uv_size = frame_size // 4
|
|
118
|
-
|
|
119
|
-
raw_data = np.frombuffer(yuv_bytes, dtype=np.uint8)
|
|
120
|
-
|
|
121
|
-
y = raw_data[:frame_size].reshape((height, width)).astype(np.float32) - 16.0
|
|
122
|
-
u = (
|
|
123
|
-
raw_data[frame_size : frame_size + uv_size].reshape((height // 2, width // 2)).astype(np.float32)
|
|
124
|
-
- 128.0
|
|
125
|
-
)
|
|
126
|
-
v = raw_data[frame_size + uv_size :].reshape((height // 2, width // 2)).astype(np.float32) - 128.0
|
|
127
|
-
|
|
128
|
-
u = u.repeat(2, axis=0).repeat(2, axis=1)
|
|
129
|
-
v = v.repeat(2, axis=0).repeat(2, axis=1)
|
|
130
|
-
|
|
131
|
-
r = y + 1.402 * v
|
|
132
|
-
g = y - 0.344136 * u - 0.714136 * v
|
|
133
|
-
b = y + 1.772 * u
|
|
134
|
-
|
|
135
|
-
rgb = np.stack((r, g, b), axis=-1)
|
|
136
|
-
return np.clip(rgb, 0, 255).astype(np.uint8)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
def yuv420_to_rgba(yuv_bytes: bytes, width: int, height: int) -> np.ndarray[Any, Any]:
|
|
140
|
-
rgb = yuv420_to_rgb(yuv_bytes, width, height)
|
|
141
|
-
alpha = np.full((height, width, 1), 255, dtype=np.uint8)
|
|
142
|
-
rgba = np.concatenate((rgb, alpha), axis=-1)
|
|
143
|
-
return rgba
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
def yuv420_to_gray(yuv_bytes: bytes, width: int, height: int) -> np.ndarray[Any, Any]:
|
|
147
|
-
frame_size = width * height
|
|
148
|
-
raw_data = np.frombuffer(yuv_bytes, dtype=np.uint8)
|
|
149
|
-
return raw_data[:frame_size].reshape((height, width)).astype(np.uint8)
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
from typing import Any
|
|
2
|
-
|
|
3
|
-
from camera_ui_types import FrameMetadata
|
|
4
|
-
from typing_extensions import Literal, NotRequired, TypedDict
|
|
5
|
-
|
|
6
|
-
WorkerMessage = Literal["started", "getFFmpegArgs", "updateClient", "removeClient"]
|
|
7
|
-
|
|
8
|
-
MainMessage = Literal["setCameraName", "recoverClients"]
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class AuthConfig(TypedDict):
|
|
12
|
-
user: str
|
|
13
|
-
password: str
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class BaseFrameWorkerConfig(TypedDict):
|
|
17
|
-
frameWorkerId: str
|
|
18
|
-
cameraId: str
|
|
19
|
-
cameraName: str
|
|
20
|
-
ffmpegPath: str
|
|
21
|
-
logLevel: str
|
|
22
|
-
disableTimestamps: bool
|
|
23
|
-
auth: AuthConfig
|
|
24
|
-
proxyEndpoints: list[str]
|
|
25
|
-
fps: int
|
|
26
|
-
resolution: int
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class MainToWorkerMessage(TypedDict):
|
|
30
|
-
message: MainMessage
|
|
31
|
-
data: dict[str, Any]
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class WorkerToMainResponse(TypedDict):
|
|
35
|
-
response: NotRequired[dict[str, Any]]
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class WorkerToMainMessage(TypedDict):
|
|
39
|
-
message: WorkerMessage
|
|
40
|
-
data: dict[str, Any]
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
class MainToWorkerResponse(TypedDict):
|
|
44
|
-
response: NotRequired[dict[str, Any]]
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class FfmpegArgs(TypedDict):
|
|
48
|
-
hwaccel: str
|
|
49
|
-
hwaccelArgs: list[str]
|
|
50
|
-
hwaccelFilter: str
|
|
51
|
-
threads: str
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
class FfmpegArgsResponse(TypedDict):
|
|
55
|
-
cameraSource: str
|
|
56
|
-
ffmpegArgs: FfmpegArgs
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
SignalingMessageType = Literal["connect", "disconnect", "metadata"]
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
class SignalingRequest(TypedDict):
|
|
63
|
-
type: SignalingMessageType
|
|
64
|
-
requestId: str
|
|
65
|
-
cameraId: str
|
|
66
|
-
pluginId: str
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
class SignalingResponse(TypedDict):
|
|
70
|
-
type: SignalingMessageType
|
|
71
|
-
requestId: str
|
|
72
|
-
metadata: NotRequired[FrameMetadata]
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
class PingMessage(TypedDict):
|
|
76
|
-
type: Literal["ping"]
|
|
77
|
-
requestId: str
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
class PongMessage(TypedDict):
|
|
81
|
-
type: Literal["pong"]
|
|
82
|
-
requestId: str
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
class FrameWorkerClient:
|
|
86
|
-
def __init__(self, plugin_id: str, request_ids: list[str]):
|
|
87
|
-
self.plugin_id = plugin_id
|
|
88
|
-
self.request_ids = request_ids
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
class RecoveredClient(TypedDict):
|
|
92
|
-
pluginId: str
|
|
93
|
-
requestIds: list[str]
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
class PrebufferContainer(TypedDict):
|
|
97
|
-
frame_id: str
|
|
98
|
-
time: float
|
|
99
|
-
frame: bytes
|
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
import inspect
|
|
2
|
-
from contextlib import suppress
|
|
3
|
-
from copy import deepcopy
|
|
4
|
-
from typing import Any, Optional, TypeVar, Union, cast
|
|
5
|
-
|
|
6
|
-
from camera_ui_types import (
|
|
7
|
-
JsonBaseSchema,
|
|
8
|
-
JsonSchema,
|
|
9
|
-
JsonSchemaForm,
|
|
10
|
-
RootSchema,
|
|
11
|
-
SchemaConfig,
|
|
12
|
-
)
|
|
13
|
-
from deepdiff import DeepDiff
|
|
14
|
-
from lmdbm import Lmdb
|
|
15
|
-
from plugin_api import PluginAPI
|
|
16
|
-
from schema import (
|
|
17
|
-
config_path_to_schema_path,
|
|
18
|
-
generate_json_from_root_schema,
|
|
19
|
-
get_value_by_path,
|
|
20
|
-
remove_functions_from_schema_form,
|
|
21
|
-
schema_path_to_config_path,
|
|
22
|
-
)
|
|
23
|
-
from typing_extensions import Literal, overload
|
|
24
|
-
from utilities.object_path import ObjectPath
|
|
25
|
-
from utilities.utils import merge, merge_with
|
|
26
|
-
|
|
27
|
-
P = TypeVar("P", str, int, float, bool, dict[Any, Any], list[Any], None)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class CameraStorage:
|
|
31
|
-
def __init__(
|
|
32
|
-
self,
|
|
33
|
-
api: PluginAPI,
|
|
34
|
-
plugin_db: Lmdb[Literal["config"], dict[str, Any]],
|
|
35
|
-
instance: Any,
|
|
36
|
-
camera_id: str,
|
|
37
|
-
schema: Optional[JsonSchemaForm] = None,
|
|
38
|
-
) -> None:
|
|
39
|
-
if schema is None:
|
|
40
|
-
schema = {}
|
|
41
|
-
self.__api = api
|
|
42
|
-
self.__plugin_db = plugin_db
|
|
43
|
-
self.__instance = instance
|
|
44
|
-
self.__camera_id = camera_id
|
|
45
|
-
self.schema: JsonSchemaForm = schema or {}
|
|
46
|
-
self.values: dict[str, Any] = {}
|
|
47
|
-
|
|
48
|
-
self.__api.once("shutdown", self.__close)
|
|
49
|
-
|
|
50
|
-
def initializeStorage(self) -> None:
|
|
51
|
-
"""
|
|
52
|
-
Initialize the storage.
|
|
53
|
-
This will load the configuration from the database.
|
|
54
|
-
"""
|
|
55
|
-
|
|
56
|
-
config: Any = self.__plugin_db.get("config") or {}
|
|
57
|
-
camera_config = config.get(self.__camera_id, {})
|
|
58
|
-
schema_config = generate_json_from_root_schema({"schema": self.schema})
|
|
59
|
-
self.values = merge_with(schema_config, camera_config, merge)
|
|
60
|
-
|
|
61
|
-
self.__save_db()
|
|
62
|
-
|
|
63
|
-
@overload
|
|
64
|
-
async def getValue(self, path: str) -> Union[Any, None]: ...
|
|
65
|
-
@overload
|
|
66
|
-
async def getValue(self, path: str, default_value: P) -> P: ...
|
|
67
|
-
async def getValue(self, path: str, default_value: Optional[P] = None) -> Union[P, None]:
|
|
68
|
-
"""
|
|
69
|
-
Get a value from the configuration by its key/path.
|
|
70
|
-
If the schema has an onGet function, the onGet function will be called.
|
|
71
|
-
If the onGet function is undefined, the value from the configuration will be returned.
|
|
72
|
-
If the schema has a default value, and the configuration value is undefined, the default value will be returned.
|
|
73
|
-
|
|
74
|
-
:param path: The path to the configuration value.
|
|
75
|
-
:param default_value: The default value to return if the actual value is undefined.
|
|
76
|
-
:return: The value from the configuration.
|
|
77
|
-
"""
|
|
78
|
-
|
|
79
|
-
schema_path = config_path_to_schema_path(path)
|
|
80
|
-
schema: JsonBaseSchema = ObjectPath.get(self.schema, schema_path)
|
|
81
|
-
config_value = ObjectPath.get(self.values, path)
|
|
82
|
-
|
|
83
|
-
if schema:
|
|
84
|
-
on_get_function = schema.get("onGet", None)
|
|
85
|
-
if on_get_function is not None:
|
|
86
|
-
if inspect.iscoroutinefunction(on_get_function):
|
|
87
|
-
return await on_get_function()
|
|
88
|
-
else:
|
|
89
|
-
return on_get_function() # type: ignore
|
|
90
|
-
if config_value is not None:
|
|
91
|
-
return config_value
|
|
92
|
-
if "default" in schema:
|
|
93
|
-
return schema["default"]
|
|
94
|
-
else:
|
|
95
|
-
return default_value
|
|
96
|
-
|
|
97
|
-
async def setValue(self, path: str, new_value: Any) -> None:
|
|
98
|
-
"""
|
|
99
|
-
Set a new value for a given key/path in the configuration.
|
|
100
|
-
If the schema of the value has an onSet function, and the value has changed, the onSet function will be called.
|
|
101
|
-
If the schema of the value is declared as storable, the value will be saved to the database.
|
|
102
|
-
|
|
103
|
-
:param path: The path to the configuration value.
|
|
104
|
-
:param new_value: The new value to set.
|
|
105
|
-
"""
|
|
106
|
-
|
|
107
|
-
schema_path = config_path_to_schema_path(path)
|
|
108
|
-
schema: JsonSchema = ObjectPath.get(self.schema, schema_path)
|
|
109
|
-
|
|
110
|
-
if schema:
|
|
111
|
-
old_config = deepcopy(self.values)
|
|
112
|
-
ObjectPath.set(self.values, path, new_value)
|
|
113
|
-
|
|
114
|
-
await self.__trigger_on_set_for_changes(old_config, self.values)
|
|
115
|
-
|
|
116
|
-
if self.__contains_storable_schema(schema):
|
|
117
|
-
self.__save_db()
|
|
118
|
-
|
|
119
|
-
def hasValue(self, path: str) -> bool:
|
|
120
|
-
"""
|
|
121
|
-
Check if a value exists by its config path/key.
|
|
122
|
-
|
|
123
|
-
:param path: The path to the value to check.
|
|
124
|
-
:return: True if the value exists, false otherwise.
|
|
125
|
-
"""
|
|
126
|
-
|
|
127
|
-
config_value = ObjectPath.get(self.values, path)
|
|
128
|
-
return config_value is not None
|
|
129
|
-
|
|
130
|
-
async def getConfig(self) -> SchemaConfig:
|
|
131
|
-
"""
|
|
132
|
-
Get the root schema and configuration.
|
|
133
|
-
This will also call the onGet functions for the schema.
|
|
134
|
-
|
|
135
|
-
:return: The root schema and configuration.
|
|
136
|
-
"""
|
|
137
|
-
|
|
138
|
-
filtered_schema = remove_functions_from_schema_form(self.schema)
|
|
139
|
-
root_schema: RootSchema = {"schema": filtered_schema}
|
|
140
|
-
|
|
141
|
-
await self.__resolve_on_get_functions(self.schema)
|
|
142
|
-
|
|
143
|
-
return {"rootSchema": root_schema, "config": self.values}
|
|
144
|
-
|
|
145
|
-
async def setConfig(self, new_config: dict[str, Any]) -> None:
|
|
146
|
-
"""
|
|
147
|
-
Set a new configuration.
|
|
148
|
-
If the schema of a value which has been changed has an onSet function, the onSet function will be called.
|
|
149
|
-
|
|
150
|
-
:param new_config: The new configuration to set.
|
|
151
|
-
"""
|
|
152
|
-
|
|
153
|
-
old_config = deepcopy(self.values)
|
|
154
|
-
self.values = new_config
|
|
155
|
-
|
|
156
|
-
await self.__trigger_on_set_for_changes(old_config, self.values)
|
|
157
|
-
self.__save_db()
|
|
158
|
-
|
|
159
|
-
@overload
|
|
160
|
-
async def addSchema(self, schema_or_path: JsonSchemaForm) -> None: ...
|
|
161
|
-
@overload
|
|
162
|
-
async def addSchema(self, schema_or_path: str, schema: JsonSchema) -> None: ...
|
|
163
|
-
async def addSchema(
|
|
164
|
-
self,
|
|
165
|
-
schema_or_path: Union[JsonSchemaForm, str],
|
|
166
|
-
schema: Optional[JsonSchema] = None,
|
|
167
|
-
) -> None:
|
|
168
|
-
"""
|
|
169
|
-
Add a new schema to the existing schema.
|
|
170
|
-
It will also add the value to the configuration.
|
|
171
|
-
If the schema is declared as storable, the value will be saved to the database.
|
|
172
|
-
|
|
173
|
-
:param schema: The new schema to add.
|
|
174
|
-
:param path: The path to the schema to add, optional.
|
|
175
|
-
"""
|
|
176
|
-
|
|
177
|
-
should_save = False
|
|
178
|
-
|
|
179
|
-
if isinstance(schema_or_path, str) and schema is not None:
|
|
180
|
-
path = schema_or_path
|
|
181
|
-
schema_path = config_path_to_schema_path(path)
|
|
182
|
-
|
|
183
|
-
ObjectPath.set(self.schema, schema_path, schema)
|
|
184
|
-
|
|
185
|
-
await self.__resolve_on_get_functions(schema, schema_path)
|
|
186
|
-
|
|
187
|
-
if self.__contains_storable_schema(schema):
|
|
188
|
-
should_save = True
|
|
189
|
-
|
|
190
|
-
elif isinstance(schema_or_path, dict) and schema is None:
|
|
191
|
-
new_schema = schema_or_path
|
|
192
|
-
|
|
193
|
-
self.schema = merge_with(self.schema, new_schema, merge)
|
|
194
|
-
|
|
195
|
-
await self.__resolve_on_get_functions(new_schema)
|
|
196
|
-
|
|
197
|
-
if self.__contains_storable_schema(new_schema):
|
|
198
|
-
should_save = True
|
|
199
|
-
|
|
200
|
-
else:
|
|
201
|
-
raise Exception("Invalid arguments for addSchema")
|
|
202
|
-
|
|
203
|
-
if should_save:
|
|
204
|
-
self.__save_db()
|
|
205
|
-
|
|
206
|
-
def removeSchema(self, path: str) -> None:
|
|
207
|
-
"""
|
|
208
|
-
Remove a schema by its config path/key from the existing schema.
|
|
209
|
-
It will also remove the value from the configuration.
|
|
210
|
-
If the schema is declared as storable, the value will be removed from the database.
|
|
211
|
-
|
|
212
|
-
:param path: The path to the schema to remove.
|
|
213
|
-
"""
|
|
214
|
-
|
|
215
|
-
schema_path = config_path_to_schema_path(path)
|
|
216
|
-
schema: Optional[JsonSchema] = ObjectPath.get(self.schema, schema_path) or None
|
|
217
|
-
|
|
218
|
-
if schema:
|
|
219
|
-
ObjectPath.delete(self.schema, schema_path)
|
|
220
|
-
ObjectPath.delete(self.values, path)
|
|
221
|
-
|
|
222
|
-
if self.__contains_storable_schema(schema):
|
|
223
|
-
self.__save_db()
|
|
224
|
-
|
|
225
|
-
async def changeSchema(self, path: str, new_schema: dict[str, Any]) -> None:
|
|
226
|
-
"""
|
|
227
|
-
Change a schema by its config path/key from the existing schema.
|
|
228
|
-
It will also change the value from the configuration.
|
|
229
|
-
If the schema is declared as storable, the value will be saved to the database.
|
|
230
|
-
|
|
231
|
-
:param path: The path to the schema to change.
|
|
232
|
-
:param schema: The new schema to set.
|
|
233
|
-
"""
|
|
234
|
-
|
|
235
|
-
schema_path = config_path_to_schema_path(path)
|
|
236
|
-
schema: Optional[JsonSchema] = ObjectPath.get(self.schema, schema_path) or None
|
|
237
|
-
|
|
238
|
-
if schema:
|
|
239
|
-
merge_with(schema, new_schema, merge)
|
|
240
|
-
ObjectPath.set(self.schema, schema_path, schema)
|
|
241
|
-
|
|
242
|
-
await self.__resolve_on_get_functions(schema, schema_path)
|
|
243
|
-
|
|
244
|
-
if self.__contains_storable_schema(schema):
|
|
245
|
-
self.__save_db()
|
|
246
|
-
|
|
247
|
-
def getSchema(self, path: str) -> Optional[JsonSchema]:
|
|
248
|
-
"""
|
|
249
|
-
Get a schema by its config path/key.
|
|
250
|
-
|
|
251
|
-
:param path: The path to the schema to get.
|
|
252
|
-
:return: The schema.
|
|
253
|
-
"""
|
|
254
|
-
|
|
255
|
-
schema_path = config_path_to_schema_path(path)
|
|
256
|
-
schema: Optional[JsonSchema] = ObjectPath.get(self.schema, schema_path) or None
|
|
257
|
-
|
|
258
|
-
return schema
|
|
259
|
-
|
|
260
|
-
def hasSchema(self, path: str) -> bool:
|
|
261
|
-
"""
|
|
262
|
-
Check if a schema exists by its config path/key.
|
|
263
|
-
|
|
264
|
-
:param path: The path to the schema to check.
|
|
265
|
-
:return: True if the schema exists, false otherwise.
|
|
266
|
-
"""
|
|
267
|
-
|
|
268
|
-
schema_path = config_path_to_schema_path(path)
|
|
269
|
-
schema: Optional[JsonSchema] = ObjectPath.get(self.schema, schema_path) or None
|
|
270
|
-
|
|
271
|
-
return schema is not None
|
|
272
|
-
|
|
273
|
-
async def __resolve_on_get_functions(
|
|
274
|
-
self,
|
|
275
|
-
schema: Union[JsonSchemaForm, JsonSchema],
|
|
276
|
-
base_schema_path: str = "",
|
|
277
|
-
) -> None:
|
|
278
|
-
if "onGet" in schema or "onSet" in schema:
|
|
279
|
-
await self.__resolve_on_get_functions_for_schema(base_schema_path)
|
|
280
|
-
elif "type" in schema and schema["type"] == "object":
|
|
281
|
-
if "properties" in schema:
|
|
282
|
-
await self.___resolve_on_get_functions_for_object(
|
|
283
|
-
schema["properties"], # type: ignore
|
|
284
|
-
base_schema_path,
|
|
285
|
-
)
|
|
286
|
-
else:
|
|
287
|
-
_schema = cast(JsonSchemaForm, schema)
|
|
288
|
-
|
|
289
|
-
for key, value in _schema.items():
|
|
290
|
-
schema_path = f"{base_schema_path}.{key}" if base_schema_path else key
|
|
291
|
-
|
|
292
|
-
if "type" in value and value["type"] == "object":
|
|
293
|
-
if "properties" in value:
|
|
294
|
-
s: Any = value["properties"]
|
|
295
|
-
await self.__resolve_on_get_functions(s, schema_path)
|
|
296
|
-
else:
|
|
297
|
-
await self.__resolve_on_get_functions_for_schema(schema_path)
|
|
298
|
-
|
|
299
|
-
async def ___resolve_on_get_functions_for_object(
|
|
300
|
-
self,
|
|
301
|
-
schema: JsonSchemaForm,
|
|
302
|
-
base_schema_path: str,
|
|
303
|
-
) -> None:
|
|
304
|
-
for key, _ in schema.items():
|
|
305
|
-
schema_path = f"{base_schema_path}.{key}" if base_schema_path else key
|
|
306
|
-
await self.__resolve_on_get_functions_for_schema(schema_path)
|
|
307
|
-
|
|
308
|
-
async def __resolve_on_get_functions_for_schema(self, schema_path: str) -> None:
|
|
309
|
-
config_path = schema_path_to_config_path(schema_path)
|
|
310
|
-
schema_value = await self.getValue(config_path)
|
|
311
|
-
|
|
312
|
-
if schema_value is not None:
|
|
313
|
-
ObjectPath.set(self.values, config_path, schema_value)
|
|
314
|
-
|
|
315
|
-
async def __trigger_on_set_for_changes(
|
|
316
|
-
self, old_config: dict[str, Any], new_config: dict[str, Any], path: str = ""
|
|
317
|
-
) -> None:
|
|
318
|
-
for key, _ in new_config.items():
|
|
319
|
-
new_path = f"{path}.{key}" if path else key
|
|
320
|
-
old_value: Any = get_value_by_path(old_config, key) or {}
|
|
321
|
-
new_value: Any = new_config[key]
|
|
322
|
-
|
|
323
|
-
if DeepDiff(old_value, new_value, ignore_order=True) != {}:
|
|
324
|
-
schema_path = config_path_to_schema_path(new_path)
|
|
325
|
-
schema_item: Optional[JsonBaseSchema] = get_value_by_path(self.schema, schema_path)
|
|
326
|
-
|
|
327
|
-
if schema_item and schema_item["type"] != "button":
|
|
328
|
-
on_set_function = schema_item.get("onSet", None)
|
|
329
|
-
if on_set_function:
|
|
330
|
-
if inspect.iscoroutinefunction(on_set_function):
|
|
331
|
-
await on_set_function(old_value, new_value)
|
|
332
|
-
else:
|
|
333
|
-
on_set_function(old_value, new_value)
|
|
334
|
-
|
|
335
|
-
if new_value and isinstance(new_value, dict):
|
|
336
|
-
nv: Any = new_value
|
|
337
|
-
await self.__trigger_on_set_for_changes(old_value, nv, new_path)
|
|
338
|
-
|
|
339
|
-
def __filter_storable_values(
|
|
340
|
-
self,
|
|
341
|
-
schema: JsonSchemaForm,
|
|
342
|
-
base_schema_path: str = "",
|
|
343
|
-
result: dict[str, Any] = {},
|
|
344
|
-
) -> dict[str, Any]:
|
|
345
|
-
for key, value in schema.items():
|
|
346
|
-
if value["type"] == "button":
|
|
347
|
-
continue
|
|
348
|
-
|
|
349
|
-
if value["type"] == "object":
|
|
350
|
-
if "properties" in value:
|
|
351
|
-
s: Any = value["properties"]
|
|
352
|
-
path = f"{base_schema_path}.{key}" if base_schema_path else key
|
|
353
|
-
self.__filter_storable_values(s, path, result)
|
|
354
|
-
elif "store" in value and value["store"]:
|
|
355
|
-
schema_path = f"{base_schema_path}.{key}" if base_schema_path else key
|
|
356
|
-
config_path = schema_path_to_config_path(schema_path)
|
|
357
|
-
config_value = get_value_by_path(self.values, config_path)
|
|
358
|
-
|
|
359
|
-
ObjectPath.set(result, config_path, config_value)
|
|
360
|
-
|
|
361
|
-
return result
|
|
362
|
-
|
|
363
|
-
def __contains_storable_schema(
|
|
364
|
-
self,
|
|
365
|
-
schema: Union[JsonSchemaForm, JsonSchema],
|
|
366
|
-
) -> bool:
|
|
367
|
-
if schema["type"] == "boolean":
|
|
368
|
-
return False
|
|
369
|
-
|
|
370
|
-
if "store" in schema and schema["store"]:
|
|
371
|
-
return True
|
|
372
|
-
|
|
373
|
-
if schema["type"] == "object" and "properties" in schema:
|
|
374
|
-
schema_values: Any = schema["properties"].values()
|
|
375
|
-
return any(self.__contains_storable_schema(sub_schema) for sub_schema in schema_values)
|
|
376
|
-
elif schema["type"] == "array" and "items" in schema:
|
|
377
|
-
return self.__contains_storable_schema(schema["items"])
|
|
378
|
-
|
|
379
|
-
return False
|
|
380
|
-
|
|
381
|
-
def __save_db(self) -> None:
|
|
382
|
-
config: Any = self.__plugin_db.get("config") or {}
|
|
383
|
-
storable_config = self.__filter_storable_values(self.schema)
|
|
384
|
-
|
|
385
|
-
config[self.__camera_id] = storable_config
|
|
386
|
-
|
|
387
|
-
self.__plugin_db.update({"config": config})
|
|
388
|
-
|
|
389
|
-
def __close(self) -> None:
|
|
390
|
-
with suppress(Exception):
|
|
391
|
-
self.__save_db()
|