Using Javascript for Automation (Yosemite), I would like to update the description of an iTunes video file. The issue: the description reverts to the old value (and e.g. rating saves correctly).
The code I use:
var track = Application("iTunes").selection()[0]; // get first track from selection
console.log("--- original values ---");
console.log(track.rating()); // shows original value (66)
console.log(track.description()); // shows original value ("old value")
console.log("--- set new values ---");
track.rating = 75;
track.description = "new value";
console.log("--- new values ---");
console.log(track.rating()); // shows correct value (75)
console.log(track.description()); // shows correct value ("new value")
console.log("--- refresh track ---");
track.refresh(); // has the same effect as doing Cmd-I in iTunes
console.log("--- new values after refresh ---");
console.log(track.rating()); // shows correct value (75)
console.log(track.description()); // shows original value ("old value") <=== incorrect
Things are fine after writing the new values, but the description reverts to the old value after a refresh. E.g. the rating is saved correctly.
If I don't use the refresh(), and look at the values in iTunes, things look fine (the description shows "new value") but reverts back to the old value as soon as I do a Cmd-I for that track. That is why I use refresh(), to make sure I see the actual latest value.
Any suggestions?