Help with an id3tag script
I'm pretty new to bash scripting so some of the stuff is simple, most aren't.
What I'm looking for is a script that will read all my mp3 tags within a directory using id3info and rewrite them with a predefined format using id3tag. What I do is move a group of mp3s(a 100 or so) to a directory named couch'compilation or such, then I have to manually change the id3 tags on each one to include the artist in the title, rename the album to the directory name and change the artist to me and strip the current track number. What I've got so far pretty much doesn't do anything. Code:
#!/bin/bash - Code:
couch[test]$ id3info *.mp3 Any help would be very appreciated |
Do you really want to change the song title to include both the artist and title information? Why?
Well, for one thing this will not work: Code:
id3tag -2 --song='$artist" - "$title' "$i" (Unlike single quotes, double quotes allow $, ` and \ to be interpreted, which allows for variable and command substitutions and escape sequences.). Actually, looking again, you're not even using variables, but functions. Functions aren't called by "$name", just "name" alone. So what you really need to be using is $(command) substitution: Code:
id3tag -2 --song="$(artist) - $(title)" "$i" Code:
id3info "$i"|sed -rn '\|TALB| s|.*:[ ](.*)$|\1|p' Finally, I've been working on something similar (but more complex) myself for the last week, and I've found that working with music metadata is a real pain, particularly when trying to work with multiple formats. I don't see id3info/id3tag available on Debian, but for mp3 files I've had better success with mid3v2, the python-based tag reader. It has a much easier input and output format for using in shell scripts. You might give it a try. Edit: One more thing I just noticed. You're simultaneously reading information from and writing to the same file. I'm not sure that's safe. It would be better for you to read the tag information into variables first and then write out the new values only after you have everything extracted. |
Thanks alot
Your Code:
id3tag -2 --song="$(artist) - $(title)" "$i" Why do I do this? My mp3 player(Philips GoGear 4gb) doesn't do playlists very well. When I do it this way it reads the title of the mp3 which now includes the artist. I can also change 'playlists' by selecting a new album. |
All times are GMT -5. The time now is 09:44 AM. |