by Keeps » Tue Sep 06, 2022 11:40 pm
Hello,
I'm trying to write a script that copies the metadata from an older copy of a file to a new one. I had to sort them in a pretty round-about way, but it's mostly working - everything except the track comments.
The API tells me Track.summary is a read-only shortened version of the track comment, topping out at 200 characters. That wouldn't be ideal, obviously, but I could work with it - except it doesn't seem to be true. There's a second entry in the API for Track.summary that just says "gets/sets summary," and if I use it with .setCommentAsync() the comment just gets set to "Artist - Track Name".
The better solution would be to use getCommentAsync() and setCommentAsync() to guarantee I get the entire comment, except that getCommentAsync() takes a string and setCommentAsync() returns a "Promise." All the methods for a Promise also return Promises, and I haven't found any reference either in MM's API or Mozilla's linked JavaScript documentation to actually using the async data - just methods to wait for it to finish loading. I tried adding .toString(), but that just sets the comment to the object name.
Here's my current module, along with a lot of commented-out previous attempts, if you want more context. Also, if there's a better way to operate on the members of a track list to pick the source and destination, please let me know - everything else I tried didn't do anything.
https://www.dropbox.com/s/jraymy16lvcyi ... .mmip?dl=0
Thank you!
Hello,
I'm trying to write a script that copies the metadata from an older copy of a file to a new one. I had to sort them in a pretty round-about way, but it's mostly working - everything except the track comments.
The API tells me Track.summary is a read-only shortened version of the track comment, topping out at 200 characters. That wouldn't be ideal, obviously, but I could work with it - except it doesn't seem to be true. There's a second entry in the API for Track.summary that just says "gets/sets summary," and if I use it with .setCommentAsync() the comment just gets set to "Artist - Track Name".
The better solution would be to use getCommentAsync() and setCommentAsync() to guarantee I get the entire comment, except that getCommentAsync() takes a string and setCommentAsync() returns a "Promise." All the methods for a Promise also return Promises, and I haven't found any reference either in MM's API or Mozilla's linked JavaScript documentation to actually using the async data - just methods to wait for it to finish loading. I tried adding .toString(), but that just sets the comment to the object name.
Here's my current module, along with a lot of commented-out previous attempts, if you want more context. Also, if there's a better way to operate on the members of a track list to pick the source and destination, please let me know - everything else I tried didn't do anything.
https://www.dropbox.com/s/jraymy16lvcyi54/duplicateData-007.mmip?dl=0
Thank you!