Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a bunch of mp3 and when I import them in Banshee, it's all messed up. The mp3 files I have are organized by folder and I would like to make the folder name as the album tag for the mp3, so that I can sort them easily in Banshee.

I tried easytag and audio tag tool, but was not able to figure it out. Could anyone provide me with instructions for making the folder name as album tag for mp3 in batch?

BTW, I am using Ubuntu 11.10.

Edit: For some reason which I am not aware of, the below solution of using tagmp3 doesn't work for me neither using the script or the tagmp3 directly from the terminal.

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted
+50

You can use id3v2.

If it is not there install it..

apt-get install id3v2

Try this

find . | grep .mp3$ > /tmp/flist

while read line    
do    
  dir=${line%/*}
  file=${line##*/}
  folder=${dir##*/}
  id3v2 --album "$folder" "$file"

done < /tmp/flist
share|improve this answer
    
id3v2 works, but I like the other script without any file direction to a temporary file first. –  Praveen Sripati Jan 12 '12 at 14:04
add comment

This is not easy. But I hope this helps. Save the script in a file and use chmod +x to make the file executable. Use ./filename to execute.

Be aware that before executing you need to specify in which folder you want to search. The script will go trough all subdirectories.

The script is provided as is. So test it and make a backup before, but it should work.

First install tagmp3

sudo apt-get install mpgtx

#

#!/bin/bash
IFS=$'\n'
for f in $(find /home/username/music/ -type f -name "*.mp3")
do
    dir=${f%/*}
    dironly=${dir##*/}
    tagmp3 set "%a:$dironly" "$f"
done
share|improve this answer
    
You should probably double quote $f too. –  slhck Jan 5 '12 at 14:17
    
tested and done. –  persec Jan 5 '12 at 14:59
    
The script didn't work. I checked the properties on the mp3 file. Ran the tagmp3 set "%a:folder" folderName from the terminal and still no change. –  Praveen Sripati Jan 5 '12 at 15:18
    
if you use tagmp3 directly it is tagmp3 set "%a:foldername" filename I've tested this on my machine using ubuntu 11.10. –  persec Jan 5 '12 at 15:44
add comment

I haven't tried it myself, but puddletag is a clone of mp3tag (which i use the hell out of), and is a graphical tagging software for MP3s and other music files. I believe that specifically you need to use the filename to tag feature or scripting.

I'll update my answer when i next use a linux system, and get this installed.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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