Using telnetlib is very straightforward. The code is pretty self-explanatory.
Obviously, VLC's telnet interface should be active. I found no way to find out if playback is paused in VLC or not. There are two commands that looked like they should help, but they don't. Telnet command is_playing only returns 0 if playback is stopped, not paused. status command for some reason always says "( state paused )". Anyway, I'm glad that VLC itself can create global key-bindings, so I'm happy with my current situation.;; vlc control. vlc telnet interface should be enabled. (defcommand vlc-play () () "start/resume vlc playback" (telnetlib:with-telnet-session (tn "localhost" 4212) (telnetlib:read-until tn "Password: ") (telnetlib:write-ln tn "admin") (telnetlib:read-until tn "> ") (telnetlib:write-ln tn "play") (telnetlib:read-until tn "> ") (telnetlib:write-ln tn "quit"))) (defcommand vlc-pause () () "pause vlc playback" (telnetlib:with-telnet-session (tn "localhost" 4212) (telnetlib:read-until tn "Password: ") (telnetlib:write-ln tn "admin") (telnetlib:read-until tn "> ") (telnetlib:write-ln tn "pause") (telnetlib:read-until tn "> ") (telnetlib:write-ln tn "quit")))
No comments:
Post a Comment