Search scripts
Search scripts let developers to plug-in new search types into Auto-tag from Web dialog (formerly Auto-tag from Amazon). You can learn most about them from a well commented Sample AMG Search script. This script type was introduced in MediaMonkey 3.0.
Search 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 during the whole life of searching (i.e. starting from initialization of a search until user choosed different search method or searches for something else). Therefore you can use global script variables and keep values in them among calls to the procedures of script.
Search script structure
Each search script must contain several procedures so that it can properly respond to what user and MediaMonkey want from it. The required procedures are:
Sub StartSearch( Panel, SearchTerm, SearchArtist, SearchAlbum)
This procedure initializes the whole search. It's called only once when search is started. Its parameters are:
- Panel
- Object of SDBUITranspPanel where you can place the controls showing results. Usually, e.g. in Sample AMG Search script, it is SDBUIActiveX control containing a web browser.
- SearchTerm
- The term user searches for. In case the search string wasn't entered by the user, it's a compilation of Artist and Album values (with some useless characters removed).
- SearchArtist
- Artist extracted from tracks that are being search for. In case the search is initiated by user entering a search string, this value is empty.
- SearchAlbum
- Album extracted from tracks that are being search for. In case the search is initiated by user entering a search string, this value is empty.
In case you need details about the tracks that are being searched, use ISDBWebSearch::NewTracks property to access individual tracks.