From 8bd1d500c7bf61d5e982e8484834cc3caa145b68 Mon Sep 17 00:00:00 2001 From: jneilliii Date: Fri, 26 Apr 2024 20:21:17 -0400 Subject: [PATCH] 0.5.2 fix OctoPrint 1.9.0+ compatibility, #71, #77 --- octoprint_youtubelive/__init__.py | 13 +++++++++---- setup.py | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/octoprint_youtubelive/__init__.py b/octoprint_youtubelive/__init__.py index 52ef93c..9ff264d 100644 --- a/octoprint_youtubelive/__init__.py +++ b/octoprint_youtubelive/__init__.py @@ -3,6 +3,7 @@ import octoprint.plugin from octoprint.server import user_permission +from octoprint.util import version import docker class youtubelive(octoprint.plugin.StartupPlugin, @@ -85,16 +86,20 @@ def on_event(self, event, payload): def startStream(self): if not self.container: filters = [] - if self._settings.global_get(["webcam","flipH"]): + if self._settings.global_get_boolean(["webcam", "flipH"]) or self._settings.global_get_boolean(["plugins", "classicwebcam", "flipH"]): filters.append("hflip") - if self._settings.global_get(["webcam","flipV"]): + if self._settings.global_get(["webcam", "flipV"]) or self._settings.global_get_boolean(["plugins", "classicwebcam", "flipV"]): filters.append("vflip") - if self._settings.global_get(["webcam","rotate90"]): + if self._settings.global_get(["webcam", "rotate90"]) or self._settings.global_get_boolean(["plugins", "classicwebcam", "rotate90"]): filters.append("transpose=cclock") if len(filters) == 0: filters.append("null") try: - self.container = self.client.containers.run("octoprint/youtubelive:latest",command=[self._settings.global_get(["webcam","stream"]),self._settings.get(["stream_id"]),",".join(filters)],detach=True,privileged=False,devices=["/dev/vchiq"],name="YouTubeLive",auto_remove=True,network_mode="host") + if version.is_octoprint_compatible(">=1.9.0"): + stream_url = self._settings.global_get(["plugins", "classicwebcam", "stream"]) + else: + stream_url = self._settings.global_get(["webcam", "stream"]) + self.container = self.client.containers.run("octoprint/youtubelive:latest",command=[stream_url, self._settings.get(["stream_id"]),",".join(filters)],detach=True,privileged=False,devices=["/dev/vchiq"],name="YouTubeLive",auto_remove=True,network_mode="host") self._plugin_manager.send_plugin_message(self._identifier, dict(status=True,streaming=True)) except Exception as e: self._plugin_manager.send_plugin_message(self._identifier, dict(error=str(e),status=True,streaming=False)) diff --git a/setup.py b/setup.py index ba8efa9..ea7e7c1 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ plugin_name = "YouTube Live" # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module -plugin_version = "0.5.2" +plugin_version = "0.5.3" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module