1

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

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
done

Simply 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.sh

The 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.

  • wow thnkas for the quick reply and the great for the script. 15 secs should be fine and can always change as you say. copied in to leafpad but not certain what you mean by saving it in home area. assumed in my home folder parent and it's listed below downloads, documents, videos etc... ran the two commands you gave and yes got the 'unknown -H option'. however audacious did open but with out playing any music. as far as i can see the first songs to be played in the music folder are mp3's so don't know what is up. – flyaway Oct 28 '15 at 18:43
  • @flyaway hmm okay run without the -H ? so edit the script and then run it again. Yes, home area is along side your documents. Are your songs all in Music, not in a folder inside music? – Tim Oct 28 '15 at 18:45
  • that could be it. the songs are in different folders depending on the aritst/album etc – flyaway Oct 28 '15 at 19:24
  • all the files i want to use are actually on an external hard drive. sorry forgot to mention this. i was first trying your script on the music on the internal HD. assuming its the folder within a folder issue, is the way round that? the music folder on the external also has folders within folders... and i just change the path name in your the first line ' filename in ~/Music/*.mp3; do' to the appropriate one to get to the music folder on my hard drive right? thanks again for you time with this. i'm fairly new to linux so this help is much appreciated – flyaway Oct 28 '15 at 19:30
  • @flyaway yeah, so you need to change it to be the correct path (I guess something in /media, you can find it out by opening the file in your file manager and pressing Ctrl + L (it will highlight the location). That's the thing to change ~/Music for. Then see my edit for the folders inside folders thing. – Tim Oct 28 '15 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.