You are not logged in.
Pages: 1
Just a little script I am working on to grab information from InfoPipe within bash. Yes, I know theres a perl script which is probably better than my little bash script, but I figure, why use python, when simple bash can do it faster . I am mainly writing this for my conky section that grabs my xmms info
#!/bin/bash
#Xmms InfoPipe grabber v0.1
#twiistedkaos <twiistedkaos>
pipe='/tmp/xmms-info_'$USER'.0'
case "$1" in
title|Title)
cat $pipe | grep -m 1 -w -a "Title:" | cut -d":" -f2
;;
time|Time)
cat $pipe | grep -m 1 -w -a "Time:" | cut -d" " -f2
;;
tunes|Tunes)
cat $pipe | grep -m 1 -w -a "Tunes in playlist:" | cut -d":" -f2
;;
current-tune|Current-Tune)
cat $pipe | grep -m 1 -w -a "Currently playing:" | cut -d":" -f2
;;
position|Position)
cat $pipe | grep -m 1 -w -a "Position:" | cut -d" " -f3
;;
xmms|XMMS)
cat $pipe | grep -m 1 -w -a "XMMS protocol version:" | cut -d":" -f2
;;
InfoPipe|infopipe)
cat $pipe | grep -m 1 -w -a "InfoPipe Plugin version:" | cut -d":" -f2
;;
status|Status)
cat $pipe | grep -m 1 -w -a "Status:" | cut -d ":" -f2
;;
esac
If anyone has any improvement ideas, please be sure to let me know
Offline
Just some cosmetics: use 'grep ... $pipe | cut ...' instead of 'cat $pipe | grep ... | cut ...'
1000
Offline
perl != python. python would be faster than bash.
you're spawning a lot of processes in that script, which would slow it down a lot.
Offline
perl != python. python would be faster than bash.
you're spawning a lot of processes in that script, which would slow it down a lot.
Hehe indeed, but Bash was easier at the time. I am currently re-writting it in python
Offline
Pages: 1