MM5: Rename Artist Node with MM5 Script?

Get help for different MediaMonkey v5 / v2024 Addons.

Moderators: jiri, drakinite, Addon Administrators

MaxMoor
Posts: 3
Joined: Thu Nov 06, 2008 1:32 pm

MM5: Rename Artist Node with MM5 Script?

Post by MaxMoor »

I have a PILE of tracks with artist listed as Last Name First. I want everything First Name First. I have a script that cycles through a selected track list to do this. Many tracks have more than one artist, separated by semi-colons, but the script I have doesn't handle that.

I noticed, when I rename an artist's node, in the tree, it updates the names of all the tracks for that artist, even if the track has multiple artists. I decided I want a script that gets the name of the selected Artist Node, fixes the name, then writes it back to the node, kicking off that automatic updating of the tracks.

I get the name using a script that starts:

Code: Select all

actions.ArtistNodeFNF = {
    title: _('Artist Node FNF'),
    hotkeyAble: true,
    execute: function () {

	var    OldArtistTitle, NewArtistTitle;
        var    node = currentTabControl.mediatree.controlClass.dataSource.focusedNode;
    
        OldArtistTitle= node.title;
        
From there, I parse it and build the new name. I've used a messageDlg to verify the script works to that point. From there, I thought I could simply do:

Code: Select all

    node.title = NewArtistTitle;

    node.commit();
Those of you in the know, already know, this doesn't work. I'm the first to admit, where MM is concerned, I'm a total hack, so I'm not really sure if this is a reasonable thing to expect to work. Is there a simple way, from here, to write the new title string to the node, thereby touching off the automatic updating of the associated tracks?
MaxMoor
Posts: 3
Joined: Thu Nov 06, 2008 1:32 pm

Re: MM5: Rename Artist Node with MM5 Script?

Post by MaxMoor »

I figured things out.

I've been stuck trying to either edit the Artist node name programmatically, so all the associated tracks would automatically have their Artist names updated. Alternately, I could figure out how to select all the tracks in the main window listed for the selected Artist node. I already have a script that cycles through selected tracks with getSelectedTracklist. I could just that code.

I didn't initially realize I could cycle through and edit the tracks whether they are selected or not. For what I'm doing, I always check every track, so I don't need them selected. I just need to use getTracklist instead. Problems solved.
Post Reply