The Command Line: Difference between revisions

From wiki.jriver.com
Jump to navigation Jump to search
mNo edit summary
 
No edit summary
 
(76 intermediate revisions by 7 users not shown)
Line 1: Line 1:
Media Center can be controlled by command line parameters. ''Execute'' parameters will start Media Center if it is not already started. ''Control'' parameters are ignored if Media Center is not currently running.
Media Center and Media Jukebox can be controlled by command line parameters sent using a command launcher. The launcher is installed during installation of main application. The command launcher is version-specific, and installed in the standard system directory. The name of the command launcher for Media Center follows the (case-insensitive) form:


<code>'''MC'''''<MC version>'''''.exe'''</code>
If using Media Jukebox, the command to use is ''mjextman.exe'', for Media Center, ''MC11.exe'' or ''MC12.exe''. This document uses ''MC12.exe''


and for Media Jukebox version 12 and beyond:
==Execute Parameters==
Executing one of the following parameters starts Media Center if it's not running.


<code>'''MJ'''''<MJ version>'''''.exe'''</code>
===Playback Execute Parameters===
'''MC12.exe /Play [filename]''' plays filename. The filename parameter can point to a specific file or URL as well as to a location in the organization tree. Any item in the tree, except for CD & DVD and Handhelds can be accessed by passing a filename parameter: '''TREEPATH=location''' (e.g. '''TREEPATH=Playlists\Top Hits'''). To play items under the CD & DVD and Handhelds item use '''DEVICE=drive letter''' (e.g. '''DEVICE=G:'''). Note that filenames can be separated by pipes. (i.e. c:\1.mp3|c:\2.mp3)


and finally, prior to version 12 of Media Jukebox, the launcher is named:
'''MC12.exe [filename]''' plays filename. This command behaves the same way as /Play command.


<code>'''mjextman.exe'''</code>
'''MC12.exe /Append [filename]''' appends specified file to the currently playing list of files. Also see notes for /Play command on replacing filename parameter with TREEPATH and DEVICE commands.


Notes
MC11.exe /PlayReplace [filename] works like /Play except that it always clears Playing Now and replaces it with the new files (Media Center specific)
* The text that follows in this document will assume the usage of '''mc20.exe''', the launcher for Media Center 20. Use the appropriate command for your version of Media Center or Media Jukebox. mc27.exe, for example.


* The command launcher is installed into the system directory, typically <tt>C:\WINDOWS\system32\</tt> (it does not reside in the application directory). Because the system directory is normally included in your system's PATH variable, it is not necessary to specify the full path when invoking the command launcher.
Note: Playback execute parameters can be issued to a specific zone by adding Zone=x as one of the filenames in the pipe delimited filename list. An example would be "MC11.exe /Append c:\1.mp3|c:\2.mp3|zone=1" (requires Media Center 10 or later)


==Command Line Options and Parameters==
Media Core Commands (Media Center only)
Executing '''{{monospace|mc21.exe}}''' with one of the following command line options / parameters first starts Media Center if it is not already running (exception; see '''/Command''' below).


Some options in the table below accept a parameter ''<paths>'', which is a list of one or more paths to files and/or folders, each item separated by a '''|''' (vertical bar, or pipe).
MC11.exe /MCC [Command],[Param] sends the desired command to Media Center ([Param] is optional, and will default to 0)


Some options in the table below accept a parameter ''<playitems>'', which is a list of one or more items, each item separated by a '''|''' (vertical bar, or pipe). Through the text, each item in ''<playitems>'' can be any of the following:
See the Media Core Command list here: Media Core Command List
:* A filename: Example: '''C:\song1.mp3'''
:* A URL: Example: '''http:\\www.somewebsite.com\station.pls'''
:* A location within the Organization Tree: Example: '''TREEPATH=Playlists\Playlist1'''
:: The '''TREEPATH='''''<location>'''''\'''''<item>'' specification is case-sensitive for ''<location>'' and ''<item>'' and the hierarchy separator is '''\''' (backslash).
:* A device under CD & DVD and Handhelds: Example: '''DEVICE=G:'''


Each item in ''<playitems>'' may be targeted to a specific Zone by appending the item with '''Zone='''''<x>'', where ''<x>'' is replaced by the Zone number (Media Center 10 or later). Example:
Other Execute Parameters


:<tt>mc21.exe /Append C:\1.mp3|C:\2.mp3|Zone=3</tt>
MC11.exe /Import [filename] imports specified file into MJ library and launches Media Jukebox.


----
MC11.exe /Connect m01p://[ip address or host name] establishes connection to a remote Media Server
{| border="1" cellpadding="3" cellspacing="0"
|+ align="top" | '''''Media Center Command Line Options and Parameters'''''
!Option !! Parameter !! Description
|-
| /Append || ''<playitems>'' || Appends item(s) to Playing Now without changing the current playback state.
|-
| /AudioCD || ''<drive>'' || Plays the audio CD specified in drive ''<drive>'' (e.g.. '''D:''').
|-
| /Bluray || ''<drive>'' || Plays a Blu-ray disc specified in drive ''<drive>'' (e.g.. '''F:'''). Currently functionally equivalent to the /DVDInfo option.
|-
| /Clear || ''<mode>'' || Removes all files from Playing Now and stops playback.


:Values for ''<mode>'' :
MC11.exe /SilentImport [filename] imports specified file into MJ library but does not launch Media Jukebox.
:* '''DontRemoveCurrent''' Does not remove the currently playing file and does not stop playback.
|-
| /Close || || Closes Media Center.
|-
| rowspan="18" | /Command
| colspan="2" | '''Note 1:''' The /Command option has no effect if Media Center is not already running.<br />
'''Note 2:''' The /Command ''<subcmd>'' form is considered deprecated starting with 18.0.117; use the direct option instead (e.g. /Pause instead of /Command Pause).
|-
| FastForward || See /FastForward.
|-
| Mute || See /Mute.
|-
| Next || See /Next.
|-
| NextAlbum || See /NextAlbum.
|-
| NextArtist || See /NextArtist.
|-
| Pause || See /Pause.
|-
| Play || See /Play.
|-
| Previous || See /Previous.
|-
| PreviousAlbum || See /PreviousAlbum.
|-
| PreviousArtist || See /PreviousArtist.
|-
| Rewind || See /Rewind.
|-
| Stop || See /Stop.
|-
| ToggleShuffle || See /ToggleShuffle.
|-
| ToggleContinuous || See /ToggleContinuous.
|-
| VolumeUp ''<percent>'' || See /VolumeUp.
|-
| style="white-space:nowrap" | VolumeDown ''<percent>'' || See /VolumeDown.
|-
| VolumeSet ''<percent>'' || See /VolumeSet.
|-
| /Connect || m01p://''<host>'' || Establishes a connection to ''<host>'', a hostname or IP address that specifies the remote Media Server.
|-
| /DVDVideo || ''<drive>'' || Plays a DVD specified in drive ''<drive>'' (e.g.. '''E:'''). Currently functionally equivalent to the /Bluray option.
|-
| /ExportToXML || ''<filename>'' || Exports the current library as XML (in the MPL format) to the specified file ''<filename>''. If the program is not running, the command is performed silently, and the program exits.
|-
| /FastForward || || Jumps 5 seconds forward. See Note 1.
|-
| /Import || ''<paths>'' || Imports the specified files/folders into the Media Center library and launches Media Center.
|-
| /ImportAndPlay || ''<paths>'' || Same command as /Import, but also starts playback of the imported files (this replaces Playing Now)..
|-
| /Library || ''<library name>'' || Changes to the library specified by ''<library name>'' (Media Center 12.0.384 and later).
|-
| /LibraryReadOnly || || Starts Media Center with the library in read-only mode (aka. Party Mode).
|-
| /MCC || style="white-space:nowrap" | ''<command>'',''<param>'' || Sends the specified Media Center Core Command to Media Center.


:''<command>'' is one of the [[Media_Center_Core_Commands|Media Center Core Commands]].
MC11.exe /Clear [mode] clears Playing Now playlist. If mode is empty, all items will be removed. If mode is DontRemoveCurrent, currently playing file will not be removed.


:''<param>'' is optional, and defaults to 0.
MC11.exe /Mode [modename] if the app is not running the call starts MJ in the specified mode, if it's already running the call switches Media Jukebox to the specified mode. List of Mode names: Megame, Minime, Fullscreen, Theater, Windowed. If modename is empty MJ will start in user defined mode.


:Note: Only available in Media Center.
MC11.exe /Start starts Media Jukebox or brings it to top.
|-
|/MCWS/v1/... || || MCWS web service call (does not require Media Network to be running or a server to be listening). Use double-quotes around entire command (e.g. "/MCWS/v1/Playback/Pause?State=-1").
|-
| /MediaServer || || Starts Media Center in Media Server mode (without a UI).
|-
| /Mime || || Used by some Stores.
|-
| /Mode || ''<modename>'' || Sets the Media Center mode to ''<modename>''. Media Center will be started if it is not running.


:Select ''<modename>'' from one of the following:
MC11.exe /Close closes Media Jukebox
:* '''Standard''' Standard View
:* '''Megame''' Standard View, apparently the same as using '''Standard''', or simply defaults to Standard View
:* '''Windowed''' Display View, at the window size previously used. Not forced to full screen.
:* '''Fullscreen''' Display View, shown full screen by default.
:* '''Mini''' Mini View
:* '''Theater''' Theater View


MC11.exe /Power starts Media Jukebox if it's not running, or closes it if it is.
:Note: An empty ''<modename>'' is the same as the user's chosen startup mode if Media Center is not running, or Standard if it is already running.
|-
| /MonitorExtend || || Extend available displays across all monitors (Windows 7).
|-
| /MonitorSwitch || ''<monspecs>'' || Select, enable and disable monitors and resolution for playback. Use /MonitorSwitch without arguments for usage information. The format of ''<monspecs>'' is one or more of:


&nbsp;&nbsp;''<device>''''':'''enable<br />
Command Parameters
&nbsp;&nbsp;''<device>''''':'''disable<br />
&nbsp;&nbsp;''<device>''''':'''''<width>'''''x'''''<height>'''''x'''<''bit depth>'''''x'''''<refresh>''['''xprimary''']
|-
| /MonitorToggle || || Switch between the connected displays (Windows 7).
|-
| /Mute || || Mutes the sound. See Note 1.
|-
| /Next || || Skips to the next track. See Note 1.
|-
| /NextAlbum || || Skips forward to the next album. See Note 1.
|-
| /NextArtist || || Skips forward to the next artist. See Note 1.
|-
| /Pause || || Toggles between play and pause states. See Note 1.
|-
| /Play || ''<playitems>'' || If playback is currently stopped, Playing Now is replaced with the item(s) and playback starts, otherwise the item(s) are appended to Playing Now and playback jumps to the first specified item. Note: The option '''/Play''' may be omitted, in which case, take care to use double quotes as necessary when issuing commands in the Windows command shell. If ''<playitems>'' is empty, starts playback of the selected track(s), but see Note 1.
|-
| /PlayReplace || ''<playitems>'' || Playing Now is replaced with the item(s) and playback starts (same as /Replace).
|-
| /PlayNext || ''<playitems>'' || Playing Now has the files added as the next to play.
|-
| /Power || || Media Center is started when it is not currently running, or closed when running.
|-
| /Previous || || Skips back to the previous track. See Note 1.
|-
| /PreviousAlbum || || Skips back to the first listed track of the previous album. See Note 1.
|-
| /PreviousArtist || || Skips back to the previous artist (the topmost track of a sequential group by the previous artist). See Note 1.
|-
| /Protocol || ''<command>'' || Executes the specified protocol command ''<command>'', where the web browser subsequently runs ''<command>''. This option is used primarily for embedding commands into webpages (e.g. mc19://ShowHelp/Import).
|-
| /Replace || ''<playitems>'' || Playing Now is replaced with the item(s) and playback starts (same as /PlayReplace).
|-
| /Restart || || Restarts Media Center.
|-
| /Rewind || || Jumps 5 seconds backward. See Note 1.
|-
| /ShowTreePath || ''<treepath>'' || Starts Media Center if necessary, and changes the tree selection to the specified ''<treepath>''.
|-
| /SilentImport || ''<paths>'' || Imports (silently) the specified files/folders into the Media Center library, but does not launch Media Center.
|-
| /Sleep || ''<milliseconds>'' || Sleeps the specified number of ''<milliseconds>'' and then exits; supports delays in scripting.
|-
| /SoundcardSwitch || ''<cardspec>'' || Select sound card for playback (Windows 7/Vista). Use /SoundcardSwitch without arguments for usage information. The format of ''<cardspec>'' is:


&nbsp;&nbsp;DefaultByIndex:''<sound card index>''<br />
command parameters control functionality of running Media Jukebox. If MJ is not running, the following commands will be ignored.
|-
| /Start || || Starts Media Center or brings it to top.
|-
| /StartAfterDelay || ''<milliseconds>'' || Launches Media Center after the specified number of ''milliseconds''.
|-
| /Stop || || Stops playback. See Note 1.
|-
| /Subscribe || ''<podcast URL>'' || Subscribe to the podcast specified by ''<podcast URL>''.
|-
| /ToggleShuffle || || Toggles shuffle mode. See Note 1.
|-
| /ToggleContinuous || || Toggles continuous mode. See Note 1.
|-
| /VolumeUp ''<percent>'' || || Increases the sound volume by ''<percent>'' percent. Default: 5%. See Note 1.
|-
| style="white-space:nowrap" | /VolumeDown ''<percent>'' || || Decreases the sound volume by ''<percent> percent''. Default: 5%. See Note 1.
|-
| /VolumeSet ''<percent>'' || || Sets the sound volume directly to ''<percent>'' percent. Default: 50%. See Note 1.
|}


==Examples==
MC11.exe /Command Play starts playback of the selected track(s).
* Start playing the current track (if Media Center is running)
: <tt>mc20.exe /Play</tt>
* Play file.flac, launching Media Center if necessary.
: <tt>mc20.exe /Play "C:\path\to\file.flac"</tt>
* Import file.mp3 and start playback.
: <tt>mc20.exe /ImportAndPlay "C:\path\to\file.mp3"</tt>
* Silently import the files contained in folder1 and folder2.
: <tt>mc20.exe /SilentImport "C:\path\to\folder1|M:\path\to\folder2"</tt>
* Play the Not Recently Played smartlist.
: <tt>MC20.exe /Play TREEPATH="Playlists\Smartlists\Not Recently Played"</tt>
* Set the tree focus to Audio\Files, starting Media Center if necessary.
: <tt>MC20.exe /ShowTreePath "Audio\Files"</tt>


[[Category:Developer|Command Line]]
MC11.exe /Command Pause toggles between play and pause states.
[[Category:Frequently Asked Questions|Command Line]]

MC11.exe /Command Stop stops playback.

MC11.exe /Command Next skips to the next track.

MC11.exe /Command Previous jumps to previous track.

MC11.exe /Command FastForward jumps 5 seconds forward.

MC11.exe /Command Rewind jumps 5 seconds back.

MC11.exe /Command Mute mutes the sound.

MC11.exe /Command VolumeUp [Value] increases sound by Value. Default is 5%

MC11.exe /Command VolumeDown [Value] decreases sound by Value. Default by 5%

MC11.exe /Command VolumeSet [Value] sets main volume. If value is not specified 50% is used.

MC11.exe /Command ToggleShuffle toggles shuffle mode

MC11.exe /Command ToggleContinuous toggles continuous mode

Support

If you have questions or concerns not addressed by this SDK, or just have suggestions for making the SDK more understandable, please visit our developer's forum

Latest revision as of 12:26, 7 June 2021

Media Center and Media Jukebox can be controlled by command line parameters sent using a command launcher. The launcher is installed during installation of main application. The command launcher is version-specific, and installed in the standard system directory. The name of the command launcher for Media Center follows the (case-insensitive) form:

MC<MC version>.exe

and for Media Jukebox version 12 and beyond:

MJ<MJ version>.exe

and finally, prior to version 12 of Media Jukebox, the launcher is named:

mjextman.exe

Notes

  • The text that follows in this document will assume the usage of mc20.exe, the launcher for Media Center 20. Use the appropriate command for your version of Media Center or Media Jukebox. mc27.exe, for example.
  • The command launcher is installed into the system directory, typically C:\WINDOWS\system32\ (it does not reside in the application directory). Because the system directory is normally included in your system's PATH variable, it is not necessary to specify the full path when invoking the command launcher.

Command Line Options and Parameters

Executing mc21.exe with one of the following command line options / parameters first starts Media Center if it is not already running (exception; see /Command below).

Some options in the table below accept a parameter <paths>, which is a list of one or more paths to files and/or folders, each item separated by a | (vertical bar, or pipe).

Some options in the table below accept a parameter <playitems>, which is a list of one or more items, each item separated by a | (vertical bar, or pipe). Through the text, each item in <playitems> can be any of the following:

  • A filename: Example: C:\song1.mp3
  • A URL: Example: http:\\www.somewebsite.com\station.pls
  • A location within the Organization Tree: Example: TREEPATH=Playlists\Playlist1
The TREEPATH=<location>\<item> specification is case-sensitive for <location> and <item> and the hierarchy separator is \ (backslash).
  • A device under CD & DVD and Handhelds: Example: DEVICE=G:

Each item in <playitems> may be targeted to a specific Zone by appending the item with Zone=<x>, where <x> is replaced by the Zone number (Media Center 10 or later). Example:

mc21.exe /Append C:\1.mp3|C:\2.mp3|Zone=3

Media Center Command Line Options and Parameters
Option Parameter Description
/Append <playitems> Appends item(s) to Playing Now without changing the current playback state.
/AudioCD <drive> Plays the audio CD specified in drive <drive> (e.g.. D:).
/Bluray <drive> Plays a Blu-ray disc specified in drive <drive> (e.g.. F:). Currently functionally equivalent to the /DVDInfo option.
/Clear <mode> Removes all files from Playing Now and stops playback.
Values for <mode> :
  • DontRemoveCurrent Does not remove the currently playing file and does not stop playback.
/Close Closes Media Center.
/Command Note 1: The /Command option has no effect if Media Center is not already running.

Note 2: The /Command <subcmd> form is considered deprecated starting with 18.0.117; use the direct option instead (e.g. /Pause instead of /Command Pause).

FastForward See /FastForward.
Mute See /Mute.
Next See /Next.
NextAlbum See /NextAlbum.
NextArtist See /NextArtist.
Pause See /Pause.
Play See /Play.
Previous See /Previous.
PreviousAlbum See /PreviousAlbum.
PreviousArtist See /PreviousArtist.
Rewind See /Rewind.
Stop See /Stop.
ToggleShuffle See /ToggleShuffle.
ToggleContinuous See /ToggleContinuous.
VolumeUp <percent> See /VolumeUp.
VolumeDown <percent> See /VolumeDown.
VolumeSet <percent> See /VolumeSet.
/Connect m01p://<host> Establishes a connection to <host>, a hostname or IP address that specifies the remote Media Server.
/DVDVideo <drive> Plays a DVD specified in drive <drive> (e.g.. E:). Currently functionally equivalent to the /Bluray option.
/ExportToXML <filename> Exports the current library as XML (in the MPL format) to the specified file <filename>. If the program is not running, the command is performed silently, and the program exits.
/FastForward Jumps 5 seconds forward. See Note 1.
/Import <paths> Imports the specified files/folders into the Media Center library and launches Media Center.
/ImportAndPlay <paths> Same command as /Import, but also starts playback of the imported files (this replaces Playing Now)..
/Library <library name> Changes to the library specified by <library name> (Media Center 12.0.384 and later).
/LibraryReadOnly Starts Media Center with the library in read-only mode (aka. Party Mode).
/MCC <command>,<param> Sends the specified Media Center Core Command to Media Center.
<command> is one of the Media Center Core Commands.
<param> is optional, and defaults to 0.
Note: Only available in Media Center.
/MCWS/v1/... MCWS web service call (does not require Media Network to be running or a server to be listening). Use double-quotes around entire command (e.g. "/MCWS/v1/Playback/Pause?State=-1").
/MediaServer Starts Media Center in Media Server mode (without a UI).
/Mime Used by some Stores.
/Mode <modename> Sets the Media Center mode to <modename>. Media Center will be started if it is not running.
Select <modename> from one of the following:
  • Standard Standard View
  • Megame Standard View, apparently the same as using Standard, or simply defaults to Standard View
  • Windowed Display View, at the window size previously used. Not forced to full screen.
  • Fullscreen Display View, shown full screen by default.
  • Mini Mini View
  • Theater Theater View
Note: An empty <modename> is the same as the user's chosen startup mode if Media Center is not running, or Standard if it is already running.
/MonitorExtend Extend available displays across all monitors (Windows 7).
/MonitorSwitch <monspecs> Select, enable and disable monitors and resolution for playback. Use /MonitorSwitch without arguments for usage information. The format of <monspecs> is one or more of:

  <device>:enable
  <device>:disable
  <device>:<width>x<height>x<bit depth>x<refresh>[xprimary]

/MonitorToggle Switch between the connected displays (Windows 7).
/Mute Mutes the sound. See Note 1.
/Next Skips to the next track. See Note 1.
/NextAlbum Skips forward to the next album. See Note 1.
/NextArtist Skips forward to the next artist. See Note 1.
/Pause Toggles between play and pause states. See Note 1.
/Play <playitems> If playback is currently stopped, Playing Now is replaced with the item(s) and playback starts, otherwise the item(s) are appended to Playing Now and playback jumps to the first specified item. Note: The option /Play may be omitted, in which case, take care to use double quotes as necessary when issuing commands in the Windows command shell. If <playitems> is empty, starts playback of the selected track(s), but see Note 1.
/PlayReplace <playitems> Playing Now is replaced with the item(s) and playback starts (same as /Replace).
/PlayNext <playitems> Playing Now has the files added as the next to play.
/Power Media Center is started when it is not currently running, or closed when running.
/Previous Skips back to the previous track. See Note 1.
/PreviousAlbum Skips back to the first listed track of the previous album. See Note 1.
/PreviousArtist Skips back to the previous artist (the topmost track of a sequential group by the previous artist). See Note 1.
/Protocol <command> Executes the specified protocol command <command>, where the web browser subsequently runs <command>. This option is used primarily for embedding commands into webpages (e.g. mc19://ShowHelp/Import).
/Replace <playitems> Playing Now is replaced with the item(s) and playback starts (same as /PlayReplace).
/Restart Restarts Media Center.
/Rewind Jumps 5 seconds backward. See Note 1.
/ShowTreePath <treepath> Starts Media Center if necessary, and changes the tree selection to the specified <treepath>.
/SilentImport <paths> Imports (silently) the specified files/folders into the Media Center library, but does not launch Media Center.
/Sleep <milliseconds> Sleeps the specified number of <milliseconds> and then exits; supports delays in scripting.
/SoundcardSwitch <cardspec> Select sound card for playback (Windows 7/Vista). Use /SoundcardSwitch without arguments for usage information. The format of <cardspec> is:

  DefaultByIndex:<sound card index>

/Start Starts Media Center or brings it to top.
/StartAfterDelay <milliseconds> Launches Media Center after the specified number of milliseconds.
/Stop Stops playback. See Note 1.
/Subscribe <podcast URL> Subscribe to the podcast specified by <podcast URL>.
/ToggleShuffle Toggles shuffle mode. See Note 1.
/ToggleContinuous Toggles continuous mode. See Note 1.
/VolumeUp <percent> Increases the sound volume by <percent> percent. Default: 5%. See Note 1.
/VolumeDown <percent> Decreases the sound volume by <percent> percent. Default: 5%. See Note 1.
/VolumeSet <percent> Sets the sound volume directly to <percent> percent. Default: 50%. See Note 1.

Examples

  • Start playing the current track (if Media Center is running)
mc20.exe /Play
  • Play file.flac, launching Media Center if necessary.
mc20.exe /Play "C:\path\to\file.flac"
  • Import file.mp3 and start playback.
mc20.exe /ImportAndPlay "C:\path\to\file.mp3"
  • Silently import the files contained in folder1 and folder2.
mc20.exe /SilentImport "C:\path\to\folder1|M:\path\to\folder2"
  • Play the Not Recently Played smartlist.
MC20.exe /Play TREEPATH="Playlists\Smartlists\Not Recently Played"
  • Set the tree focus to Audio\Files, starting Media Center if necessary.
MC20.exe /ShowTreePath "Audio\Files"