Playing with the new JS for automation using Script Editor. I\'m getting an error on the final line of the following:
var iTunes = Application(\"iTunes\");
var s
In OS X 10.11.5 this seems to be working just fine.
library = Application("iTunes").sources.whose({name:'Library'})()[0]
library.properties()
// {"class":"source", "id":64, "index":1, "name":"Library", "persistentID":"2D8F973150E0A3AD", "kind":"library", "capacity":0, "freeSpace":0}
Note the addition of () after the whose clause to resolve the object specifier into an array of references and then the [0] to get the first (and only, in my case) library object reference, which can then be used to get the properties of that library.
In case the source is not named "Library" in other languages or regions, I would probably use this instead:
library = Application("iTunes").sources.whose({kind:"kLib"})()[0]