Normally all of our songs are arranged in directory/folder structures (for eg. each folder contains all the songs of a particular movie, or of a singer, etc) on our computer. However when moving these songs to an MP3-player/iPod/mobile-phone, these systems do not understand folder structure; instead they expect the songs to be tagged correctly into separate albums so that one can play/repeat within an album.
While i would love if my MP3-player/iPod/mobile-phone understood that the folder really represents an album and that i want to cycle through all the songs within this folder, this is not to be. So the way to solve this problem is to tag all of my songs. But that’s a tedious task to edit the metadata of _all_ of my songs. Fortunately, 2 things come running to our help:
- Our songs are already _arranged_ in folders
- We’re on linux, and there are commands (tools/utilities) that we can loop through
Before i give the solution, there are a few assumptions:
- There are no spaces in any of the file/directory names, otherwise our loops might not work correctly. If that is the case, then please use some bulk file rename tool to convert all spaces to _ (underscore), or remove the spaces from the file/directory names completely
- The directory depth is zero or one only. That is, we are either inside a directory containing just songs, or inside a directory which contain directories which contain just songs. eg
- Case 1: We are inside a ‘songs’ directory which contains only mp3 files, and no directories at all
- Case 2:Or, we’re inside a ‘songs’ directory, which contains directories (only) like ‘a’, ‘b’, ‘c’, and so on. Each of ‘a’, ‘b’, ‘c’, … contain just mp3 files and no sub-directories
I hope that wasn’t too confusing
- You’ve installed the id3ed tool
- The folder name (which contains the actual song files) is the same as the name of the album (with which you want to tag the song file)
Now the solution. Go to the ‘songs’ directory, and then:
- Case 1:
p=`pwd`; a=`basename $p`; for j in `find \*mp3`; do echo $j; id3ed -q -s $j -a $a $j; done - Case 2:
for i in `ls`; do pushd $i; for j in `find \*mp3`; do echo $j; id3ed -q -s $j -a $i $j; done; popd; done
Now all of your song files have been tagged, and you may move them to your MP3-player/iPod/mobile-phone and play them as albums!