Hi everybody,
it looks like (one of) the latest public revision(s) changed how getTemporaryCopy works. Previously, I could do something like this:
Code: Select all
var currentTrack = app.player.getCurrentTrack();
var copy = currentTrack.getTemporaryCopy();
Now I'm just getting a wrong parameter count error when trying that. Other than
this, which doesn't say anything about any parameters I couldn't find any examples or documentation, so I'm a bit lost on how to use the function.
I suppose I could use getTemporaryCopies instead, but wrapping a track it in a tracklist, making a copy of said list and finally extracting a copy of the original track seems kinda hacky if I only have one track to begin with.
So, does anybody have any hints on how to use getTemporaryCopy or any other method to copy a track object that doesn't just return a reference to the original object but actually creates a new one?
Edit:
Having a look at my original function, maybe I'm overthinking this:
Code: Select all
if (track.artist !== newArtist) {
let newTrack = track.getTemporaryCopy()
newTrack.artist = newArtist
track.assign(newTrack)
}
I wrote this some time ago, so I probably just copied it from some example I found. Is there any actual benefit to cloning the object, changing a single property and then assigning the copy back to the original - I mean as opposed to just changing the property? It's probably handy if you change a couple of attributes and want to avoid having to compare every single property to update the original object, but in this case it's maybe just a waste of resources.
Edit 2:
Yes, just assigning a new value to track.artist works fine and doesn't have any negative side effects (that I could find), so I'll just use that. Out of curiosity I sill wonder how getTemporaryCopy should be used, though.