by drakinite » Tue Apr 27, 2021 12:08 pm
Hello,
Good question! I'd recommend starting by reading this introduction to MM5 addons here:
https://www.mediamonkey.com/wiki/Gettin ... d_(Addons)
The method that you are looking for is the commitAsync() method of the Track class:
https://www.mediamonkey.com/docs/api/classes/Track.html
There are multiple ways to get a Track object; one of which is the uitools.getSelectedTracklist, which returns a Tracklist object:
https://www.mediamonkey.com/docs/api/cl ... klist.html
For a simple example, if you wish to add some text to the title of every selected title, here are two ways you can do it:
Code: Select all
// Get selected tracklist
let list = uitools.getSelectedTracklist();
// For each track, change the title and save each track individually.
list.forEach(track => {
track.title = track.title + 'hello world';
track.commitAsync();
});
Or:
Code: Select all
// Get selected tracklist
let list = uitools.getSelectedTracklist();
// For each track, change the title
list.forEach(track => {
track.title = track.title + 'hello world';
});
// Then, save the entire list. (commitAsync() is also a method of the Tracklist class)
list.commitAsync();
Hello,
Good question! I'd recommend starting by reading this introduction to MM5 addons here: https://www.mediamonkey.com/wiki/Getting_Started_(Addons)
The method that you are looking for is the commitAsync() method of the Track class: https://www.mediamonkey.com/docs/api/classes/Track.html
There are multiple ways to get a Track object; one of which is the uitools.getSelectedTracklist, which returns a Tracklist object: https://www.mediamonkey.com/docs/api/classes/Tracklist.html
For a simple example, if you wish to add some text to the title of every selected title, here are two ways you can do it:
[code]
// Get selected tracklist
let list = uitools.getSelectedTracklist();
// For each track, change the title and save each track individually.
list.forEach(track => {
track.title = track.title + 'hello world';
track.commitAsync();
});
[/code]
Or:
[code]
// Get selected tracklist
let list = uitools.getSelectedTracklist();
// For each track, change the title
list.forEach(track => {
track.title = track.title + 'hello world';
});
// Then, save the entire list. (commitAsync() is also a method of the Tracklist class)
list.commitAsync();
[/code]