0

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?

wivku
  • 2,457
  • 2
  • 33
  • 42
  • Try setting both the description and long description. Various track types in iTunes use one or the other. – hrbrmstr Jan 11 '15 at 13:04
  • Thanks, but I don't think that that is the issue. When I change the short description: I do see it change in iTunes, but the moment I refresh / Cmd-I it reverts to the previous value. – wivku Jan 12 '15 at 13:52

0 Answers0