Sample Auto-DJ script

From MediaMonkey Wiki
Revision as of 12:23, 2 May 2007 by Jiri (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This script demonstrates how to plug-in a script that manages how Auto-DJ works.

' Sample AutoDJ script
'
' This script demonstrates how to plug-in a script that manages how Auto-DJ works.
'
' [SearchAMG]
' FileName=AutoDJSample.vbs
' DisplayName=AutoDJ Sample Plug-in
' Language=VBScript
' ScriptType=4


' This procedure is called when this 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)
' Panel = Panel where script can place its controls
Sub InitConfigSheet( Panel)
  ' TBD: Add some UI, mainly a button that would open another dialog with more controls for setting parameters of this AutoDJ.
End Sub


' This procedure is called when this script should remove its UI from Options Panel.
' 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)
Sub CloseConfigSheet( Panel, SaveConfig)
  ' TBD: Save values to Registry, apply them to our internal variables.
End Sub


' This function prepares a new track to be added to Now Playing queue
Function GenerateNewTrack
  ' This example only takes a random track from DB
  Set Iter = SDB.Database.OpenSQL( "SELECT ID FROM Songs ORDER BY random(*)")
  ID = Iter.ValueByIndex(0)
  Set Iter = SDB.Database.QuerySongs( "ID=" & ID)
  Set GenerateNewTrack = Iter.Item
End Function