Skip to content

Commit

Permalink
0.4.0
Browse files Browse the repository at this point in the history
YouTube stream now applies the flip and rotate settings from OctoPrint. Follow these upgrade instructions for docker image.

- cd ~/youtubelive
- git pull
- docker build -t octoprint/youtubelive .
  • Loading branch information
jneilliii authored Jan 31, 2018
1 parent 273117d commit f71d197
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions octoprint_youtubelive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,19 @@ def on_api_command(self, command, data):
return make_response("Insufficient rights", 403)

if command == 'startStream':
self._logger.info("Start stream command received for stream: %s" % self._settings.get(["stream_id"]))
self._logger.info("Start stream command received.")
if not self.container:
filters = []
if self._settings.global_get(["webcam","flipH"]):
filters.append("hflip")
if self._settings.global_get(["webcam","flipV"]):
filters.append("vflip")
if self._settings.global_get(["webcam","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"])],detach=True,privileged=True,name="YouTubeLive",auto_remove=True)
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=True,name="YouTubeLive",auto_remove=True)
self._plugin_manager.send_plugin_message(self._identifier, dict(status=True,streaming=True))
except Exception, 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 octoprint_youtubelive/templates/youtubelive_tab.jinja2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div id="youtubelive_wrapper">
<iframe data-bind="attr: {src: 'https://www.youtube.com/embed/live_stream?channel=' + settingsViewModel.settings.plugins.youtubelive.channel_id()}" frameborder="0" allowfullscreen></iframe>
</div>
<div class="row-fluid btn-group" style="text-align: center;padding-top: 20px;" data-bind="visible: settingsViewModel.settings.plugins.youtubelive.stream_id().length > 0 ">
<div class="row-fluid btn-group" style="text-align: center;padding-top: 20px;" data-bind="visible: settingsViewModel.settings.plugins.youtubelive.stream_id().length > 0">
<button class="btn" data-bind="click: toggleStream, css: btnclass, disable:processing"><i data-bind="css: icon"></i><span data-bind="text: streaming() ? ' Stop' : ' Go Live'"></span></button>
</div>
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.3.0"
plugin_version = "0.4.0"

# 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 f71d197

Please sign in to comment.