Difference between revisions of "Frontend Service"

From MythTV Official Wiki
Jump to: navigation, search
(Return text for GetStatus (0.27.4) to)
m (0.27.4 sample of GetActionList output)
Line 245: Line 245:
 
<pre>
 
<pre>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
<FrontendActionList version="1.0" serializerVersion="1.1">
+
<FrontendActionList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" serializerVersion="1.1">
    <ActionList>
+
<ActionList>
        <Action key="0">0</Action>
+
    <Action><Key>0</Key><Value>0</Value></Action>
        <Action key="1">1</Action>
+
    <Action><Key>1</Key><Value>1</Value></Action>
        <Action key="2">2</Action>
+
    <Action><Key>2</Key><Value>2</Value></Action>
        <Action key="3">3</Action>
+
    <Action><Key>3</Key><Value>3</Value></Action>
        <Action key="4">4</Action>
+
    <Action><Key>3DNONE</Key><Value>No 3D</Value></Action>
        <Action key="5">5</Action>
+
    <Action><Key>3DSIDEBYSIDE</Key><Value>3D Side by Side</Value></Action>
        <Action key="6">6</Action>
+
    <Action><Key>3DSIDEBYSIDEDISCARD</Key><Value>Discard 3D Side by Side</Value></Action>
        <Action key="7">7</Action>
+
    <Action><Key>3DTOPANDBOTTOM</Key><Value>3D Top and Bottom</Value></Action>
        <Action key="8">8</Action>
+
    <Action><Key>3DTOPANDBOTTOMDISCARD</Key><Value>Discard 3D Top and Bottom</Value></Action>
        <Action key="9">9</Action>
+
    <Action><Key>4</Key><Value>4</Value></Action>
        <Action key="ADJUSTSTRETCH">Turn on time stretch control</Action>
+
    <Action><Key>5</Key><Value>5</Value></Action>
        <Action key="ARBSEEK">Arbitrary Seek</Action>
+
    <Action><Key>6</Key><Value>6</Value></Action>
        <Action key="BACK">Exit or return to DVD menu</Action>
+
    <Action><Key>7</Key><Value>7</Value></Action>
        <Action key="BACKSPACE">Backspace</Action>
+
    <Action><Key>8</Key><Value>8</Value></Action>
        <Action key="BIGJUMPFWD">Jump forward 10x the normal amount</Action>
+
    <Action><Key>9</Key><Value>9</Value></Action>
        <Action key="BIGJUMPREW">Jump back 10x the normal amount</Action>
+
    <Action><Key>ADJUSTSTRETCH</Key><Value>Turn on time stretch control</Value></Action>
        <Action key="BLANKSCR">Blank screen</Action>
+
    <Action><Key>ARBSEEK</Key><Value>Arbitrary Seek</Value></Action>
        <Action key="BOTTOMLIST">Move to bottom of list</Action>
+
    <Action><Key>BACK</Key><Value>Exit or return to DVD menu</Value></Action>
        <Action key="BROWSE">Change browsable in video manager</Action>
+
    <Action><Key>BACKSPACE</Key><Value>Backspace</Value></Action>
        <Action key="Burn DVD">Burn DVD</Action>
+
    <Action><Key>BIGJUMPFWD</Key><Value>Jump forward 10x the normal amount</Value></Action>
        <Action key="CANCEL">Cancel news item updating</Action>
+
    <Action><Key>BIGJUMPREW</Key><Value>Jump back 10x the normal amount</Value></Action>
        <Action key="CHANGEGROUPVIEW">Change Group View</Action>
+
 
        <Action key="CHANGERECGROUP">Change Recording Group</Action>
+
[... lots more  ...]
        <Action key="CHANNELDOWN">Channel down</Action>
+
 
        <Action key="CHANNELUP">Channel up</Action>
+
</ActionList>
        <Action key="CHANUPDATE">Switch channels without exiting guide in Live TV mode.</Action>
+
</FrontendActionList>
        <Action key="CLEARMAP">Clear editing cut points</Action>
 
        <Action key="CLEAROSD">Clear OSD</Action>
 
        <Action key="COPY">Copy text from textedit</Action>
 
    </ActionList>
 
<FrontendActionList>
 
 
</pre>
 
</pre>
 
  
 
==PlayRecording==
 
==PlayRecording==

Revision as of 14:28, 1 October 2015

What is this?

See Services API

Important.png Note: Unlike other services, the Frontend Service runs on frontend systems. The default Frontend Service API port is 6547.


Frontend Service API List

API Command POST Required? Description
GetStatus No Get the location, playback status, and a variety of other information about the current state of the Frontend.
SendMessage No (YES 0.28+) Send a message to the frontend, which will appear as a popup message on the screen.
SendNotification No (YES 0.28+) Send a notification to the frontend which will appear in the Notification Center.
SendAction No (YES 0.28+) Send an action such as UP, DOWN, SELECT, etc. to the frontend.
GetActionList No Get a list of actions which can be performed on the frontend using SendAction.
PlayRecording No (YES 0.28+) Play a television recording.
PlayVideo No (YES 0.28+) Play a video.

Frontend APIs

GetStatus

The GetStatus API takes no arguments.

Example Query:

http://FrontendIP:6547/Frontend/GetStatus

Example Return (in 0.27.4):

<?xml version="1.0" encoding="UTF-8"?>
<FrontendStatus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" serializerVersion="1.1">
    <State>
        <String><Key>angleidx</Key><Value></Value></String>
        <String><Key>audiosyncoffset</Key><Value>0</Value></String>
        <String><Key>behindtime</Key><Value></Value></String>
        <String><Key>brightness</Key><Value>50</Value></String>
        <String><Key>chanid</Key><Value>1002</Value></String>
        <String><Key>chapteridx</Key><Value></Value></String>
        <String><Key>colour</Key><Value>50</Value></String>
        <String><Key>contrast</Key><Value>40</Value></String>
        <String><Key>currentaudiotrack</Key><Value>1: English MP2 2ch</Value></String>
        <String><Key>description</Key><Value>2:56 of 38:59</Value></String>
        <String><Key>hue</Key><Value>0</Value></String>
        <String><Key>mute</Key><Value>0</Value></String>
        <String><Key>pathname</Key><Value>/var/lib/mythtv/recordings/1002_20150925205600.mpg</Value></String>
        <String><Key>playedtime</Key><Value>2:56</Value></String>
        <String><Key>playspeed</Key><Value>1</Value></String>
        <String><Key>position</Key><Value>75</Value></String>
        <String><Key>progafter</Key><Value>0</Value></String>
        <String><Key>progbefore</Key><Value>0</Value></String>
        <String><Key>programid</Key><Value>fp.bbc.co.uk/241cn6</Value></String>
        <String><Key>relbehindtime</Key><Value></Value></String>
        <String><Key>reldescription</Key><Value>2:56 of 38:59</Value></String>
        <String><Key>relplayedtime</Key><Value>2:56</Value></String>
        <String><Key>relposition</Key><Value>75</Value></String>
        <String><Key>relremainingtime</Key><Value>36:03</Value></String>
        <String><Key>relsecondsplayed</Key><Value>176</Value></String>
        <String><Key>reltotalseconds</Key><Value>2339</Value></String>
        <String><Key>reltotaltime</Key><Value>38:59</Value></String>
        <String><Key>remainingtime</Key><Value>36:03</Value></String>
        <String><Key>secondsplayed</Key><Value>176</Value></String>
        <String><Key>starttime</Key><Value>2015-09-25T20:56:00Z</Value></String>
        <String><Key>state</Key><Value>WatchingPreRecorded</Value></String>
        <String><Key>studiolevels</Key><Value>0</Value></String>
        <String><Key>subtitle</Key><Value></Value></String>
        <String><Key>title</Key><Value>The Great British Bake Off</Value></String>
        <String><Key>titleidx</Key><Value></Value></String>
        <String><Key>totalangles</Key><Value></Value></String>
        <String><Key>totalaudiotracks</Key><Value>2</Value></String>
        <String><Key>totalchapters</Key><Value></Value></String>
        <String><Key>totalseconds</Key><Value>2339</Value></String>
        <String><Key>totalsubtitletracks</Key><Value>1</Value></String>
        <String><Key>totaltime</Key><Value>38:59</Value></String>
        <String><Key>totaltitles</Key><Value></Value></String>
        <String><Key>volume</Key><Value>0</Value></String>
    </State>
    <ChapterTimes/>
    <SubtitleTracks>
        <Track><Key>SELECTSUBTITLE_0</Key><Value>Subtitle 1: English</Value></Track>
    </SubtitleTracks>
    <AudioTracks>
        <Track><Key>SELECTAUDIO_0</Key><Value>1: English MP2 2ch</Value></Track>
        <Track><Key>SELECTAUDIO_1</Key><Value>2: English (Audio Description)</Value></Track>
    </AudioTracks>
</FrontendStatus>

SendMessage

The SendMessage API takes the following arguments:

Message (Required)
Parameter Type: String
The message to appear on the frontend popup.

Example Query:

http://FrontendIP:6547/Frontend/SendMessage?Message=Hello World

Example Return:

Boolean return. Returns true if the message was sent, false if the message failed.

<bool>true</bool>

SendNotification

The SendNotification API takes the following arguments:

Message (Required)
Parameter Type: String
The message to appear on the frontend notification center.
Error (Optional)
Parameter Type: Boolean
The notification will be set as an error
Origin (Optional)
Parameter Type: String
The notification's origin
Description (Optional)
Parameter Type: String
The description to be sent in the notification
Image (Optional)
Parameter Type: String
The path or URL to image to be displayed in notification
Extra (Optional)
Parameter Type: String
The extra text to be sent in the notification
Progress (Optional)
Parameter Type: Float
A value between 0 and 1 (inclusive) indicating the progressiong percentage (1 is 100%).
- a negative value indicates not to display a progress bar
ProgressText (Optional)
Parameter Type: String
The text to be shown alongside the progress bar (if visible)
Timeout (Optional)
Parameter Type: Integer
The number of seconds the notification will be displayed for
Note that a notification can't be displayed for less than 5s
Fullscreen (Optional)
Parameter Type: Boolean
Display the notification in full screen mode
Visibility (Optional)
Parameter Type: Unsigned Integer
A bitmask value setting the visibility of the notification
(bit 0: video playback, bit 1: settings, bit 2: setup wizard, bit 3: video library
bit 4: music, bit 5: recordings library)
Priority (Optional)
Parameter Type: Unsigned Integer
The priority level of the notification
0 = default, 1 = low, 2 = medium, 3 = high, 4 = higher, 5 = highest
Type (Optional)
Parameter Type: String
The type of notification, valid values are:
normal, error, warning, check, busy

Example Query:

http://FrontendIP:6547/Frontend/SendNotification?Message=Hello World

Example Return:

Boolean return. Returns true if the notification was sent, false if the notification failed.

<bool>true</bool>

SendAction

The SendAction API takes the following arguments:

Action (Required)
Parameter Type: String
The action name to be sent to the frontend.
File (Required)
Parameter Type: String
The filename output where relevant (currently only used for the SCREENSHOT action).
Width (Required)
Parameter Type: Integer
The width of the output where relevant (currently only used for the SCREENSHOT action).
Height (Required)
Parameter Type: Integer
The height of the output where relevant (currently only used for the SCREENSHOT action).

Example Query:

http://FrontendIP:6547/Frontend/SendAction?Action=SELECT

Example Return:

Boolean return. Returns true if the action was accepted, false if the action failed.

<bool>true</bool>


GetActionList

The GetActionList API takes no arguments.

Example Query:

http://FrontendIP:6547/Frontend/GetActionList

Example Return:

<?xml version="1.0" encoding="UTF-8"?>
<FrontendActionList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" serializerVersion="1.1">
<ActionList>
    <Action><Key>0</Key><Value>0</Value></Action>
    <Action><Key>1</Key><Value>1</Value></Action>
    <Action><Key>2</Key><Value>2</Value></Action>
    <Action><Key>3</Key><Value>3</Value></Action>
    <Action><Key>3DNONE</Key><Value>No 3D</Value></Action>
    <Action><Key>3DSIDEBYSIDE</Key><Value>3D Side by Side</Value></Action>
    <Action><Key>3DSIDEBYSIDEDISCARD</Key><Value>Discard 3D Side by Side</Value></Action>
    <Action><Key>3DTOPANDBOTTOM</Key><Value>3D Top and Bottom</Value></Action>
    <Action><Key>3DTOPANDBOTTOMDISCARD</Key><Value>Discard 3D Top and Bottom</Value></Action>
    <Action><Key>4</Key><Value>4</Value></Action>
    <Action><Key>5</Key><Value>5</Value></Action>
    <Action><Key>6</Key><Value>6</Value></Action>
    <Action><Key>7</Key><Value>7</Value></Action>
    <Action><Key>8</Key><Value>8</Value></Action>
    <Action><Key>9</Key><Value>9</Value></Action>
    <Action><Key>ADJUSTSTRETCH</Key><Value>Turn on time stretch control</Value></Action>
    <Action><Key>ARBSEEK</Key><Value>Arbitrary Seek</Value></Action>
    <Action><Key>BACK</Key><Value>Exit or return to DVD menu</Value></Action>
    <Action><Key>BACKSPACE</Key><Value>Backspace</Value></Action>
    <Action><Key>BIGJUMPFWD</Key><Value>Jump forward 10x the normal amount</Value></Action>
    <Action><Key>BIGJUMPREW</Key><Value>Jump back 10x the normal amount</Value></Action>

[... lots more   ...] 

</ActionList>
</FrontendActionList>

PlayRecording

The PlayRecording API takes the following arguments:

ChanId (Required)
Parameter Type: Integer
The database channel id for the recording.
StartTime (Required)
Parameter Type: String
The recording start time for the item. This should be in MySQL ISO format, eg: 2011-08-29 18:59:00. You can replace the space with %20 or T.

Example Query:

http://FrontendIP:6547/Frontend/PlayRecording?ChanId=34736&StartTime=2011-09-26T19:00:00

Example Return:

<?xml version="1.0" encoding="UTF-8"?>
<bool>true</bool>


PlayVideo

The PlayVideo API takes the following arguments:

Id (Required)
Parameter Type: String
The database id for the video file.
UseBookmark (Optional)
Parameter Type: Boolean
Pass 1 to resume playback at a bookmark.

Example Query:

http://FrontendIP:6547/Frontend/PlayVideo?Id=73&UseBookmark=1

Example Return:

<?xml version="1.0" encoding="UTF-8"?>
<bool>true</bool>