Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi guys
I'm searching for a script in linux bash for editing MP3s tag.
More precisely I want to capitalize any word in the tags. For exemple, if there's an Artist tag "john petrucci" I want it to be "John Petrucci".
Could you help me?
Thanks
Hi guys
I'm searching for a script in linux bash for editing MP3s tag.
More precisely I want to capitalize any word in the tags. For exemple, if there's an Artist tag "john petrucci" I want it to be "John Petrucci".
Could you help me?
Thanks
There are several perl modules for manipulating MP3 tags...you don't say what language you're wanting to write this in, but perl would be easy. Why don't you post what you've written/tried so far, and tell us where you're stuck, and we'll be happy to help.
I'd want it in linux bash.
I've tried to write something in python (the only language I know) but I've got some problems. Also, I realized I need it on linux bash because there is not supposed to be a python interpreter on the machine I'll have to run the script.
I'd want it in linux bash.
I've tried to write something in python (the only language I know) but I've got some problems. Also, I realized I need it on linux bash because there is not supposed to be a python interpreter on the machine I'll have to run the script.
What machine is that, running what version/distro of Linux? And there are lots of sample scripts you can find through Google....post what you've written/tried so far, and we can help. But we're not going to write your scripts for you.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
I would recommend to use a command line tag editor and call it from bash. I have little experience recently with tag editing, but it seems id3v2 is an option. Some grep, sed and awk and maybe tr should complete the script.
See if this gets you started in the right direction..
Code:
artist=$1;
album=$2;
genre=$3;
for filename in *mp3; ##list all mp3 names in directory
do
if [ -f "$filename" ]
then
song_name=${filename%.mp3};
mp3info -t "$song_name" -a "$artist" -l "$album" -g "$genre" "$filename";
else
:
fi
done
exit
In bash you can capitalize letters using the ^ and ^^ parameter expansion. Example:
Code:
$ name=john
$ echo ${name^}
John
To capitalize every first letter in a complete name, you have to assign it to an array, example:
Code:
$ name=( $(echo john belushi) )
$ echo ${name[@]^}
John Belushi
To be sure the names are capitalized as you desire, upon reading them from the original tag you may want to change all the letters to lowercase at first. In this case do
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.