You are not logged in.
Pages: 1
Hi,
i already posted the script in the "Post your handy self made command line utilities" thread, but probably hardly anybody will look at the programming forum when searching for something like this.
I hope it is ok to post it again here, if not feel free to delete this topic (if you are a mod)
This script lets you select any track of your current mpd playlist via dmenu and makes mpd play it immediately.
I think it is pretty useful when bound to a keyboard shortcut in any tiling wm.
Yes, it took only a few minutes to do this, but maybe you'll find it useful nontheless.
#!/bin/bash
mpc play `mpc playlist | sed -e "s/^>/ /" | dmenu -i | grep -P -o "^ \d+" `
Offline
Nice . I found it pretty useful.
Thanks
Offline
Here's one for selecting which folder to play:
#!/bin/sh
cmd=$(mpc ls | dmenu)
if [ -d ~/music/"$cmd" ]; then
mpc clear & mpc add "$cmd"
mpc play
fi
Last edited by Windowlicker (2008-12-16 14:16:36)
Offline
hey, here is my version. it basically just makes sure mpd wouldn't add all of your music in case you close dmenu without selecting.
#!/bin/sh
cmd=$(mpc ls | dmenu -fn glisp -nb "#100" -nf "#b9c0af" -sb "#000" -sf "#afff2f" -i)
if [$cmd == ""]; then
echo "bye"
else
if [ -d ~/music/albums/"$cmd" ]; then
mpc add "$cmd"
mpc play
fi
fi
Offline
Ah, nice everyone! Adding now!
#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.
Offline
i think we need a dmenu hacks thread, hehe. anyway here's my version of the same thing (did someone say bikeshed?)
mine accepts search parameters or 'all' to put up the whole playlist. that way i can search from CLI or bind the 'msearch all' to a key as mentioned.
example:
msearch a love supreme
msearch led zeppelin
msearch all
#!/bin/bash
if [ -f $HOME/.dmenurc ]; then
. $HOME/.dmenurc
else
DMENU='dmenu -i'
fi
if [ $# -eq 1 -a "$1" = "all" ]; then
mpc --no-status play $(mpc playlist --format '%title% by %artist%' | cut -c 2- | sed 's/)/ -/g' | $DMENU | awk '{print $1}')
else
mpc --no-status play $(mpc playlist --format '%title% by %artist% #| %album%' | cut -c 2- | sed 's/)/ -/g' | grep -i "$*" | cut -d '|' -f 1 | $DMENU | awk '{print $1}')
fi
i also keep a file at $HOME/.dmenurc that contains the DMENU variable so my 4 different dmenu scripts can all source it and keep consistent font/colors which i can change easily from one file.
//github/
Offline
Hello I want to control mpd via dmenu/script I am using bjesus script but I have space I the name of song.
I will give you an example:
SpeedVin - Rock's
And I can't play it becouse for sh it's another command
I'm using mpd+ncmpcpp and is there any option to change spaces to _ in their config files(mpd,ncmpcpp) without change name of files ?
Ok solved now I'm using andr3as script
Thanks for help
Last edited by SpeedVin (2009-08-07 11:31:54)
Shell Scripter | C/C++/Python/Java Coder | ZSH
Offline
I modied bjesus and andr3as script's and now this script can play files with space in name and change colors
#!/bin/bash
mpc play `mpc playlist | sed -e "s/^>/ /" | dmenu -fn glisp -nb "#100" -nf "#b9c0af" -sb "#000" -sf "#afff2f" -i | grep - P -o "^ \d+" `
Shell Scripter | C/C++/Python/Java Coder | ZSH
Offline
I had an idea to search the internet from DMENU like surfraw.
surfraw ixquick -browser=firefox
But incorporating the search terms into the command line is difficult. It would be nice to make some alias like "x" then one could type "x my_term" in the DMENU and open firefox with the term searched already. I use Xmonad and vimperator, and this edition to DMENu would be neat.
Offline
You really shouldn't resurrect 2 year old threads. Just create a new one.
Offline
Pages: 1