Auto-DJ scripts

From MediaMonkey Wiki
Jump to: navigation, search

Auto-DJ scripts let developers to plug-in new scripts that handle how new tracks are added by Auto-DJ. This script type was introduced in MediaMonkey 3.0. You can see example of this script type in Sample Auto-DJ script.

Auto-DJ script basics

Each search script must be in a separate file (usually .vbs) and must contain several procedures that MediaMonkey calls. The script remains loaded in memory while it is selected as the Auto-DJ script, it is only unloaded when another Auto-DJ script is selected or Auto-DJ is disabled. Therefore you can use global script variables and keep values in them among calls to the procedures of script.

Each Auto-DJ script must be included in Scripts.ini file and designated as ScriptType=4.

Auto-DJ script structure

Each Auto-DJ script must contain several procedures so that it can properly respond to what user and MediaMonkey want from it. The required procedures are:

Sub InitConfigSheet( Panel)

This procedure is called when the script should show some UI on Options Panel (note that it's about a very small panel to be shown, more details should be configured in a separate window).

Parameters:

Panel
Panel where script can place its controls

Sub CloseConfigSheet( Panel, SaveConfig)

This procedure is called when this script should remove its UI from Options Panel.

Parameters:

Panel
Panel where UI controls were previously placed by the script.
SaveConfig
Whether user pressed Ok and values in the dialog should be applied and saved (to registry, ini file, or so).

Function GenerateNewTrack

This function prepares a new track to be added to Now Playing queue, it should return SDBSongData object.

See also

Sample Auto-DJ script