You are not logged in.
So I like VLC... alot...
I previously posted on how to control it using multimedia keys here. This was a little hackish and I knew remote control using a unix socket existed.
So I got around to writing a script that provides access to every command available via the remote control interface and here it is. The script itself contains instructions on usage.
So now someone can write some conky stuff to provide what's playing, progress etc.. hint hint
You need to install netcat-openbsd
apt-get install netcat-openbsd
Script...
#!/bin/bash
####### ~/.bin/controlvlc_socket.sh
#
# Purpose: Control vlc using your multimedia keys or cli
# Author: j@mesrobertson.com
# Date: 11-03-2011
# Dependancies: netcat-openbsd
#
# Instructions:
#
# * Place this scipt in your path and make it executable.
# * Open VLC.
# * Go to Tools > Preferences and change "Show Settings" to "All".
# * Drill down to "Interface" > "Main Inteface" and select "Remote
# control interace".
# * Drill down from "Main Interface" to RC and select "Fake TTY" and in
# "UNIX socket command input" type in: /tmp/vlc.sock
# * Click Save.
# * Restart VLC.
# * Bind a shortcut key in you WM or DE for each command e.g. in
# Openbox rc.xml's "keyboard" section and example is:
#
# ...
# <keybind key="XF86AudioPlay">
# <action name="Execute">
# <execute>controlvlc_socket.sh pause</execute>
# </action>
# </keybind>
# ...
#
# you can of course execute these straight from the cli to test.
# type "controlvlc_socket.sh help" for details about the
# available commands.
#
# It is up to your imagination how you bind any other commands that
# you would like to use. I imagine some Conky goodness :)
#
#######
vlcSocket="/tmp/vlc.sock"
case $1 in
add) command="add" ;;
enqueue) command="enqueue" ;;
playlist) command="playlist" ;;
search) command="search" ;;
sort) command="sort" ;;
sd) command="sd" ;;
play) command="play" ;;
stop) command="stop" ;;
next) command="next" ;;
prev) command="prev" ;;
goto) command="goto" ;;
repeat) command="repeat" ;;
loop) command="loop" ;;
random) command="random" ;;
clear) command="clear" ;;
status) command="status" ;;
title) command="title" ;;
title_n) command="title_n" ;;
title_p) command="title_p" ;;
chapter) command="chapter" ;;
chapter_n) command="chapter_n" ;;
chapter_p) command="chapter_p" ;;
seek) command="seek" ;;
pause) command="pause" ;;
fastforward) command="fastforward" ;;
rewind) command="rewind" ;;
faster) command="faster" ;;
slower) command="slower" ;;
normal) command="normal" ;;
rate) command="rate" ;;
frame) command="frame" ;;
fullscreen) command="fullscreen" ;;
info) command="info" ;;
stats) command="stats" ;;
get_time) command="get_time" ;;
is_playing) command="is_playing" ;;
get_title) command="get_title" ;;
get_length) command="get_length" ;;
volume) command="volume" ;;
volup) command="volup" ;;
voldown) command="voldown" ;;
adev) command="adev" ;;
achan) command="achan" ;;
atrack) command="atrack" ;;
vtrack) command="vtrack" ;;
vratio) command="vratio" ;;
vcrop) command="vcrop" ;;
vzoom) command="vzoom" ;;
snapshot) command="snapshot" ;;
strack) command="strack" ;;
hotkey) command="hotkey" ;;
menu) command="menu" ;;
set) command="set" ;;
save_env) command="save_env" ;;
alias) command="alias" ;;
description) command="description" ;;
license) command="license" ;;
help) command="help" ;;
longhelp) command="longhelp" ;;
logout) command="logout" ;;
quit) command="quit" ;;
shutdown) command="shutdown" ;;
*) echo "Usage: $0 [command]" ;;
esac
exec echo "${command}" | nc -U ${vlcSocket}
####### END #######
Last edited by jelloir (2011-03-11 11:53:55)
Offline
Cool! working here, thanks!
Just a little bug here, take a look on the strange character after music title:
http://img525.imageshack.us/img525/1658 … 201221.png
The files are saved on a ntfs partition.
and when i change music, some status msg appears for a moment and then title music again, any clue?
Last edited by soyo (2012-01-05 00:49:09)
"To understand is to transform what it is" - Jiddu Krishnammurti
Live Lactobcillus Dead - Because we have flavours!
Offline
Hi,
I am new on this board and not sure if it's ok to post in year old threads here. If not I am sorry.
I just tried this and it still works great. I also kinda got around soyos issue, by changing the last line to
text=$(echo "${command}" | nc -U ${vlcSocket})
echo $(echo "${text%?}" | tr '\n' ' ')
.
It works because I have that strange character after every title and even the time.
The conkyrc for this is
${if_running vlc}
M E D I A
${hr}
title: $alignr${texeci 2 vlcnetcat get_title}
time: $alignr${texeci 1 vlcnetcat get_time} /${texeci 2 vlcnetcat get_length} seconds${endif}
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat