MediaMonkey Automation Categorized: Difference between revisions

From MediaMonkey Wiki
Jump to navigation Jump to search
Line 1: Line 1:
= MediaMonkey Automation Objects =
= MediaMonkey Automation Objects =


MediaMonkey's scripts provide two top-level objects that are accessible from a script running within MediaMonkey: <code>SDB</code> and <code>Script</code>. In an external program (such as C#) or script (such as Python), these objects can be accessed by instantiating COM instances of the type shown.
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.


== SDB ==
== SDB ==
Line 15: Line 17:
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.
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.


=== MainTracksWindow ===
=== Main Window properties ===
==== MainTracksWindow ====
[[ISDBApplication::MainTracksWindow|SDB.MainTracksWindow]] is an [[SDBTracksWindow]] object. It gives access to the track entries shown in MediaMonkey's main window.
[[ISDBApplication::MainTracksWindow|SDB.MainTracksWindow]] is an [[SDBTracksWindow]] object. It gives access to the track entries shown in MediaMonkey's main window.


=== MainTree ===
==== MainTree ====
[[ISDBApplication::MainTree|SDB.MainTree]] is an [[SDBTree]] object. It gives access to the nodes in the tree in MediaMonkey's main window.
[[ISDBApplication::MainTree|SDB.MainTree]] is an [[SDBTree]] object. It gives access to the nodes in the tree in MediaMonkey's main window.


=== Songlist properties ===
Related to MainTree are these properties:
* [[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.
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, and any other value with return an error indicator. These IDs can be used to access the collection object from the list of collections found in SDB.Collections.
 
==== Songlist properties ====
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 27: Line 35:
* [[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).


=== [[ISDBApplication::UI|UI]] is an [[SDBUI]] object ===
=== Library properties ===
=== [[ISDBApplication::Tools|Tools]] is an [[SDBTools]] object ===
==== Database ====
SDB.Tools is a utility object which contains a number of methods and a few properties of use to scripts.
[[ISDBApplication::UI|UI]] is an [[SDBUI]] object
 
=== Utilities and Tools ===
==== UI ====
[[ISDBApplication::UI|SDB.UI]] is an [[SDBUI]] object
 
==== CommonDialog ====
==== Progress ====
 
==== WebControl ====
==== Downloader ====
 
==== Tools ====
[[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
* PlaylistByTitle
* PlaylistByID
* PlaylistByID


=== [[ISDBApplication::Device|Device]] is an [[SDBDevice]] object ===
 
SDB.Device is the object 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.
==== Device ====
[[ISDBApplication::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.




=== System Control ===
==== IniFile ====
IniFile
==== Registry ====
Registry
Database


=== Settable properties ===
CursorType
CursorType


Line 51: Line 72:




=== Status properties ===
=== Readable properties ===
==== Status properties ====
IsRunning
IsRunning
InPartyMode
InPartyMode
RunningAsService
RunningAsService


=== Path properties ===
==== Path properties ====
ApplicationPath
ApplicationPath
EqualizerPath
EqualizerPath
Line 68: Line 90:
ScriptsIniFile
ScriptsIniFile


=== Version properties ===
==== Version properties ====
VersionHi
VersionHi
VersionLo
VersionLo
Line 75: Line 97:
VersionString
VersionString


== '''Script''' is a '''[[SDBScriptControl|SongsDB.SDBScriptControl]]''' object ==
== Script ==
Script is a top-level [[SDBScriptControl|SongsDB.SDBScriptControl]] object.

Revision as of 20:08, 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.

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:

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:

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, and any other value with return an error indicator. These IDs can be used to access the collection object from the list of collections found in SDB.Collections.

Songlist properties

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).

Library properties

Database

UI is an SDBUI object

Utilities and Tools

UI

SDB.UI is an SDBUI object

CommonDialog

Progress

WebControl

Downloader

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:

  • PlaylistByTitle
  • PlaylistByID


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

Registry

Settable properties

CursorType

ShutdownAfterDisconnect ComServerUIActive

Objects


Readable properties

Status properties

IsRunning InPartyMode RunningAsService

Path properties

ApplicationPath EqualizerPath IconsPath PluginsPath ScriptsPath SkinsPath MyMusicPath TemporaryFolder CurrentAddonInstallRoot ScriptsIniFile

Version properties

VersionHi VersionLo VersionRelease VersionBuild VersionString

Script

Script is a top-level SongsDB.SDBScriptControl object.