Submitted scripts and programs
Forum rules
Your own work only.
-
machinebacon
- Baconator
- Posts: 10253
- Joined: Thu Sep 16, 2010 11:03 am
- Location: Pfälzerwald
-
Contact:
Unread post
by machinebacon » Thu Apr 23, 2015 8:17 am
Nothing special really, this just creates a menu (a la tinyradio) of all your mp3s. If you add an option (for example: playmp3 STRING) it will only list those files containing STRING.
Code: Select all
#!/bin/bash
INPUT=$1
PLAYER="mpg123 -q" # mpg123, mpg321, madplay, mpv, mplayer
MP3FULL=~/.mp3list # where to put the mp3list
MP3=~/.mp3list_grep # if $1 is used, grep
shopt -s extglob globstar
trap "{ rm -f $MP3 $MP3FULL ; exit 255; }" EXIT SIGINT SIGTERM
printf '%s\n' **/*.@(mp3|ogg|mpeg3) > $MP3FULL # add or remove what you like, here
[[ -n $1 ]] && cat $MP3FULL | grep $1 > $MP3
[[ -z $1 ]] && cat $MP3FULL > $MP3
readarray -t arr < $MP3
play ()
{
select opt in "${arr[@]}"; do
echo "Press Ctrl-C to stop playing"
$PLAYER "$opt"
done
}
play
Seems to work even with non-UNIX filenames.
..gnutella..
-
GekkoP
- Emacs Sancho Panza
- Posts: 5878
- Joined: Tue Sep 03, 2013 7:05 am
Unread post
by GekkoP » Thu Apr 23, 2015 8:31 am
Love the screenshot name, of course.
-
rhowaldt
- Dog
- Posts: 4565
- Joined: Wed Oct 17, 2012 9:01 am
-
Contact:
Unread post
by rhowaldt » Thu Apr 23, 2015 9:02 am
hahaha, nice one!
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.