Media Center Automation: Difference between revisions
No edit summary |
No edit summary |
||
Line 898: | Line 898: | ||
==MJFieldAutomation - interface for working with an individual database field== |
==MJFieldAutomation - interface for working with an individual database field== |
||
===Functions=== |
===Functions=== |
||
string GetName(boolean bFormatted) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
==MJZonesAutomation - interface for working with multi-zone playback system== |
==MJZonesAutomation - interface for working with multi-zone playback system== |
||
===Functions=== |
===Functions=== |
||
number GetNumberZones() |
|||
⚫ | |||
⚫ | |||
number GetActiveZone() |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
number GetActiveZone() |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
Parameters: |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
==MJZoneAutomation - interface for working with a single playback zone (requires MC 11.0.20 or later)== |
==MJZoneAutomation - interface for working with a single playback zone (requires MC 11.0.20 or later)== |
Revision as of 23:12, 22 January 2007
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.
MJAutomation - core object... provides access to all other objects
Functions
MJPlaybackAutomation * GetPlayback() Description: gets a MJPlaybackAutomation interface (see below) Return Value: MJPlaybackAutomation interface
MJFilesAutomation * Search(string strSearch) Description: gets a MJFilesAutomation interface (see below) for the files matching the specified search Parameters:
- strSearch: the search string to use... can be any search accepted by Media Center
Return Value: MJFilesAutomation interface
MJCurPlaylistAutomation * GetCurPlaylist() Description: gets a MJCurPlaylistAutomation interface (see below) Return Value: MJCurPlaylistAutomation interface
MJPlaylistsAutomation * GetPlaylists() Description: gets a MJPlaylistsAutomation interface (see below) for all of the existing playlists Return Value: MJPlaylistsAutomation interface
MJSchemeAutomation * GetViewScheme(string strPath) Description: gets a MJSchemeAutomation interface (see below) for the given library path Parameters:
- strPath: the path to the view scheme delimited by backslashes. (i.e. "Media Library\Artist/Album\Metallica")
Return Value: MJSchemeAutomation interface
MJMixerAutomation * GetMJMixer() Description: gets a MJMixerAutomation interface (see below) Return Value: MJMixerAutomationinterface
MJVersionAutomation * GetVersion() Description: gets a MJVersionAutomation interface (see below). Return Value: MJVersionAutomation interface
MJFileAutomation * GetFile(string strFilename) Description: gets a MJFileAutomation interface (see below) for the given file. Parameters:
- strFilename: the path to the file.
Return Value: MJFileAutomation interface
void EnableSkinning(number bEnable) Description: Enables and disabled Media Center skinning. Useful in case when MC could not skin plug-in window correctly. Parameters:
- bEnable: TRUE - enable skinning, FALSE - disable.
void SkinWindow(number nWindowHandle, boolean bSkin) Description: Skins or removes skinning from the specified window. Parameters:
- nWindowHandle: handle to the specific window (convert HWND to long)
- bSkin: TRUE - enables skinning of the specified window, FALSE - disables skinning for the window.
MJInternetAutomation * GetInternet() Description: gets a MJInternetAutomation interface (see below). Return Value: MJInternetAutomation interface
number GetSkinInfo(string strItem, string strAttribute) Description: Retrieves information about current skin. Parameters:
- strItem: item name
- strAttribute: attribute name.
Return Value: value of the specified skin item. -1 if the info was not found. Example1: GetSkinInfo("Tree", "TextColor"); Example2: GetSkinInfo("StatusBar", "BackColor");
number IsPurchased() Description: Retrieves registration information Return Value: if Media Center is purchased return value will be -1. The value will be equal to 0 if trial period expired but the program was not purchased. If the value > 0 the function returned number of days left in the trial period.
MJViewItemAutomation * GetViewItem(string strPath) Description: gets a MJViewItemAutomation interface (see below) for the given file. Parameters:
- strPath: the path to a view item.
Return Value: MJViewItemAutomation interface
number GetWindowHandle() Description: Retrieves handle to Media Center's main window Return Value: HWND to main application window.
MJFileAutomation * GetFileByKey(number nKey) Description: gets a MJFileAutomation interface (see below) for the file denoted by the key. Parameters:
- nKey: the key of a file.
Return Value: MJFileAutomation interface
void ShowProgram(number bShow) Description: Changes visibility state of the program. Parameters:
- bShow: 1 - show the app, 0 - hide.
MJFileAutomation * ImportFile(string strFilename) Description: imports a new file into Media Center Parameters:
- strFilename: the path to the file.
Return Value: MJFileAutomation interface
void SetGlobalFocusedWindow(number hwndNew, number bInvalidateNew) Description: Sets the focus to the new window. Parameters:
- hwndNew: the handle of the window
- bInvalidateNew: Invalidate the new window so it knows the focus changed
MJFieldsAutomation * GetFields() Description: gets a MJFieldsAutomation interface (see below) Return Value: MJFieldsAutomation interface
MJZonesAutomation * GetZones() Description: gets a MJZonesAutomation interface (see below) Return Value: MJZonesAutomation interface
MJFilesAutomation * CreateFiles() Description: gets a MJFilesAutomation interface (see below) with no files Return Value: MJFilesAutomation interface
MJTaskAutomation * GetTask(string strTask) Description: gets a MJTaskAutomation interface (see below). Parameters:
- strTask: the name of the task.
Return Value: MJTaskAutomation interface
MJServicesAutomation * GetServices() Description: gets a MJServicesAutomation interface (see below). Return Value: MJServicesAutomation interface
void ReportEvent(string Name, string Data) Description: Reports an event. Parameters:
- Name: the name of the event
- Data: extra data.
IMJPlaylistAutomation *GetPlaylistByID(number nID) Description: Gets a playlist Parameters:
- nID: the ID of the playlist
Return Value: MJPlaylistAutomation interface (see below)
void RegisterWindowWithRouter(number hwndRegister, number nRegisterState) Description: Register or unregister a window with the router Parameters:
- hwndRegister: Handle of the window to register
- nRegisterState: TRUE for register, FALSE for unregister
IMJCDDVDAutomation *GetCDDVD() Description: Gets a CD/DVD Automation interface Return Value: MJCDDVDAutomation Interface
Properties
number IVersion() (read only) Description: retrieves version of MC Automation interface. (2 is current version)
MJPlaybackAutomation - controls playback and provides information about the currently playing track
Functions
void Pause() Description: toggles the pause state
void Stop() Description: stops playback
void Next() Description: plays the next track in "Playing Now"
void Previous() Description: plays the previous track in "Playing Now"
void FastForward() Description: advances the position of the playing track (amount depends on file type)
void Rewind() Description: rewinds the position of the playing track (amount depends on file type)
boolean IsBuffering() Description: queries to see if Media Center is buffering Return Value: TRUE if buffering, FALSE if not buffering
void Play() Description: begins playback of the current track in "Playing Now"
boolean IsVideo() Description: queries to see if Media Center has video Return Value: TRUE if MJ has video, FALSE if not.
Properties
MJPlaybackStates State() (read only) Description: the current playback state (PLAYSTATE_STOPPED - Stopped, PLAYSTATE_PAUSED - Paused, PLAYSTATE_PLAYING - Playing, PLAYSTATE_WAITING - Waiting)
number Bitrate() (read only) Description: the bitrate of the currently playing track (i.e. 128 kbps)
number Position() (read / write) Description: the position in the currently playing track (i.e. 111 seconds)
number Duration() (read only) Description: the duration of the currently playing track (i.e. 257 seconds)
number Channels() (read only) Description: the number of channels in the currently playing track (i.e. 2 channels (stereo))
number Samplerate() (read only) Description: the sample rate of the currently playing track (i.e. 44100 Hz)
number Bitspersample() (read only) Description: the bits per sample of the currently playing track (i.e. 16 bits per sample)
MJFilesAutomation - represents a collection of files
Functions
number GetNumberFiles() Description: returns the number of files contained in the collection Return Value: number of files
void Sort() Description: sorts the list of files using user selected sorting scheme.
MJFileAutomation * GetFile(number nFile) Description: gets the MJFileAutomation interface (see below) for the given file index Parameters:
- nFile: the index of the file to retrieve (0 to GetNumberFiles() - 1)
Return Value: MJFileAutomation interface
void Play() Description: plays the list of files
void PlayOrShow() Description: decides whether to play or show the list of files. If the list contains only image files then show command will be used, otherwise this function will use play command.
boolean AlbumGroup(boolean bSort, boolean bGroupIfOneAlbum) Description: groups the list of files by album. If this function is used, the collection of files will contain one file from each album, which can be expanded using the MJFileAutomation::GetAlbumFiles(...) call. Parameters:
- bSort: sort the list of files after grouping
- bGroupIfOneAlbum: instructs the function whether to group by album if the list contains only one album.
Return Value: if grouping by album is possible, the function will return true, otherwise false.
void AddFile(string strFilename) Description: Add the file to the collection Parameters:
- strFilename: the name of the file to add
void AddFileByKey(number nKey) Description: Add the file to the collection Parameters:
- nKey: the key of the file to add
boolean RemoveFile(number nIndex) Description: Remove the file from the collection Parameters:
- nIndex: the number of the file to remove
Return Value: true only if the file was removed
void RemoveAll() Description: Remove all files from the collection
string Analyze(string strWhat) Description: Analyze the files for information, currently size or duration is supported Parameters:
- strWhat: size or duration
Return Value: the size or duration, or "-1" if it couldn't be computed
void MoveToTop(number nIndex) Description: moves the specified file to the top position Parameters:
- nIndex: the number of the file to move
void Shuffle() Description: shuffles the order of the collection
void Set(number nIndex, string strField, string strValue) Description: Changes the field of the specified file to a new value Parameters:
- nIndex: the position of the file in the collection
- strField: the name of the field to change
- strValue: the new value
number AddNewFile()
- Description: Adds a new file to the end of the collection
- Return Value: non-zero only if a new file was added
number AddExistingFile(IDispatch *pdispFiles, long nIndex, nInsertIndex) Description: Add a file from another MJFilesAutomation object Parameters:
- pdispFiles: the IDispatch of the other MJFilesAutomation
- nIndex: the position of the file in the other object
- nInsertIndex: the position to insert at
Return Value: The position it was inserted at, or -1 if unable to insert
string Get(number nIndex, string strField) Description: Get the value of a field for the specified file Parameters:
- nIndex: the position of the file in the collection
- strField: the name of the field
Return Value: The value of the field
number Save(string strFilename, string strType, number nFlags) Description: Save the files as a playlist, either m3u or mpl format Parameters:
- strFilename: The name of the playlist file
- strType: "m3u" or "mpl"
- nFlags: For m3u, if nFlags & 0x1, then use relative paths
Return Value: Nonzero on success, zero on failure
void Filter(string strSearchString) Description: Remove all files in the collection not meeting the criteria in strSearchString Parameters:
- strSearchString: a Media Center search
void AddFileOverwriteExistingInfo(string strFilename) Description: Add the file to the collection, overwriting the old information if it exists. Parameters:
- strFilename: the name of the file
Properties
number Position() (read / write) Description: the index of the selected file. When starting playback, the selected file will get played. Other interfaces and functions may also honor the position. Note that the position will be preserved through shuffles, removes, and other MJFiles functions. (-1 means no file is selected)
MJFileAutomation - object for dealing with a single file
Functions
MJPlaylistsAutomation * GetPlaylists() Description: returns the collection of playlists that the given file is in Return Value: MJPlaylistsAutomation interface (see below)
string GetImageFile(MJImageFileFlags nImageFileFlag) Description: gets the filename of an image associated with the file Parameters:
- nImageFileFlag:
- IMAGEFILE_DISPLAY - display image (tag or database) (uses MJ logo if file doesn't have an image)
- IMAGEFILE_IN_DATABASE - database image
- IMAGEFILE_IN_FILE - tag image (stored inside of file)
- IMAGEFILE_THUMBNAIL_SMALL, IMAGEFILE_THUMBNAIL_MEDIUM, IMAGEFILE_THUMBNAIL_LARGE - small, medium, and large thumbnail images for the file
- IMAGEFILE_DISPLAY_NO_DEFAULT - like IMAGEFILE_DISPLAY except that it won't return the logo when there is no art
- IMAGEFILE_DISPLAY_NO_DEFAULT_STANDARD_JPEG - like IMAGEFILE_DISPLAY_NO_DEFAULT except that it always returns a standard (non-progressive) JPEG
Note: Do not delete the files returned by this function. Media Center will do any necessary cleanup. Also, subsequent calls may return the same filename (if a temp file is being used) so you must load / cache the image instead of caching the filenames. Return Value: a filename of the image file
string SetImageFile(string strImageFile, MJImageFileFlags nImageFileFlag) Description: sets the image for the file Parameters:
- strImageFile: filename of the image
- nImageFileFlag: IMAGEFILE_IN_DATABASE - database image, IMAGEFILE_IN_FILE - tag image (stored inside of file)
Return Value: 0 on failure, non-zero on success
string GetFormattedFileSize() Description: gets the display friendly file size Return Value: a string representing the file size (i.e. "23.434 MB")
string GetFormattedFileDate() Description: gets the display friendly file date / time Return Value: a string representing the file date / time (i.e. "2/30/2002 8:01 PM")
string GetFormattedDuration() Description: gets the display friendly duration Return Value: a string representing the duration (i.e. "3:04")
string GetFormattedLastPlayed() Description: gets the display friendly last played date / time Return Value: a string representing the duration (i.e. "2/30/2002 8:01 PM")
string GetAvailableFilename() Description: returns the filename in the format that's available to the system, so that files on a removable device get returned, for example, as "D:\1.mp3" instead of "(0xF43EA231):\1.mp3" Return Value: a string representing the filename
boolean SaveToTag() Description: Forces Media Center to save the file information to the tag. Return Value: 0 - failed, 1 - success.
string Get(string strField, boolean bFormatted) Description: generic function to get value for the specified field. Parameters:
- strField: name of the field (e.g. Artist, Album...)
- bFormatted: determines whether the return value should beformated.
Return Value: value of the field
boolean Set(string strField, string strValue) Description: generic function to set value for the specified field. Parameters:
- strField: name of the field (e.g. Artist, Album...)
- strValue: new value of the field
Return Value: 0 - failed, 1 - success.
MJFilesAutomation * GetAlbumFiles() Description: retrieves the list of files which belong to the same album (use to expand after an album group) Return Value: MJFilesAutomation interface
long GetKey() Description: Gets the key of the file Return Value: the key
boolean DeleteFile(long hwndParent) Description: Deletes the file (with confirmation) Parameters:
- hwndParent: The handle of the parent window or null
Return Value: nonzero on success, zero on failure
boolean RotateImage(long nDegrees) Description: If the file is a JPEG, rotate the image Parameters:
- nDegrees: How much to rotate
Return Value: TRUE
string GetFilledTemplate(string strTemplate) Description: Evaluates an expresion for the file and returns the result Parameters:
- strTemplate: the expression
Return Value: the result
boolean SilentDeleteFile() Description: Deletes the file (no confirmation) Return Value: nonzero on success, zero on failure
void UpdatePlaybackStats(long nPlays) Description: Increases the file playcount by nPlays and sets the last played time to now Parameters:
- nPlays: number of times the file was played
boolean SaveInfoToExternalFile(string strFilename) Description: Save the database information (cover art and fields) for the file to an external file Parameters:
- strFilename: the name of the external file
Return Value: TRUE
boolean UpdateFromFile(boolean bForce, boolean bOnlyNewFields) Description: Updates the fields from the file Parameters:
- bForce: if true, force the update, otherwise only update if the file has changed
- bOnlyNewFields: Only change fields that are new
Return Value: TRUE only if the file was updated
void UpdateDBLocation(long nAppendDBLocations, long nRemoveDBLocations) Description: Select which portions of the database the file appears in Parameters:
- nAppendDBLocations: Which portions to add the file to. Value is a bitwise OR of
- DB_LOCATION_INVALID
- DB_LOCATION_MAIN
- DB_LOCATION_PLAYING_NOW
- DB_LOCATION_CD
- DB_LOCATION_EXPLORER
- DB_LOCATION_UNASSIGNED
- DB_LOCATION
- DB_LOCATION_FILE_TRANSFER
- DB_LOCATION_HANDHELD
- DB_LOCATION_GROUPING
- DB_LOCATION_REMOVED
- DB_LOCATION_DOWNLOADING
- DB_LOCATION_PODCAST_FEED
- nRemoveDBLocations: Which portions to remove the file from, same value as nAppendDBLocations
boolean SetNoDirty(string strField, string strValue) Description: Change a file's field without marking it as dirty Parameters:
- strField: the field name
- strValue: the field value
Return Value: nonzero on success, zero on failure
Properties
string Filename() (read / write) Description: the filename (i.e. "c:\Music\Good Song.mp3")
string Artist() (read / write) Description: the artist (i.e. "Metallica")
string Album() (read / write) Description: the album (i.e. "ReLoad")
string Name() (read / write) Description: the name of the track (i.e. "Unforgiven II")
number Filesize() (read / write) Description: the filesize in bytes
number Duration() (read / write) Description: the file duration in seconds
string Genre() (read / write) Description: the genre (i.e. "Rock")
number Year() (read / write) Description: the year (i.e. 1997)
string Comment() (read / write) Description: the comment
number Bitrate() (read / write) Description: the bitrate (i.e. 128 kbps)
number Tracknumber() (read / write) Description: the track number (i.e. 4)
number Filedate() (read / write) Description: the file's date (seconds past 1970)
string Custom1() (read / write) Description: the MJ-specific "Custom1" field
string Custom2() (read / write) Description: the MJ-specific "Custom2" field
string Custom3() (read / write) Description: the MJ-specific "Custom3" field
number PlayCounter() (read / write) Description: the number of times the track has been played in Media Center
number LastPlayed() (read / write) Description: the date the file was last played in Media Center (seconds past 1970)
number Rating() (read / write) Description: the rating (MJ-specific) (note: 0 = ?, otherwise 1-5)
string Filetype() (read / write) Description: the extension of the file (used by MJ to choose playback plugins, etc.) (i.e. "mp3")
string Lyrics() (read / write) Description: the lyrics
string Notes() (read / write) Description: the notes
string AlbumArtist() (read / write) Description: the album artist
MJCurPlaylistAutomation - interface for working with "Playing Now" (the current playlist)
Functions
number GetNumberFiles() Description: returns the number of files in "Playing Now" Return Value: number of files
MJFileAutomation * GetFile(number nFile) Description: gets the MJFileAutomation interface (see below) for the given file index Parameters: Return Value: MJFileAutomation interface
void RemoveAllFiles() Description: removes all of the files from "Playing Now" (stops playback)
boolean RemoveFile(number nFile) Description: removes a specific file from "Playing Now" Parameters:
- nFile: the index of the file to retrieve (0 to GetNumberFiles() - 1)
Return Value: 0 on failure, non-zero on success
boolean AddFile(string strFilename, number nPosition) Description: adds a file to "Playing Now" Parameters:
- strFilename: the filename of the file to add
- nFile: the new index of the file
Return Value: 0 on failure, non-zero on success
boolean MoveFile(number nFileOld, number nFileNew) Description: moves a file to a new location in "Playing Now" Parameters:
- nFileOld: the index of the file to move
- nFileNew: the index to move the file to
Return Value: 0 on failure, non-zero on success
boolean ReShuffleFiles() Description: shuffles "Playing Now" so it's in a random order Return Value: 0 on failure, non-zero on success
number GetNextFile() Description: gets the index of the file to play on "Next" Return Value: index of file
boolean GetPreviousFile() Description: gets the index of the file to play on "Previous" Return Value: index of file
boolean GetCanPlayNext() Description: Determine if there is another file to play after the currently playing file Return Value: true only if there is one
Properties
number Position() (read / write) Description: the index of the current track
number Shuffle() (read / write) Description: the shuffle state (0 = off, 1 = on)
number Continuous() (read / write) Description: the continuous state (0 = off, 1 = on)
MJMixerAutomation - provides volume, balance, and mute control
Functions
void SetEQBand(number nBand, number nValue) Description: sets the value of an equalizer band Parameters:
- nBand: the equalizer band (0 = preamp, 1 - 10 = eq bands)
- nValue: the new band value (-100 to 100 where -100 is full cut, 0 is no gain, and 100 is full gain)
number GetEQBand(number nBand) Description: gets the value of an equalizer band Parameters:
- nBand: the equalizer band (0 = preamp, 1 - 10 = eq bands)
Return Value: value of the specified band (-100 to 100 where -100 is full cut, 0 is no gain, and 100 is full gain)
void UpdateEQSettings(number bUpdatePlayer, number bUpdateMiniMe) Description: updates the internal settings to reflect outside changes (made in DSP Studio, etc.) -- not necessary in most cases Parameters:
- bUpdatePlayer: whether to update the player window (0 = no, 1 = yes)
- bUpdateMiniMe: whether to update the mini-me window (0 = no, 1 = yes)
void ShowDSP() Description: Activate the DSP
Properties
number Volume() (read / write) Description: the volume (0 = no volume, 100 = full volume)
number Balance() (read / write) Description: the balance between left and right (-100 = all left, 0 = centered, 100 = all right)
boolean Mute() (read / write) Description: the mute state (0 = not muted, 1 = muted)
boolean EQOn() (read / write) Description: whether the equalizer is on or off (0 = off, 1 = on)
MJPlaylistsAutomation - represents a collection of playlists
Functions
number GetNumberPlaylists() Description: returns the number of playlists contained in the collection Return Value: number of playlists
MJPlaylistAutomation * GetPlaylist(number nPlaylist) Description: gets the MJPlaylistAutomation interface (see below) for the given playlist index Parameters:
- nPlaylist: the index of the playlist to retrieve (0 to GetNumberPlaylists() - 1). To retrieve Top Hits and Recently Imported playlists use index -1 and -2 respectively.
Return Value: MJPlaylistAutomation interface
MJPlaylistAutomation * CreatePlaylist(string PlaylistPath, string PlaylistName) Description: creates new playlist at the specified location Parameters:
- PlaylistPath: location of the playlist. If empty, the playlist will be created in the root of the playlist tree.
- PlaylistName: name of the new playlist
Return Value: MJPlaylistAutomation interface
boolean DeletePlaylist(string PlaylistPath, string PlaylistName) Description: deletes existing playlist Parameters:
- PlaylistPath: location of theplaylist.
- PlaylistName: name of the new playlist
Return Value: true - if success, otherwise false.
IMJPlaylistAutomation *CreateServicelist(string Path, string Name, string Service, string ServiceID, string ServiceData) Description: Finds or creates the playlist associated with a service Parameters:
- Path: Not Used
- Name: The name of the playlist
- Service: The name of the service
- ServiceID: The ID of the service
- ServiceData: Service-specific data
Return Value: the MJPlaylistAutomation interface
MJPlaylistAutomation - interface for working with a single playlist
Functions
MJFilesAutomation * GetFiles() Description: gets the collection of files in the playlist Return Value: MJFilesAutomation interface
boolean AddFile(string strFilename, number nLocation) Description: adds new file to the playlist Parameters:
- strFilename: the filename of the file to add
- nLocation: position of the file in the playlist. If position -1, the file will be added to the end of the playlist.
Return Value: 0 on failure, non-zero on success
boolean RemoveFile(string strFilename) Description: removes existing file from the playlist Parameters:
- strFilename: the filename of the file to delete
Return Value: 0 on failure, non-zero on success
long GetID() Description: returns the ID associated with a playlist Return Value: the ID
string Get(string bstrProperty) Description: lookup a property associated with a playlist Parameters:
- bstrProperty: the name of the property
Return Value: the value of the property for this playlist
void Set(string strProperty, string bstrValue) Description: change the value of a property for this playlist Parameters:
- strProperty: the property name
- bstrValue: The new value
boolean SaveAsRSS(string strFilename, string strURLPrefix, string strUser, string strEmail) Description: 11.1.134 or higher, saves the playlist as an RSS (PodCast/PerbCast) file Parameters:
- strFilename: the filename of the RSS file
- strURLPrefix: The URL prefix which will be concatenated with the keys of the playlist files to form the URL for accessing them
- strUser: the name of the PerbCast creator
- strEmail: the e-mail address of the PerbCast creator
Return Value: 0 on failure, non-zero on success
Properties
string Name() (read / write) Description: the name of the playlist (i.e. "My Playlist")
string Path() (read / write) Description: the path of the playlist, delimited by backslashes (note: does not contain the name) (i.e. "Mixes\\New Playlist Group")
MJSchemeAutomation - interface for working with Media Library
Functions
string GetName() Description: gets the name of the scheme item (i.e. "Classic Rock", "Artist\Album", etc.) Return Value: a string containing the name of the scheme item
number GetNumberSchemes() Description: gets the number of children schemes Return Value: number of children schemes
MJSchemeAutomation * GetScheme(number nScheme) Description: gets the specified child scheme Parameters:
- nScheme: the index of the child scheme to retrieve (0 to GetNumberSchemes() - 1)
Return Value: a MJSchemeAutomation interface for the specified child scheme
MJFilesAutomation * GetFiles() Description: gets the collection of files in the scheme Return Value: MJFilesAutomation interface of files
string GetSchemeName(number nScheme) Description: gets the name of the specified child scheme (faster than GetScheme(...)) Parameters:
- nScheme: the index of the child scheme to retrieve (0 to GetNumberSchemes() - 1)
Return Value: a string containing the name of the child scheme item
MJVersionAutomation - interface for getting Media Center version information
Properties
number Major (read only) Description: Major version of the Media Center (i.e. 9)
number Minor (read only) Description: Minor Version of the Media Center (i.e. 0)
number Build (read only) Description: Build number of the Media Center (i.e. 160)
string Version (read only) Description: string version of the Media Center (i.e. "9.0.160")
MJInternetAutomation - interface for helping in downloading files from internet
Functions
string DownloadToString(string URL) Description: Downloads web page from the specified URL to a string. (should not be used with binary data, only web pages) Parameters:
- URL: The URL from which the web page will be downloaded
Return Value: a string containing the contents of the web page.
number DownloadToFile(string URL, string FileName) Description: Downloads data from a resource identified by a URL to a local file. Parameters:
- URL: The URL from which the data will be downloaded.
- FileName: The name of the local file to receive the data.
Return Value: True if the function completed successfully, otherwise FALSE.
string DownloadToTempFile(string URL) Description: Downloads data from a resource identified by a URL to a local temp file. Parameters:
- URL: The URL from which the data will be downloaded.
Return Value: Returns the full path to the temp file.
void Cancel() Description: Cancels previously called download function. Can be used only when DownloadMode set to DOWNLOADMODE_NO_UI or DOWNLOADMODE_NO_UI_BLOCKING.
Properties
MJInetDownloadModes DownloadMode (read / write) Description: Gets or sets download mode.
- DOWNLOAD_MODE_DEFAULT - displays UI while downloading files from the Internet
- DOWNLOADMODE_NO_UI - does not display UI but processes the message loop so the Cancel function can be called from the same thread.
- DOWNLOADMODE_BLOCKING - will lock the app until the download is finished.
- DOWNLOAD_MODE_NO_AUTHENTICATION - disables authentication.
Example:
MJIA.DownloadMode = DOWNLOADMODE_NO_UI DOWNLOADMODE_BLOCKING;
MJViewItemAutomation - interface for creating / walking the Media Center tree structure
Functions
string GetName() Description: gets the name of this item Return Value: the name of the item
string GetFullName() Description: gets the full name of this item (the whole path -- backslash delimited -- i.e. Media Library\Audio\Artist/Album\Bob Dylan) Return Value: the full name of the item
MJFilesAutomation * GetFiles() Description: gets the files associated with the current item Return Value: MJFilesAutomation interface
void DoCommand(number nParam) Description: performs the command associated with the current item (play / show, playing now command, etc.) Parameters:
- nParam: for future use -- must be zero
number GetNumberChildren() Description: gets the number of child items Return Value: the number of children
string GetChildName(number nIndex) Description: gets the name of a child item Parameters:
- nIndex: the index of the child item (0 to GetNumberChildren() - 1)
Return Value: the name of the child item
MJViewItemAutomation * GetChild(number nIndex) Description: gets the MJViewItemAutomation interface (see below) for the given child index Parameters:
- nIndex: the index of the child to retrieve (0 to GetNumberChildren() - 1)
Return Value: MJViewItemAutomation interface
boolean GetChildHasChildren(number nIndex) Description: gets the name of a child item Parameters:
- nIndex: the index of the child item (0 to GetNumberChildren() - 1)
Return Value: whether the specified child has children of its own
MJViewItemAutomation * GetParent() Description: gets the parent item Return Value: MJViewItemAutomation interface
string GetThumbnailFilenames(number nThumbnailSize, number nMaxCount) Description: not implemented Parameters:
- nThumbnailSize: N/A
- nMaxCount: N/A
Return Value: N/A
boolean GetChildIsFolder(number nIndex) Description: determine if the specified child contains sub-view items Parameters:
- nIndex: the number of the child
Return Value: true only if the child contains sub-view items
boolean GetIsSearch() Description: not implemented Return Value: FALSE
MJFieldsAutomation - interface for working with database fields
Functions
number GetNumberFields() Description: gets the total number of database fields Return Value: the number of fields
IMJFieldAutomation * GetField(number nField) Description: gets the field at the given index Parameters:
- nField: the zero based index of the field
Return Value: MJFieldAutomation * to the field (see documentation below)
IMJFieldAutomation * CreateFieldSimple(string strFieldName, string strDisplayName, number bAllowEdit, long bSaveInTag) Description: Creates a new field Parameters:
- strFieldName: the internal name of the new field
- strDisplayName: the name displayed to the user
- bAllowEdit: can field be changed by user
- bSaveInTag: save the field in the tag in the content file
Return Value: the FieldAutomation interface for the new field
MJFieldAutomation - interface for working with an individual database field
Functions
string GetName(boolean bFormatted) Description: gets the name of the field Parameters:
- bFormatted: 0 = returns the unique name of the field as used in DB lookups, 1 = returns the display name of the field (not necessarily unique)
Return Value: the field name
MJZonesAutomation - interface for working with multi-zone playback system
Functions
number GetNumberZones() Description: gets the total number of playback zones Return Value: the number of playback zones
number GetActiveZone() Description: gets the index of the active zone Return Value: index of active zone
void SetActiveZone(number nIndex) Description: sets the index of the active zone.
- nIndex: the zero based index of the new zone
string GetZoneName(number nIndex) Description: gets the name of a given zone Parameters:
- nIndex: the zero based index of the new zone
Return Value: the name of the zone
MJZoneAutomation * GetZone(number nIndex) (requires MC 11.0.20 or later) Description: gets a MJZoneAutomation interface for this zone (see below) Return Value: MJZoneAutomationinterface
void SynchronizeZones(number nSource, number nDestination) Description: attempts to have the two zones play the same content at the same time Parameters:
- nSource: the master zone
- nDestination: the slave zone
MJZoneAutomation - interface for working with a single playback zone (requires MC 11.0.20 or later)
Functions
string GetName()
Description: gets the name of the zone Return Value: the name of the zone
MJPlaybackAutomation * GetPlayback()
Description: gets a MJPlayback interface for this zone (see above) Return Value: MJPlayback interface
MJCurPlaylistAutomation * GetCurPlaylist()
Description: gets a MJCurPlaylistAutomation interface for this zone (see above) Return Value: MJCurPlaylistAutomation interface
IMJMixerAutomation * GetMixer()
Description: gets a MJMixerAutomation interface for this zone Return Value: the interface
IMJFileAutomation * GetPlayingFile()
Description: get a MJFileAutomation interface for the file currently playing in this zone Return Value: the interface
MJTaskAutomation - Interface for working with a task
Functions
void Pump()
Description: pumps the task's message loop
MJServicesAutomation - interface for working with services
Functions
VARIANT_BOOL GetLicense(string bstrFilename)
Description: Get a license for a content file Parameters:
bstrFilename: the name of the content file
Return Value: true if the license was retrieved, false otherwise
IMJServiceAutomation *GetService(string bstrServiceName)
Description: Get a service by name Parameters:
bstrServiceName: the name of the service
Return Value: a MJServiceAutomation interface
MJServiceAutomation - interface for working with a single service
Functions
BOOL Process(string bstrCurrentURL, string bstrNewURL, string bstrPostData)
Description: calls a service's Process function Parameters:
bstrCurrentURL: the current URL for the service bstrNewURL: the URL to visit bstrPostData: empty or the name of a file containing POST data, the file will be deleted
Return Value: TRUE on success, FALSE otherwise
BOOL Execute(string bstrCommand, VARIANT vFileDisp, string *bstrResult)
Description: calls a service's Execute function Parameters:
bstrCommand: the command vFileDisp: MJFilesAutomation interface bstrResult: a pointer to the result
Return Value: TRUE on success, FALSE otherwise
LPDISPATCH GetWebBrowserHTMLDocument()
Description: get the currently viewed service web page Return Value: an IDispatch pointer to an IHTMLDocument2 interface
MJCDDVDAutomation - interface for working with CD/DVDs
Functions
IMJFilesAutomation *GetFiles(string strPath)
Description: Get the files on the device named Parameters:
strPath: the name of the device
Return Value: MJFilesAutomation interface