From 1e3d927e4870eb0cf0b449d82f0a6b3b71e169fa Mon Sep 17 00:00:00 2001 From: jneilliii Date: Fri, 11 Sep 2020 10:30:25 -0400 Subject: [PATCH] add python 3 compatibility --- octoprint_youtubelive/__init__.py | 7 ++++--- setup.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/octoprint_youtubelive/__init__.py b/octoprint_youtubelive/__init__.py index 56c135c..52ef93c 100644 --- a/octoprint_youtubelive/__init__.py +++ b/octoprint_youtubelive/__init__.py @@ -24,7 +24,7 @@ def on_after_startup(self): self.container = self.client.containers.get('YouTubeLive') self._logger.info("%s is streaming " % self.container.name) self._plugin_manager.send_plugin_message(self._identifier, dict(status=True,streaming=True)) - except Exception, e: + except Exception as e: self._logger.error(str(e)) self._plugin_manager.send_plugin_message(self._identifier, dict(status=True,streaming=False)) @@ -96,7 +96,7 @@ def startStream(self): 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") self._plugin_manager.send_plugin_message(self._identifier, dict(status=True,streaming=True)) - except Exception, e: + except Exception as e: self._plugin_manager.send_plugin_message(self._identifier, dict(error=str(e),status=True,streaming=False)) return @@ -106,7 +106,7 @@ def stopStream(self): self.container.stop() self.container = None self._plugin_manager.send_plugin_message(self._identifier, dict(status=True,streaming=False)) - except Exception, e: + except Exception as e: self._plugin_manager.send_plugin_message(self._identifier, dict(error=str(e),status=True,streaming=False)) else: self._plugin_manager.send_plugin_message(self._identifier, dict(status=True,streaming=False)) @@ -130,6 +130,7 @@ def get_update_information(self): ) __plugin_name__ = "YouTube Live" +__plugin_pythoncompat__ = ">=2.7,<4" def __plugin_load__(): global __plugin_implementation__ diff --git a/setup.py b/setup.py index 75b3b1a..ba8efa9 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.1" +plugin_version = "0.5.2" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module