With the sbIPlaylistCommandsHelper you can create and display the most common types of playlist commands rapidly and easily. It should be used whenever possible because of its simplicity relative to the basic methods for interacting with playlist commands and a committment to the service's maintenance that will ensure your code functions properly for as long as possible.
The playlist commands helper can expedite the creation of the most common form of playlist command: an action. Action playlist commands are the simplest, representing a button that the user can click in a context menu or the toolbar at the bottom of the medialist view. createCommandObjectForAction is the method to use for the creation of these commands and it will need a unique id for the playlist command, a user-facing label, some tooltip text (though this is unimplemented as of Nightingale 1.12.1 so it will not appear), and a callback function (or sbIPlaylistCommandsBuilderSimpleCallback object that implements handleCallback in C++ land).
There are two methods for adding a playlist command to a medialist or medialists in the playlist commands helper, addCommandObjectForGUID and addCommandObjectForType. These methods differ in whether a playlist command is registered to a specific medialist, through that medialist's guid, or to a medialist type such that it shows for all medialist's of that type, likely 'simple' or 'smart'.
addCommandObjectForGUID and addCommandObjectForType differ only in their second parameters with addCommandObjectForGUID taking a specific playlist's guid while addCommandObjectForType takes a medialist type string, like 'simple'. Otherwise, the first param for both methods is an unsigned short of flags that will specify where the command should appear. The target flags defined in sbIPlaylistCommandsHelper are:
Target flags can be |'d together to specify multiple places for the command to appear. The last param for both methods is the playlist command to be added.
Playlist commands can be removed through the helper with removeCommandObjectForGUID and removeCommandObjectForType. They are analogous to their addCommandObjectFor* cousins and take the same parameters. Of note, a playlist command can be removed from only a subset of the places it was added to. Once a command is removed from all locations that it was registered to that command's shutdownCommands() should be called.
The last two methods in the playlist commands helper are getCommandObjectForGUID and getCommandObjectForType. These are analogous to their addCommandObjectFor* and removeCommandObjectFor* cousins with the only difference between the two methods being whether the helper searches for playlist commands registered to a specific guid or a specific type.
These methods take as a first parameter a target flag that indicates where the helper should look for the playlist command. The options for this flag are the same as those described above, however only one flag should be used without any '|' concatenation of flags. The second parameter is the guid or type of medialist to be searched, and the last parameter is the id of the command object to be searched for. If the command is found, it will be returned, otherwise it will be null.