Skip to content

Commit

Permalink
0.5.2
Browse files Browse the repository at this point in the history
fix OctoPrint 1.9.0+ compatibility, #71, #77
  • Loading branch information
jneilliii committed Apr 27, 2024
1 parent 77dc57b commit 8bd1d50
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions octoprint_youtubelive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8bd1d50

Please sign in to comment.