MediaMonkey Automation Categorized: Difference between revisions
(19 intermediate revisions by the same user not shown) | |||
Line 14: | Line 14: | ||
SDB is an "evented" object, which means scripts can register functions (callbacks) that will be called when [[SDBApplication#ISDBApplicationEvents_members|certain events]] occur within MediaMonkey. This allows the script to respond without having to poll MediaMonkey repeatedly for conditions. | SDB is an "evented" object, which means scripts can register functions (callbacks) that will be called when [[SDBApplication#ISDBApplicationEvents_members|certain events]] occur within MediaMonkey. This allows the script to respond without having to poll MediaMonkey repeatedly for conditions. | ||
The members of SDB are: | The members of SDB are as follows, arranged by category: | ||
=== Player === | === Player === | ||
Line 30: | Line 30: | ||
* [[ISDBApplication::VisibleCollectionsCount|SDB.VisibleCollectionsCount]] is the number of collections visible in the Main Tree | * [[ISDBApplication::VisibleCollectionsCount|SDB.VisibleCollectionsCount]] is the number of collections visible in the Main Tree | ||
* [[ISDBApplication::VisibleCollectionID|SDB.VisibleCollectionID]] accepts an index and returns the ID of the collection at that item. | * [[ISDBApplication::VisibleCollectionID|SDB.VisibleCollectionID]] accepts an index and returns the ID of the collection at that item. | ||
So if VisibleCollectionsCount returns 3, VisibleCollectionID(0) will return the ID of the first visible collection, VisibleCollectionID(2) will return the ID of the third (and last) visible collection, | So if VisibleCollectionsCount returns 3, VisibleCollectionID(0) will return the ID of the first visible collection, VisibleCollectionID(2) will return the ID of the third (and last) visible collection; given an index outside that range, VisibleCollectionID will return an error indicator. The returned ID can be used to find the collection object from the list of collections found in [[#Collections|SDB.Collections]]. | ||
==== | ==== Songlists ==== | ||
Related to MainTracksWindow and MainTree are these properties, each of which yields an [[SDBSongList]] that can be queried for Count and individual Items, and other information. | Related to MainTracksWindow and MainTree are these properties, each of which yields an [[SDBSongList]] that can be queried for Count and individual Items, and other information. | ||
* [[ISDBApplication::AllVisibleSongList|SDB.AllVisibleSongList]] is the list of songs visible in the MainTracksWindow | * [[ISDBApplication::AllVisibleSongList|SDB.AllVisibleSongList]] is the list of songs visible in the MainTracksWindow | ||
Line 38: | Line 38: | ||
* [[ISDBApplication::CurrentSongList|SDB.CurrentSongList]] is the same as either AllVisibleSongList (if the focus is on the MainTree) or SelectedSongList (if the focus is on the MainTracksWindow or the Now Playing pane). | * [[ISDBApplication::CurrentSongList|SDB.CurrentSongList]] is the same as either AllVisibleSongList (if the focus is on the MainTree) or SelectedSongList (if the focus is on the MainTracksWindow or the Now Playing pane). | ||
==== UI ==== | |||
[[ISDBApplication::UI|SDB.UI]] is an [[SDBUI]] object. This object provides access to specific aspects of the MediaMonkey UI, such as the menus, options dialog, property sheets, etc. | |||
==== Progress ==== | ==== Progress ==== | ||
[[ISDBApplication::Progress|SDB.Progress]] is an [[SDBProgress]] object. | [[ISDBApplication::Progress|SDB.Progress]] is an [[SDBProgress]] object. This object is used to initialize, update, and terminate a progress display in the MediaMonkey main window. | ||
==== WebControl ==== | ==== WebControl ==== | ||
[[ISDBApplication::WebControl|SDB.WebControl]] is | [[ISDBApplication::WebControl|SDB.WebControl]] returns an Object corresponding to the built-in Web Browser panel, which is displayed when the Web node of the MainTree is selected. | ||
=== Library properties === | === Library properties === | ||
Line 55: | Line 57: | ||
=== Utilities and Tools === | === Utilities and Tools === | ||
==== CommonDialog ==== | ==== CommonDialog ==== | ||
Line 64: | Line 64: | ||
[[ISDBApplication::Tools|SDB.Tools]] is an [[SDBTools]] object. It is a utility object which contains a number of methods and a few properties of use to scripts. | [[ISDBApplication::Tools|SDB.Tools]] is an [[SDBTools]] object. It is a utility object which contains a number of methods and a few properties of use to scripts. | ||
SDB also has a few properties of its own which are similar to those in Tools: | SDB also has a few properties of its own which are similar to those in Tools: | ||
* PlaylistByTitle | * [[ISDBApplication::PlaylistByTitle|SDB.PlaylistByTitle]] | ||
* PlaylistByID | * [[ISDBApplication::PlaylistByID|SDB.PlaylistByID]] | ||
* [[ISDBApplication::NewSongData|SDB.NewSongData]] | |||
* [[ISDBApplication::NewSongList|SDB.NewSongList]] | |||
* [[ISDBApplication::NewStringList|SDB.NewStringList]] | |||
==== Downloader ==== | |||
[[ISDBApplication::Downloader|SDB.Downloader]] is an [[SDBDownloader]] object. | |||
==== Device ==== | ==== Device ==== | ||
Line 77: | Line 84: | ||
=== Settable properties === | === Settable properties === | ||
CursorType | * [[ISDBApplication::CursorType|SDB.CursorType]] | ||
* [[ISDBApplication::ShutdownAfterDisconnect|SDB.ShutdownAfterDisconnect]] | |||
* [[ISDBApplication::ComServerUIActive|SDB.ComServerUIActive]] | |||
* [[ISDBApplication::Objects|SDB.Objects]] | |||
=== Readable properties === | |||
==== Operating Status ==== | |||
* [[ISDBApplication::IsRunning|SDB.IsRunning]] | |||
* [[ISDBApplication::InPartyMode|SDB.InPartyMode]] | |||
* [[ISDBApplication::RunningAsService|SDB.RunningAsService]] | |||
* [[ISDBApplication::UseAlbumGain|SDB.UseAlbumGain]] | |||
==== Paths ==== | |||
These properties allow querying of useful paths in the MediaMonkey environment: | |||
* [[ISDBApplication::ApplicationPath|SDB.ApplicationPath]] | |||
* [[ISDBApplication::EqualizerPath|SDB.EqualizerPath]] | |||
* [[ISDBApplication::IconsPath|SDB.IconsPath]] | |||
* [[ISDBApplication::PluginsPath|SDB.PluginsPath]] | |||
* [[ISDBApplication::LocalPluginsPath|SDB.LocalPluginsPath]] | |||
* [[ISDBApplication::ScriptsPath|SDB.ScriptsPath]] | |||
* [[ISDBApplication::GlobalScriptsPath|SDB.GlobalScriptsPath]] | |||
ApplicationPath | * [[ISDBApplication::LocalScriptsPath|SDB.LocalScriptsPath]] | ||
EqualizerPath | * [[ISDBApplication::SkinsPath|SDB.SkinsPath]] | ||
IconsPath | * [[ISDBApplication::MyMusicPath|SDB.MyMusicPath]] | ||
PluginsPath | * [[ISDBApplication::TemporaryFolder|SDB.TemporaryFolder]] | ||
ScriptsPath | * [[ISDBApplication::CurrentAddonInstallRoot|SDB.CurrentAddonInstallRoot]] | ||
SkinsPath | * [[ISDBApplication::ScriptsIniFile|SDB.ScriptsIniFile]] | ||
MyMusicPath | |||
TemporaryFolder | |||
CurrentAddonInstallRoot | |||
ScriptsIniFile | |||
==== Version | ==== Version information ==== | ||
VersionHi | These properties allow querying of the MediaMonkey version. | ||
VersionLo | * [[ISDBApplication::VersionHi|SDB.VersionHi]]: integer, e.g. '''4''' | ||
VersionRelease | * [[ISDBApplication::VersionLo|SDB.VersionLo]]: integer, e.g. '''1''' | ||
VersionBuild | * [[ISDBApplication::VersionRelease|SDB.VersionRelease]]: integer, e.g. '''3''' | ||
VersionString | * [[ISDBApplication::VersionBuild|SDB.VersionBuild]]: integer, e.g. '''1703''' | ||
* [[ISDBApplication::VersionString|SDB.VersionString]]: string, e.g. '''"4.1.3"''' | |||
=== Methods === | === Methods === | ||
ProcessMessages | * [[ISDBApplication::ProcessMessages|SDB.ProcessMessages]] | ||
CreateTimer | * [[ISDBApplication::CreateTimer|SDB.CreateTimer]] | ||
MessageBox | * [[ISDBApplication::MessageBox|SDB.MessageBox]] | ||
SelectFolder | * [[ISDBApplication::SelectFolder|SDB.SelectFolder]] | ||
Format | * [[ISDBApplication::Format|SDB.Format]] | ||
toASCII | * [[ISDBApplication::toASCII|SDB.toASCII]] | ||
IsKnownFiletype | * [[ISDBApplication::IsKnownFiletype|SDB.IsKnownFiletype]] | ||
Localize | * [[ISDBApplication::Localize|SDB.Localize]] | ||
LocalizedFormat | * [[ISDBApplication::LocalizedFormat|SDB.LocalizedFormat]] | ||
LocalizeGen | * [[ISDBApplication::LocalizeGen|SDB.LocalizeGen]] | ||
RefreshScriptItems | * [[ISDBApplication::RefreshScriptItems|SDB.RefreshScriptItems]] | ||
RegisterIcon | * [[ISDBApplication::RegisterIcon|SDB.RegisterIcon]] | ||
RegisterIconHandle | * [[ISDBApplication::RegisterIconHandle|SDB.RegisterIconHandle]] |
Latest revision as of 21:12, 7 September 2014
MediaMonkey Automation Objects
MediaMonkey's script environment provides two top-level objects accessible from a script running within MediaMonkey: SDB and Script. In an external program (written in a language such as C#) or script (such as in Python), these objects can be accessed by instantiating COM instances.
When a program instantiates a COM instance, the returned object connects directly to the running instance of MediaMonkey. MediaMonkey will be started at the time of instantiation if it is not already running.
Script
Script is a top-level SongsDB.SDBScriptControl object.
SDB
SDB is a SongsDB.SDBApplication object. It is the main point of access for MediaMonkey's internals. It has numerous properties which yield objects modeling various components of the program; other properties which yield strings, integers, or flags; and some methods that perform various actions.
SDB is an "evented" object, which means scripts can register functions (callbacks) that will be called when certain events occur within MediaMonkey. This allows the script to respond without having to poll MediaMonkey repeatedly for conditions.
The members of SDB are as follows, arranged by category:
Player
SDB.Player is an SDBPlayer object. It allows access to the player functions: starting, stopping, pausing, skipping and so forth. The player also generates events, which are part of the SDB's event notifications. Only the simplest scripts to control playback will not need to use events.
Main Window properties
MainTracksWindow
SDB.MainTracksWindow is an SDBTracksWindow object. It gives access to the track entries shown in MediaMonkey's main window.
MainTree
SDB.MainTree is an SDBTree object. It gives access to the nodes in the tree in MediaMonkey's main window.
Related to MainTree are these properties:
- SDB.VisibleCollectionsCount is the number of collections visible in the Main Tree
- SDB.VisibleCollectionID accepts an index and returns the ID of the collection at that item.
So if VisibleCollectionsCount returns 3, VisibleCollectionID(0) will return the ID of the first visible collection, VisibleCollectionID(2) will return the ID of the third (and last) visible collection; given an index outside that range, VisibleCollectionID will return an error indicator. The returned ID can be used to find the collection object from the list of collections found in SDB.Collections.
Songlists
Related to MainTracksWindow and MainTree are these properties, each of which yields an SDBSongList that can be queried for Count and individual Items, and other information.
- SDB.AllVisibleSongList is the list of songs visible in the MainTracksWindow
- SDB.SelectedSongList is the list of selected songs in either the MainTracksWindow or the Now Playing pane, depending on which has focus.
- SDB.CurrentSongList is the same as either AllVisibleSongList (if the focus is on the MainTree) or SelectedSongList (if the focus is on the MainTracksWindow or the Now Playing pane).
UI
SDB.UI is an SDBUI object. This object provides access to specific aspects of the MediaMonkey UI, such as the menus, options dialog, property sheets, etc.
Progress
SDB.Progress is an SDBProgress object. This object is used to initialize, update, and terminate a progress display in the MediaMonkey main window.
WebControl
SDB.WebControl returns an Object corresponding to the built-in Web Browser panel, which is displayed when the Web node of the MainTree is selected.
Library properties
Database
SDB.Database is an SDBDatabase object.
Collections
SDB.Collections is an SDBCollections object, which is just a list of the defined collections. This object has only two members: Count and Item(). Item() returns an SDBCollection object.
Note that the ID of a collection is not its index; given a collection ID (e.g., from SDB.VisibleCollectionID), it is necessary to search this list for a collection with a matching ID to get the desired Collection object.
Utilities and Tools
CommonDialog
SDB.CommonDialog is an SDBCommonDialog object.
Tools
SDB.Tools is an SDBTools object. It is a utility object which contains a number of methods and a few properties of use to scripts. SDB also has a few properties of its own which are similar to those in Tools:
Downloader
SDB.Downloader is an SDBDownloader object.
Device
SDB.Device is an SDBDevice object. It is used to access "portable devices" in the system. It does not correspond to a single device itself, but can be queried for individual devices which can then be operated on.
IniFile
SDB.IniFile is an SDBIniFile object.
Registry
SDB.Registry is an SDBRegistry object.
Settable properties
Readable properties
Operating Status
Paths
These properties allow querying of useful paths in the MediaMonkey environment:
- SDB.ApplicationPath
- SDB.EqualizerPath
- SDB.IconsPath
- SDB.PluginsPath
- SDB.LocalPluginsPath
- SDB.ScriptsPath
- SDB.GlobalScriptsPath
- SDB.LocalScriptsPath
- SDB.SkinsPath
- SDB.MyMusicPath
- SDB.TemporaryFolder
- SDB.CurrentAddonInstallRoot
- SDB.ScriptsIniFile
Version information
These properties allow querying of the MediaMonkey version.
- SDB.VersionHi: integer, e.g. 4
- SDB.VersionLo: integer, e.g. 1
- SDB.VersionRelease: integer, e.g. 3
- SDB.VersionBuild: integer, e.g. 1703
- SDB.VersionString: string, e.g. "4.1.3"