I just discovered the mdls command last night and it goes a long way to solve some scripting issues for me. I have stacks of mp3 cds and dvds (my collection of music is too large for my iPod) that i want to catalog. Using the mdls, I can extract the song title, album, and artist, but the string that is returned from the do shell script contains a lot of extra junk. I have worked around that by reading the string from a unique point, but I wonder if there is a simpler way. For instance: running the following shell script:
do shell script mdls -name kMDItemAuthors “16 Sevivon.mp3”
returns this string:
16 Sevivon.mp3 -------------
kMDItemAuthors = (“Arthur And Friends”)
Of course, all the data I want is Arthur And Friends, so it is easy to read from the parentheses and extract the wanted data, but I am curious if UNIX has a way to return a ‘cleaner’ string.
My second question is probably more of a UNIX issue, but I will throw it out anyway. I want to extract three pieces of data from each mp3:
kMDItemTitle, kMDItemAuthors, and kMDItemAlbum. Can I do this all on a single command line, and return a list of three strings? I am willing to try to write a unique shell script to do it, but I don’t know how and I have no UNIX texts in my possession.
Any suggestions on these, or good UNIX texts would be greatly appreciated.
casdvm