Wiki Navigation
- Loading...
Description
Commands are sent from a client to WifiRemote. Depending on the type and content of the message, actions are invoked on MediaPortal or messages are sent back to the client.
Each command is a seperate JSON object ('message') that is delimited by carriage return and line break (\r\n).
List of Commands
identify
Introduced in API version 4
This will send a request to identify your client connection with the WifiRemote plugin. This includes sending basic information about your client (name, application, version, ...) and authentication data (username, password, ...).
There are three possible methods to authenticate your client: 'userpass', 'passcode' and 'none'. Your client application will know what authentication method is accepted by the server by looking at the "AuthMethod" field of the 'welcome' message.
For 'userpass' you will have to supply the correct combination of username and password. For 'passcode' you only have to supply a correct PIN. The 'none' authentication method will always authenticate you, without needing any further information.
After authenticating, WifiRemote will reply with an 'authenticationresponse' message.
Fields
Type Field type: string
Required: yes
Possible values: identify Name Field type: string
Required: no
Possible values: Free text, example "My iPhone" Description Field type: string
Required: no
Possible values: Free text, description of this client Application Field type: string
Required: no
Possible values: Free text, name of your client app. Example: "CouchPotato" Version Field type: string
Required: no
Possible values: Free text, version of your client app. Example: "0.3.1.2" Authenticate Field type: object (dictionary)
Required: no if AuthMethod is "none", yes otherwise
Possible values: Fields "AuthMethod", "User", Password", "Passcode" AuthMethod Field type: string
Required: yes if AuthMethod is "both". No otherwise.
Possible values: userpass, passcode User Field type: string
Required: yes if AuthMethod is 'userpass'
Possible values: Free text, should be the username configured in the WifiRemote settings Password Field type: string
Required: yes, if AuthMethod is 'userpass'
Possible values: Free text, should be the password configured in the WifiRemote settings PassCode Field type: string
Required: yes, if AuthMethod is 'passcode'
Possible values: Free text, should be the passcode configured in the WifiRemote settings
Example
{ "Type":"identify", "Name":"My iPhone", "Application":"CouchPotato", "Version":"0.3.1.2", "Authenticate":{ "AuthMethod":"userpass", "Password":"admin", "User":"admin" } }
command
A command is an action that MediaPortal should take. This represents normal remote commands like arrow up, arrow down, context menu, ok and back. All possible commands are mapped to actions (defined in the WifiRemote.xml keymap).
Fields
Type Field type: string
Required: yes
Possible values: command Command Field type: string
Required: yes
Possible values: Commands that can be mapped to actions: stop, record, pause, play, rewind, forward, replay, skip, back, info, menu, up, down, left, right, ok, volup, voldown, volmute, chup, chdown, dvdmenu, 0 to 9, clear, enter, teletext, red, blue, yellow, green, home, basichome, nowplaying, tvguide, tvrecs, dvd, playlists, first, last, fullscreen, subtitles, audiotrack, screenshot
Example
{ "Type":"command", "Command":"info" }
key
Sends a key to WifiRemote that is forwarded to the currently active application via .Net SendKeys.SendWait
Fields
Type Field type: string
Required: yes
Possible values: key Key Field type: string
Required: yes
Possible values: All values accepted by SendKeys.SendWait() including the curly brackets {}
Example
{ "Type":"key", "Key":"h" }
commandstartrepeat
Changed from keydown in API version 4
Sends a command message that is repeated until a timeout (2 seconds) is reached or until the commandstoprepeat message is sent. This can be useful for scrolling in lists, for example. You have to send the commandstartrepeat message before the timeout again, if you want WifiRemote to keep sending this command to MediaPortal.
Fields
Type Field type: string
Required: yes
Possible values: commandstartrepeat Command Field type: string
Required: yes
Possible values: All valid commands Pause Field type: int
Required: yes
Possible values: Number of milliseconds until the command is repeated by MediaPortal.
Example
{ "Type":"commandstartrepeat", "Command":"down", "Pause":60 }
commandstoprepeat
Changed from keyup in API version 4
Stops the last repeated command initiated with commandstartrepeat.
Fields
Type Field type: string
Required: yes
Possible values: commandstoprepeat
Example
{ "Type":"commandstoprepeat" }
window
Opens a window with the specified window id in MediaPortal. This is used to switch to plugins. You can get the window ids from XML files in your skin folder. Each plugin skin file will have the id for that plugin in it.
Fields
Type Field type: string
Required: yes
Possible values: window Window Field type: int
Required: yes
Possible values: A MediaPortal window id, see above.
Example
{ "Type":"window", "Window":4755 // (OnlineVideos) }
activatewindow
Introduced with API version 9
Activate a window without resetting last activity. Optionally you can pass a loadParameter to the opened window.
Fields
Type Field type: string
Required: yes
Possible values: activatewindow Window Field type: int
Required: yes
Possible values: ID of the window to activate Parameter Field type: string
Required: no
Possible values: Please refer to the plugins for loadParam documentation
Example
{ "Type":"activatewindow", "Window":3847, "Parameter":"search:The Big Bang Theory" }
powermode
Allows the client to send commands like shutdown, reboot and logoff to MediaPortal.
Fields
Type Field type: string
Required: yes
Possible values: powermode PowerMode Field type: string
Required: yes
Possible values: logoff, suspend, hibernate, reboot, shutdown, exit
Example
{ "Type":"powermode", "PowerMode":"suspend" }
volume
Changes the volume of MediaPortal.
Fields
Type Field type: string
Required: yes
Possible values: volume Volume Field type: int
Required: yes
Possible values: Volume in percent, 0 - 100 Relative (introduced with api version 6)
Field type: bool
Required: no
Possible values: true if the value should be changed relative to the current value, for example increased by 2% or decreased by -10%. False (default) if the volume should be set absolutely.
Example
{ "Type":"volume", "Volume":40 }
Example with relative value
{ "Type":"volume", "Volume":-5, "Relative":true }
position
Changes the player position of the currently played media file.
Fields
Type Field type: string
Required: yes
Possible values: position Position Field type: int
Required: yes
Possible values: Position, depending on seek type SeekType Field type: int
Required: yes
Possible values: 0 to 3: 0=percentage, absolute, 1=percentage, relative, 2=s, absolute, 3=s, relative
Example
{ "Type":"position", "Position":15, "SeekType":0 }
playfile
Plays a file with the built in media player of MediaPortal.
Fields
Type Field type: string
Required: yes
Possible values: playfile FileType Field type: string
Required: yes
Possible values: video, audio Filepath Field type: string
Required: yes
Possible values: A valid path for a file to play. Please note that the MediaPortal instance must have access to this file.
Note: This should be called FilePath according to our naming conventions, but for historical reasons (or oversights) it's a lower p. FileHandler (introduced in api version 11)
Field type: string
Required: no, defaults to video
Possible values: Only used for videos, specify if the video you want to play is either "video" or "recording". "tv" is also possible but doesn't make much sense here
Introduced in API version 8
playchannel
Plays a tv channel with the built in media player of MediaPortal.
Fields
Type Field type: string
Required: yes
Possible values: playchannel ChannelId Field type: int
Required: yes
Possible values: 1, 20, 30, ... StartFullscreen Field type: bool
Required: no (default: false)
Possible values: true, false
Introduced in API version 7
StartPosition Field type: int
Required: no
Possible values: 0, 20, 500 (Start time in seconds)
Example
{ "Type":"playfile", "FileType":"video", "FilePath":"C:\fu\bar.mkv" }
plugins
Requests a list of active window plugins including the plugin name, plugin window id and plugin icon (optional). Only plugins that are enabled in MediaPortal config will be listed.
The server will replay with a Plugins message.
Fields
Type Field type: string
Required: yes
Possible values: plugins SendIcons Field type: bool
Required: no, defaults to true
Possible values: true if the icons should be included as base64 encoded byte arrays, false otherwise
Example
{ "Type":"plugins", "SendIcons":false }
properties
Allows the client to subscribe to certain skin properties. The client will receive the current property values and is notified about future changes to these properties.
Fields
Type Field type: string
Required: yes
Possible values: properties Properties Field type: array
Required: yes
Possible values: An array, containing strings of all properties the clients wants to subscribe to. Valid properties begin with #Play and #TV
Example
{ "Type":"properties", "Properties":[ "#Play.Current.Title", "#Play.Current.File", "#Play.Current.Thumb", "#Play.Current.Plot", "#Play.Current.PlotOutline", "#Play.Current.Channel", "#Play.Current.Genre", "#Play.Current.Title", "#Play.Current.Artist", "#Play.Current.Album", "#Play.Current.Track", "#Play.Current.Year", "#TV.View.channel", "#TV.View.thumb", "#TV.View.start", "#TV.View.stop", "#TV.View.remaining", "#TV.View.genre", "#TV.View.title", "#TV.View.description", "#TV.Next.start", "#TV.Next.stop", "#TV.Next.title", "#TV.Next.description" ] }
image
Requests an image on the HTPC filesystem to be sent back to the client.
Fields
Type Field type: string
Required: yes
Possible values: image ImagePath Field type: string
Required: yes
Possible values: A valid path to an image file on the filesystem. This file has to be accessible by MediaPortal. UserTag (introduced with api version 7)
Field type: string
Required: no
Possible values: Free text that will be passed back to your client in the image response to connect it to this request. MaximumWidth (introduced with api version 7)
Field type: int
Required: no
Possible values: Maximum width of the returned image in pixels. 0 for no resize MaximumHeight (introduced with api version 7)
Field type: int
Required: no
Possible values: Maximum height of the returned image in pixels. 0 for no resize
Example
{ "Type":"image", "ImagePath":"C:\Programdata\Team MediaPortal\MediaPortal\thumbs\test.jpg", "UserTag":"MusicCover", "MaximumWidth":320, "MaximumHeight":480 }
requeststatus
Introduced in API version 5
This command will request a status message from the server.
Fields
Type Field type: string
Required: yes
Possible values: requeststatus
Example
{ "Type":"requeststatus" }
requestnowplaying
Introduced in API version 5
This command will request a now playing message from the server.
If no file is played the response will be filled with default (0, empty and false) values.
Fields
Type Field type: string
Required: yes
Value: requestnowplaying
Example
{ "Type":"requestnowplaying" }
playlist
Introduced in API version 7
Actions for working with MediaPortal playlists. There are currently two types of playlist supported:
- current music
- current video
Loading and Saving of additional playlists is not yet implemented and might get added later on so ever action is executed on the current playlist.
Fields
Type Field type: string
Required: yes
Values: playlist PlaylistType Field type: string
Required: yes
Possible values: music, video PlaylistAction Field type: string
Required: yes
Possible values: new, append, get, remove, move, play, clear PlaylistItems Field type: List<PlaylistEntry>
Required: for actions new / append (except when PlayListSQL is specified, Introduced in API version 9)
Possible values: {Filename="c:
test.mp3", Name="test", Duration=233} PlayListSQL (Introduced with API version 9)
Field type: Object
Required: for actions new / append if no PlayListItems is specified
Possible values: { "Where" = "music db tracks table sql query where", "Limit" = Maximum number of results } InsertIndex Field type: string
Required: for actions new / append
Possible 0, 4, ... n Index Field type: string
Required: for actions remove, play
Possible 0, 4, ... n OldIndex Field type: int
Required: for action move
Possible values: 0, 4, ... n NewIndex Field type: int
Required: for action move
Possible values: 0, 4, ... n AutoPlay FieldType: bool
Required: no
Possible values: true to autoplay playlist after command, false not to play Shuffle Field type: bool
Required: no
Possible values: true to shuffle the playlist (for new, append and load), falso not to shuffle ShowPlaylist (Introduced with API version 9)
Field type: bool
Required: no (defaults to true)
Possible values: true if you want to show the playlist view after (auto)playing a playlist, false if you don't want to show it PlaylistType Field type: string
Required: no (defaults to music since api version 9)
Possible values: Type of the playlist. Either music or video PlaylistName (Introduced with API version 9)
Field type: string
Required: yes for action load, if PlaylistPath is not specified
Possible values: Name of an existing playlist in your MediaPortal playlist folder without m3u extension PlaylistPath (Introduced with API version 9)
Field type: string
Required: yes for action load, if PlaylistName is not specified
Possible values: Valid path to a playlist file, including filename and m3u extension
Actions
new / append Adds the given list of items (PlaylistItems) to the current playlist (music/video) and starts playback of the first item if AutoPlay was set to true. When using new, the current playlist will get cleared before adding the new items, append will add the new items to the current list. load Load a saved m3u playlist from MediaPortals playlists folder (PlaylistName) or any other accessible folder (PlaylistPath). Only works with music at the moment (introduced with API version 9) get Requests the current playlist. remove Removes the item at index Index from the playlist move Moves the item at position OldIndex to a new position NewIndex play Starts playback of the current playlist at position Index clear Clears the current playlist
Examples
Remove first song of music playlist:
{"Type":"playlist","PlaylistAction":"remove","PlaylistType":"music","Index":0}
Move first song to position 5 in music playlist:
{"Type":"playlist","PlaylistAction":"move","PlaylistType":"music","NewIndex":5,"OldIndex":0}
Get the music playlist:
{"Type":"playlist","PlaylistAction":"get","PlaylistType":"music"}
Clear the music playlist:
{"Type":"playlist","PlaylistAction":"clear","PlaylistType":"music"}
Load a playlist from MediaPortal's playlist folder:
{"Type":"playlist","PlaylistAction":"load","PlaylistName":"partylist"}
Load a playlist from an accessible folder:
{"Type":"playlist","PlaylistAction":"load","PlaylistPath":"C:\\My Music\\Playlists\\partylist.m3u"}
Create a new playlist with 20 songs that have "Heavy" in the album and shuffle them:
?{ "Type":"playlist", "PlaylistAction":"new", "PlaylistType":"music", "PlayListSQL": { "Where":"strAlbum LIKE '%Heavy%'", "Limit":20 }, "AutoPlay":true, "Shuffle":true }
Create a new playlist with defined songs:
{ "Type":"playlist", "PlaylistType":"music", "ImagePath":null, "PlaylistAction":"new", "PlaylistItems":[ { "FileName":"C:\\[2002] Away From The Sun\\3 Doors Down - 02 - Away From The Sun.mp3", "Name":"Away From The Sun", "Duration":233 }, { "FileName":"C:\\[2002] Away From The Sun\\3 Doors Down - 09 - Changes.mp3", "Name":"Changes", "Duration":237 }, { "FileName":"C:\\[2002] Away From The Sun\\3 Doors Down - 08 - Dangerous Game.mp3", "Name":"Dangerous Game", "Duration":216 }, { "FileName":"C:\\[2002] Away From The Sun\\3 Doors Down - 10 - Going Down In Flames.mp3", "Name":"Going Down In Flames", "Duration":209 }, { "FileName":"C:\\[2002] Away From The Sun\\3 Doors Down - 06 - Here Without You.mp3", "Name":"Here Without You", "Duration":239 }, { "FileName":"C:\\[2002] Away From The Sun\\3 Doors Down - 07 - I Feel You.mp3", "Name":"I Feel You", "Duration":247 }, { "FileName":"C:\\[2002] Away From The Sun\\3 Doors Down - 05 - Running Out Of Days.mp3", "Name":"Running Out Of Days", "Duration":211 }, { "FileName":"C:\\[2002] Away From The Sun\\3 Doors Down - 11 - Sarah Yellin'.mp3", "Name":"Sarah Yellin'", "Duration":198 }, { "FileName":"C:\\[2002] Away From The Sun\\3 Doors Down - 03 - The Road Im On.mp3", "Name":"The Road Im On", "Duration":240 }, { "FileName":"C:\\[2002] Away From The Sun\\3 Doors Down - 12 - This Time.mp3", "Name":"This Time", "Duration":319 }, { "FileName":"C:\\[2002] Away From The Sun\\3 Doors Down - 04 - Ticket To Heaven.mp3", "Name":"Ticket To Heaven", "Duration":208 }, { "FileName":"C:\\[2002] Away From The Sun\\3 Doors Down - 01 - When I'm Gone.mp3", "Name":"When I'm Gone", "Duration":262 } ], "AutoPlay":true }
movingpictures
Introduced with API version 9
This command provides methods to control the moving pictures plugin (if it is installed, of course :-)).
Those methods are specified with the "Action" parameter and will be listed grouped below.
Go to a movie detail page by name
This action looks for the movie closest to the searched name and opens its detail page.
Fields
Type Field type: string
Required: yes
Possible values: movingpictures Action Field type: string
Required: yes
Possible values: moviedetails MovieName Field type: string
Required: yes
Possible values: Name of one movie. If no movie is found or if moving pictures is not installed, nothing will happen.
Example
{ "Type":"movingpictures", "Action":"moviedetails", "MovieName":"Hot Fuzz" }
Play a movie by name or id
This action will try to play a movie with MovingPictures. The only thing that won't work is showing the rating dialog afterwards. You can either submit a movie name or a movie id.
Fields
Type Field type: string
Required: yes
Possible values: movingpictures Action Field type: string
Required: yes
Possible values: playmovie MovieName Field type: string
Required: yes, if MovieId is not specified
Possible values: Name of one movie. If no movie is found or if moving pictures is not installed, nothing will happen. MovieId Field type: int
Required: yes, if MovieName is not specified
Possible values: MovingPictures ID of a movie. AskToResume Field type: bool
Required: no (defaults to true)
Possible values: true to ask if the user wants to resume, false to just start the movie StartPosition Field type: int
Required: no (defaults to 0)
Possible values: Position from which the video should start in seconds (e.g. StartPosition=180 will start the movie 3 minutes into the video). Will be ignored if AskToResume is true.
Example
// Play by name { "Type":"movingpictures", "Action":"playmovie", "MovieName":"Hot Fuzz" } // Play by id { "Type":"movingpictures", "Action":"playmovie", "MovieId":4 }
tvseries
Added with API version 9
Commands related to the MP-TVSeries plugin. You need to have the plugin installed, otherwise these commands won't do anything. As with movingpictures the command can have several methods which decide what it should do.
Those methods are specified with the "Action" parameter and will be listed grouped below.
Play a specific episode of a tv show
This command tries to play a specific episode of a show with MP-TVSeries. If the episode is not found nothing will happen.
Fields
Type Field type: string
Required: yes
Possible values: tvseries Action Field type: string
Required: yes
Possible values: playepisode SeriesName Field type: string
Required: yes, if SeriesId is not specified
Possible values: Name of a series. WifiRemote will try to recognize partial names. SeriesId Field type: int
Required: yes, if SeriesName is not specified
Possible values: valid thetvdb series id's. SeasonNumber Field type: int
Required: yes
Possible values: Number of a season for the selected series without leading 0 EpisodeNumber Field type: int
Required: yes
Possible values: Number of an episode for the selected series and season without leading 0 AskToResume Field type: bool
Required: no (defaults to true)
Possible values: true to ask if the user wants to resume, false to just start the episode StartPosition Field type: int
Required: no (defaults to 0)
Possible values: Position from which the video should start in seconds (e.g. StartPosition=180 will start the episode 3 minutes into the video). Will be ignored if AskToResume is true.
Example
?{ "Type":"tvseries", "Action":playepisode", "SeriesName":"Game of Thrones", "SeasonNumber":1, "EpisodeNumber":10, "AskToResume":true }
Play first unwatched episode
This command will play the first unwatched episode of a series or the latest added episode if none is unwatched. Nothing will happen if the series isn't found.
Fields
Type Field type: string
Required: yes
Possible values: tvseries Action Field type: string
Required: yes
Possible values: playunwatchedepisode SeriesName Field type: string
Required: yes, if SeriesId is not specified
Possible values: Name of a series. WifiRemote will try to recognize partial names. SeriesId Field type: int
Required: yes, if SeriesName is not specified
Possible values: valid thetvdb series id's. AskToResume Field type: bool
Required: no (defaults to true)
Possible values: true to ask if the user wants to resume, false to just start the episode
Example
?{ "Type":"tvseries", "Action":playunwatchedepisode", "SeriesName":"Game of Thrones", "AskToResume":true }
Play a random episode of a series
This command plays a random episode of the selected series. If no series is found nothing will happen.
Fields
Type Field type: string
Required: yes
Possible values: tvseries Action Field type: string
Required: yes
Possible values: playrandomepisode SeriesName Field type: string
Required: yes, if SeriesId is not specified
Possible values: Name of a series. WifiRemote will try to recognize partial names. SeriesId Field type: int
Required: yes, if SeriesName is not specified
Possible values: valid thetvdb series id's. AskToResume Field type: bool
Required: no (defaults to true)
Possible values: true to ask if the user wants to resume, false to just start the episode
Example
?{ "Type":"tvseries", "Action":playrandomepisode", "SeriesName":"Game of Thrones", "AskToResume":true }
Play all episodes of a season
This command creates a MP-TVSeries playlist with all episodes of a specified series and season. You can choose if you want to add already played episodes, too, and if you want to automatically start playing the playlist.
Fields
Type Field type: string
Required: yes
Possible values: tvseries Action Field type: string
Required: yes
Possible values: playseason SeriesName Field type: string
Required: yes, if SeriesId is not specified
Possible values: Name of a series. WifiRemote will try to recognize partial names. SeriesId Field type: int
Required: yes, if SeriesName is not specified
Possible values: valid thetvdb series id's. SeasonNumber Field type: int
Required: yes
Possible values: Number of a valid season for this series, starting with 1 OnlyUnwatchedEpisodes Field type: bool
Required: no (defaults to false)
Possible values: true to only add unwatched episodes, false to add all episodes StartIndex Field type: int
Required: no (defaults to 0)
Possible values: Index of the playlist to start with, beginning with 0 SwitchToPlaylist Field type: bool
Required: no (defaults to true)
Possible values: true to switch to playlist view after adding the items, false otherwise. AutoStart Field type: bool
Required: no (defaults to true)
Possible values: true to start playing the playlist after all episodes were added
Example
{ "Type":"tvseries", "Action":"playseason", "SeriesName":"Burn notice", "SeasonNumber":2, "OnlyUnwatchedEpisodes":true }
Play all episodes of a series
This command creates a MP-TVSeries playlist with all episodes of a specified series. You can choose if you want to add already played episodes, too, and if you want to automatically start playing the playlist.
Fields
Type Field type: string
Required: yes
Possible values: tvseries Action Field type: string
Required: yes
Possible values: playseason SeriesName Field type: string
Required: yes, if SeriesId is not specified
Possible values: Name of a series. WifiRemote will try to recognize partial names. SeriesId Field type: int
Required: yes, if SeriesName is not specified
Possible values: valid thetvdb series id's. OnlyUnwatchedEpisodes Field type: bool
Required: no (defaults to false)
Possible values: true to only add unwatched episodes, false to add all episodes StartIndex Field type: int
Required: no (defaults to 0)
Possible values: Index of the playlist to start with, beginning with 0 SwitchToPlaylist Field type: bool
Required: no (defaults to true)
Possible values: true to switch to playlist view after adding the items, false otherwise. AutoStart Field type: bool
Required: no (defaults to true)
Possible values: true to start playing the playlist after all episodes were added
Example
{ "Type":"tvseries", "Action":"playseries", "SeriesName":"Burn notice", "OnlyUnwatchedEpisodes":true }
Dialog
Handle MediaPortal dialogs.
This command allows you to handle dialogs in MediaPortal. The action is always invoked on the currently open dialog (only one dialog can be open at a time in MP)
Fields
Type Field type: string
Required: yes
Possible values: dialog ActionType Field type: string
Required: yes
Possible values: get, action received from a dialog message DialogId Field type: int
Required: yes
Possible values: Id of a valid MP dialog (see GUIWindow.Window.WINDOW_DIALOG_XXX in MP source) Index Field type: int
Required: only on list-dialogs
Possible values: 0 - n
Example
{ "Type":"dialog", "ActionType":"ok", "DialogId":2002, "Index":0 }
Facade
Handle MediaPortal facade (listviews).
This command allows you to handle the facades in MediaPortal. A facade in MediaPortal is a list-representation with different views (list, thumb, coverflow,...). Only one facade per page is typically allowed.
Fields
Type Field type: string
Required: yes
Possible values: facade FacadeAction Field type: string
Required: yes
Possible values: get, setselected, getselected, getcount, select, context SelectedIndex Field type: int
Required: yes, if FacadeAction is select, setselected or context
Possible values: 0-n
Example
{ "Type":"facade", "FacadeAction":"ok", "SelectedIndex":10 }
screenshot
Introduced in API version 14
This command will request a now screenshot (in form of a screenshot message) from the server.
You can specify a width that will be used to resize the screenshot.
Fields
Type Field type: string
Required: yes
Value: screenshot Width Field type: int
Required: no
Valaue: Width of the screenshot you will receive. The height will be calculated by using the ration between the original screenshot width and your width.
Example
{ "Type":"screenshot", "Width":800 }
This page has no comments.