You are not logged in.
Pages: 1
Hey!
I thought about sharing a nice keybinding for mpc/mpd. It displays a dmenu in which you can type in the name of a song. The script then adds the found song to mpd's current playlist and begins to play the song imediately.
#!/bin/bash
mpc listall | dmenu -b -nb "#000" -nf "#7af" -sb "#000" -sf "#bdf" | mpc add - ; mpc play `mpc | sed -n '2,2p' | tr -s " " | cut -d " " -f 2 | cut -d "/" -f 2`
Do you have some fancy keybindings for MPD? Show them here!
Cheers Sigi
Haven't been here in a while. Still rocking Arch.
Offline
Cool! I will add this to my soon-to-be dzen setup.
I use my keyboard's "multimedia keys" through xbindkeys to control mpd. Here's the relevant part:
"amixer set PCM 5%-"
m:0x0 + c:174
"amixer set PCM 5%+"
m:0x0 + c:176
# Play / Pause
"mpc toggle"
m:0x0 + c:162
"mpc stop"
m:0x0 + c:164
"mpc prev"
m:0x0 + c:144
"mpc next"
m:0x0 + c:153
"urxvt -e ncmpc"
m:0x0 + c:129
Offline
I've got a new one. This one lets you search for an album in a dmenu. The script then clears mpd's playlist, loads all the tracks of the selected album in mpd, starts to play the first song of the album and disables random play mode:
[sigi@arch scripte]$ cat mpcalbum.sh
#!/bin/bash
ALBUMTITLE=`mpc listall | awk -F / '{print $2 " - " $3}' | grep -v mp3 | uniq | sort -f | dmenu -b -nb "#000" -nf "#7af" -sb "#000" -sf "#bdf" | sed -e 's#\ \-\ #\/#'`
mpc listall | grep "$ALBUMTITLE" > .mpdnewlist_tmp
mpc clear
j=`wc -l .mpdnewlist_tmp | awk '{print $1}'`
J=`echo $j+1 | bc`
for ((i=1; i<J; i++)) ; do
mpc add "`sed -n "${i}p" .mpdnewlist_tmp`" > /dev/null
done
mpc play 1
mpc random off
rm .mpdnewlist_tmp
This is an older one I forgot to post in the first post. Update mpds DB and load all your songs:
#!/bin/bash
cd ~/music/
mpc crop
mpc update > /dev/null
while [ `mpc | grep Updating | wc -l` == 1 ]; do
sleep 1
done
mpc clear
mpc ls | mpc add > /dev/null
mpc toggle
Have fun!
Cheers Sigi
Haven't been here in a while. Still rocking Arch.
Offline
hello, I started playing with mpc today -first time using it- and created this one called "mpcp":
#!/usr/bin/perl
@playlist=`mpc playlist`;
$arg=$ARGV[0];
for $p (@playlist)
{
if($p =~ /(\d+)\).*$arg.*/)
{
system("mpc play $1");
exit(0);
}
}
"mpcp foo" will jump in the playlist -not modifying it- to song named/tagged "foo"
may the Source be with you
Offline
Have you Syued today?
Free music for free people! | Earthlings
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery
Offline
On my laptop I use MPD (normally) and mocp (when I have the external hd connected - I don't want to deal with mpd database in that case), but I also wanted to have a unified way of controlling music by means of keybindings. This is a little script I've written:
#!/bin/sh
[ -f /home/filip/.moc/pid ] && [ -f /home/filip/.mpd/mpd.pid ] && echo "Both moc and mpd are running" && exit
case $1 in
ne)
[ -f /home/filip/.moc/pid ] && mocp -f
[ -f /home/filip/.mpd/mpd.pid ] && mpc next
;;
pr)
[ -f /home/filip/.moc/pid ] && mocp -r
[ -f /home/filip/.mpd/mpd.pid ] && mpc prev
;;
st)
[ -f /home/filip/.moc/pid ] && mocp -s
[ -f /home/filip/.mpd/mpd.pid ] && mpc stop
;;
pl)
if [ -f /home/filip/.moc/pid ]; then
state=`mocp -i | head -1 | sed 's/State: //g'`
case $state in
PLAY)
mocp -G;;
PAUSE)
mocp -G;;
STOP)
mocp -p;;
*)
;;
esac
fi
[ -f /home/filip/.mpd/mpd.pid ] && mpc toggle
;;
*)
;;
esac
And then I have this in my ~/.config/openbox/rc.xml (keybindings section)
<keybind key="W-Right">
<action name="Execute">
<command>music_control.sh ne</command>
</action>
</keybind>
<keybind key="W-Left">
<action name="Execute">
<command>music_control.sh pr</command>
</action>
</keybind>
<keybind key="W-Down">
<action name="Execute">
<command>music_control.sh st</command>
</action>
</keybind>
<keybind key="W-Up">
<action name="Execute">
<command>music_control.sh pl</command>
</action>
</keybind>
Offline
Sorry to bump but how would I set these keybindings. I'm looking for a nice solution to setting my multimedia buttons to control volume. I can get keycodes via xev, but I'm not sure what I'd use to control mpd/mpc. Using Openbox, sole WM.
Offline
Haven't been here in a while. Still rocking Arch.
Offline
hi
you might want to have a look at this post:
http://bbs.archlinux.org/viewtopic.php? … 74#p411574
I'm using a patched version of dmenu to display a vertical playlist for mpd
fresch
Offline
Pages: 1