MediaMonkey Automation Categorized

From MediaMonkey Wiki
Jump to navigation Jump to search

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.