Page 1 of 1

Script for changing TAG's in MP3-File?

Posted: Tue Apr 27, 2021 8:48 am
by Charly-IV
Hello,

I'm looking for a VBS-Script or an Information how to create a new script to change TAG's in an MP3-File. I wrote a Script to change TAG's in the MM-Database, but it doesn't work whithin the File.

Thanks and Greeting from Austria

Re: Script for changing TAG's in MP3-File?

Posted: Tue Apr 27, 2021 12:08 pm
by drakinite
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();

Re: Script for changing TAG's in MP3-File?

Posted: Tue Apr 27, 2021 3:30 pm
by TIV73
In addition to the snippets posted by drakinite you could also have a look at the swapArtistTitle addon which comes with mediamonkey.