You would like a one click (and/or M-code) solution to publish boring videos of your machine producing stuff. Alright, meet M198:
mencoder tv:// -tv driver=v4l2:width=640:height=480:outfmt=uyvy:device=/dev/video0:input=1:fps=15 -nosound -ffourcc DX50 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:turbo:vbitrate=1200:keyint=15 -endpos $param -o /tmp/cncrecord.avi < /dev/null >& /dev/null && google youtube post –category Tech /tmp/cncrecord.avi < /dev/null >& /dev/null &
All you have to do is to install googlecl, the awesome command line client for googly stuff. Use it one by hand to get the authorization stuff done and then you can upload via MCode like M198 P60 for 60 seconds of your mill/printer/weird kinematics/whatever on youtube. Before you ask something like “Can I have a gui button with that?” I’ll give it to you right away.
Edit: Well, this is embaracing. The button just works fine but only when you do not run any G-code at the moment. This has to be that way because you can run any G-code with an MDI command which could really mess up the running G-code. Well, I’m afraid this will not work with PYVCP. You’ll have to wait until I get up to speed with GladeVCP and Python Callbacks. Or you just implement it yourself.
There is an ancient future of up to 64 so called MDI commands (weird numerical limits never grow old, do they?).
- edit your .ini and add MDI_COMMAND = M198 P60 in the [HALUI] Section. Remember the position of the command if there is more than one. In this example it is the second command.
- add a button in your panel.xml
<text>”share on youtube”</text>
- go to your postgui.hal file and wire the button to the mdi command
net remote-youtube-video halui.mdi-command-01 <= pyvcp.youtube-video
Remember: This feature has been designed by computer programmers which start counting at zero. So the first MDI command has the number zero and the second (like in this example) is number one.