I'm hoping to find a way to go through a large music collection to find a particular song.
However I do not know the title of the song, artist or album. I was hoping to find an audio player that has a 'play intro' feature, but I've looked at Clementine, Gnome, GMMP, VLC and Audacious but can't find such a feature.
Is it possible to write a script if no music player does this? I'm using Lubuntu 14.04 - the default music player is Audacious
1 Answer
This is pretty easy with a simple shell script. By "intro" I've decided 15 seconds is a good time - you can change this of course.
It also assumes all the songs are MP3 files, if they're not remove the .mp3 sections.
Finally, change ~/Music to wherever the songs are saved - e.g. on an external hard drive would be /media/username/hddname/foldername
intro=15 # Change this to change the played time.
for filename in ~/Music/*.mp3 ~/Music/**/*.mp3; do # Remove .mp3 to change type. audacious -H "$filename" & echo "$filename" sleep $intro audacious -s
doneSimply paste this into Leafpad (or your chosen editor) and save it in your home area with a .sh extension.
Then run these commands, changing filename.sh for what you named it.
chmod +x filename.sh
./filename.shThe first sets it to be allowed to run, the second will run it. Note that it won't open the window because of the -H option. This is because you are on Lubuntu, and are unlikely to have much memory.
This script will print our the name of the file when it starts to play it, so you know what you are listening to.
9