Media Center Automation
Media Center exports much of its power and functionality through COM automation interfaces. This makes it easy to create your own plug-ins for Media Center that integrate tightly with its interface. Since automation interfaces are based on COM, these plug-ins can be written in almost any language. (C++, VB, Delphi, etc.). Also, the interfaces can be accessed in Metamorphis skins and Display plug-ins (see documentation for the plug-ins). Prior to build 9.1.238, the only way to access the automation interfaces was to write a plug-in for MC because the interfaces were not accessible by objects which were outside Media Center's process. Now, any application, including VBS and Java script, can start MC or just run it to query information about MC's database.
The functions in this document are for Media Center 11.1. Most will work with earlier versions, but not all.
Initialization
Media Center can be initialized by in-proc or out-of-proc objects.
Out-of-proc initialization (C++):
#import "Media Jukebox.tlb" no_namespace, named_guids void GetMJAutomation() { IMJAutomationPtr pMJ; HRESULT hr = pMJ.GetActiveObject (L"MediaJukebox Application"); if (hr != S_OK) pMJ.CreateInstance(L"MediaJukebox Application"); }
Out-of-proc initialization (VB):
Private Sub Form_Load() ' First try to get an already running object On Error Resume Next Set myobj = GetObject(, "MediaJukebox Application") If Err.Number = 429 Then 'Then, create a new object Set myobj = CreateObject("MediaJukebox Application") End Sub
NOTE: If Media Center was created as out-of-proc object, the main window of the program will be invisible. To show the window use ShowProgram function from MJAutomation interface.
For information on how to get access to MJAutomation interface from in-proc plug-ins see plug-in SDK.
Automation Objects
- MJAutomation - core object... provides access to all other objects
- MJPlaybackAutomation - controls playback and provides information about the currently playing track
- MJFilesAutomation - represents a collection of files
- MJFileAutomation - object for dealing with a single file
- MJCurPlaylistAutomation - interface for working with "Playing Now" (the current playlist)
- MJMixerAutomation - provides volume, balance, and mute control
- MJPlaylistsAutomation - represents a collection of playlists
- MJPlaylistAutomation - interface for working with a single playlist
- MJSchemeAutomation - interface for working with Media Library
- MJVersionAutomation - interface for getting Media Center version information
- MJInternetAutomation - interface for helping in downloading files from internet
- MJViewItemAutomation - interface for creating / walking the Media Center tree structure
- MJFieldsAutomation - interface for working with database fields
- MJFieldAutomation - interface for working with an individual database field
- MJZonesAutomation - interface for working with multi-zone playback system
- MJZoneAutomation - interface for working with a single playback zone (requires MC 11.0.20 or later)
- MJTaskAutomation - Interface for working with a task
- MJServicesAutomation - interface for working with services
- MJServiceAutomation - interface for working with a single service
- MJCDDVDAutomation - interface for working with CD/DVDs