dimming the lights when VLC is running

Discuss your Lua playlist, album art and interface scripts.
dannunes
New Cone
New Cone
Posts: 2
Joined: 17 Jan 2009 21:37

dimming the lights when VLC is running

Postby dannunes » 15 Jul 2012 07:41

My goal is to have my room lights dim when VLC is playing a video track, then raise the lights when it's done. I'm controlling the lights via X10 and have worked out a shell command for each action. What I'm stuck on now is how can I write a function for VLC to have it call my shell command when media starts, and call another command when it's done?

I have considered a python script that just polls for running processes, dimming the lights whenever VLC is running, but that seems inefficient and wouldn't be able to tell when VLC is actually playing, so I'm hoping a better route is available. Reading around VLC developer docs, there seem to be a few ways to go about this using a plugin module, but my coding comfort zone is more around scripting than actual C/C++ development. So,I'm wondering if there's anything existing that I could adapt or (assuming probably not) would it be possible to do this via a LUA script?

I've played around a little bit using a LUA playlist script and can get it to call my command using io.popen when reading a http stream, but as far as I can tell the script will only run on web streams. It doesn't get called when I run it on files on my local PC, even if I just "return true" in probe(). There's also the matter of raising the lights after the track is done that I haven't worked out.

So, is what I'm asking possible within VLC's scripting support? Am I on the right track, or can you recommend a more straightforward way?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: dimming the lights when VLC is running

Postby Jean-Baptiste Kempf » 16 Jul 2012 00:25

You can use http/xml requests of VLC to control VLC and know the actual status of playback.
You can write a VLC lua interface that does the control of lights when status is changed too.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

dannunes
New Cone
New Cone
Posts: 2
Joined: 17 Jan 2009 21:37

Re: dimming the lights when VLC is running

Postby dannunes » 19 Jul 2012 02:37

Thanks for the pointers, and great idea. Assuming this is the interface you're referring to, I'll give it a try.


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 9 guests