diff --git a/server/.gitignore b/server/.gitignore index 2e0226509..08d7241be 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -8,3 +8,4 @@ out scrypted.db.bak .exit .update +.venv diff --git a/server/python/plugin-remote.py b/server/python/plugin-remote.py index 3e90e3cc3..29f51e58f 100644 --- a/server/python/plugin-remote.py +++ b/server/python/plugin-remote.py @@ -23,6 +23,13 @@ from os import sys import platform import shutil import gc +import threading +import gi +gi.require_version('Gst', '1.0') + +from gi.repository import Gst, GLib + +Gst.init(None) class SystemDeviceState(TypedDict): lastEventTime: int @@ -313,7 +320,7 @@ async def async_main(loop: AbstractEventLoop): def main(): - loop = asyncio.get_event_loop() + loop = asyncio.new_event_loop() def gc_runner(): gc.collect() @@ -325,4 +332,8 @@ def main(): if __name__ == "__main__": - main() + worker = threading.Thread(target=main) + worker.start() + + loop = GLib.MainLoop() + loop.run() diff --git a/server/src/plugin/plugin-host.ts b/server/src/plugin/plugin-host.ts index 5b4ef1b4e..9d2bb81b2 100644 --- a/server/src/plugin/plugin-host.ts +++ b/server/src/plugin/plugin-host.ts @@ -242,7 +242,7 @@ export class PluginHost { }); } else { - if (process.env.SCRYPTED_SHARED_WORKER && this.packageJson.optionalDependencies && Object.keys(this.packageJson.optionalDependencies).length) { + if (!process.env.SCRYPTED_SHARED_WORKER || (this.packageJson.optionalDependencies && Object.keys(this.packageJson.optionalDependencies).length)) { this.worker = new NodeForkWorker(this.pluginId, { env, pluginDebug,