The question is in the title :) I'm playing a bit with Objective-C and Scripting Bridge. I know it is possible to get information (readonly) from iTunes, but i see nowhere a way to modify a track, for exemple change its name. Is it possible with this or another technology ?
Thanks a lot :)
Well, from the Scripting Library in AppleScript Editor, I can see that a file_track
inherits from item
and an item
has the read-write property name
. So you should be able to set it just as easily as you can read it.
Edit: Actually, almost every piece of meta-data is part of track
(of which file_track
inherits aswell) and most are read-write properties...
Doug Adams has one such script which can change titles from song in iTunes. Maybe have a look at it?
As for setting it via Objective-C, perhaps this documention can help you.
Exerpt from the website:
Listing 2-3 Setting the locked property of Finder items
int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; FinderApplication *theFinder = [SBApplication applicationWithBundleIdentifier: @"com.apple.finder"]; SBElementArray *trashItems = [[theFinder trash] items]; if ([trashItems count] > 0) { for (FinderItem *item in trashItems) { if ([item locked]==YES) [item setLocked:NO]; // <<<-- Setting the property } } [pool drain]; return 0; }
Have you tried:
iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"];
[[iTunes currentTrack] setName:@"The New Song Title"]);