h-chi
August 19th, 2005, 07:13 AM
this is just a very simple script i made for playing(enqueueing) mp3 files
matching a certain pattern with your favorite player.
it makes use of the slocate database, which indexes the files (according to permissions) on your computer.
if slocate isn't already installed type:
sudo apt-get install slocate
to build the index type:
sudo slocate -u
(this might take a while)
then create a new file containing:
#!/bin/bash
# folder where to store temporary playlist
PLAYLIST=/tmp/playlist.m3u
if [ $3 ]
then
slocate -i $1 | grep -i $2 | grep -i $3 | grep [.]mp3 > $PLAYLIST
elif [ $2 ]
then
slocate -i $1 | grep -i $2 | grep [.]mp3 > $PLAYLIST
elif [ $1 ]
then
slocate -i $1 | grep [.]mp3 > $PLAYLIST
else
echo "usage: playall <pattern1> [pattern2] [pattern3]"
exit 0
fi
# your favorite player and the parameter for play/enqueue
amarok -e $PLAYLIST
#EOF
change permissions for the file:
chmod 755 yourfilename
now you can either put a reference to the file in your .bashrc
gedit ~/.bashrc
(add this to the existing alias definitions)
alias playall='pathtoyourfile'
or copy the file to a folder which is in your PATH variable.
now you can play, for example, all your mp3s of one artist from 1999 on a specific label (presumed you named your mp3s and your folders accordingly) by typing:
playall artist 1999 label
perhaps someone has some use for this.
it helped me alot to handle my mp3-collection.
matching a certain pattern with your favorite player.
it makes use of the slocate database, which indexes the files (according to permissions) on your computer.
if slocate isn't already installed type:
sudo apt-get install slocate
to build the index type:
sudo slocate -u
(this might take a while)
then create a new file containing:
#!/bin/bash
# folder where to store temporary playlist
PLAYLIST=/tmp/playlist.m3u
if [ $3 ]
then
slocate -i $1 | grep -i $2 | grep -i $3 | grep [.]mp3 > $PLAYLIST
elif [ $2 ]
then
slocate -i $1 | grep -i $2 | grep [.]mp3 > $PLAYLIST
elif [ $1 ]
then
slocate -i $1 | grep [.]mp3 > $PLAYLIST
else
echo "usage: playall <pattern1> [pattern2] [pattern3]"
exit 0
fi
# your favorite player and the parameter for play/enqueue
amarok -e $PLAYLIST
#EOF
change permissions for the file:
chmod 755 yourfilename
now you can either put a reference to the file in your .bashrc
gedit ~/.bashrc
(add this to the existing alias definitions)
alias playall='pathtoyourfile'
or copy the file to a folder which is in your PATH variable.
now you can play, for example, all your mp3s of one artist from 1999 on a specific label (presumed you named your mp3s and your folders accordingly) by typing:
playall artist 1999 label
perhaps someone has some use for this.
it helped me alot to handle my mp3-collection.