How to make the folder name as Album tag for mp3?

3

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.

Praveen Sripati

Posted 2012-01-05T11:30:47.837

Reputation: 1 385

Answers

1

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

daya

Posted 2012-01-05T11:30:47.837

Reputation: 2 445

id3v2 works, but I like the other script without any file direction to a temporary file first. – Praveen Sripati – 2012-01-12T14:04:09.280

1

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

persec

Posted 2012-01-05T11:30:47.837

Reputation: 59

You should probably double quote $f too. – slhck – 2012-01-05T14:17:25.747

tested and done. – persec – 2012-01-05T14:59:15.480

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 – 2012-01-05T15:18:29.043

if you use tagmp3 directly it is tagmp3 set "%a:foldername" filename I've tested this on my machine using ubuntu 11.10. – persec – 2012-01-05T15:44:37.467

0

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.

Journeyman Geek

Posted 2012-01-05T11:30:47.837

Reputation: 119 122