Difference between revisions of "Frontend Service"

From MythTV Official Wiki
Jump to: navigation, search
(Add PlayRecording & PlayVideo)
Line 17: Line 17:
 
| Send a message to the frontend, which will appear as a popup message on the screen.
 
| Send a message to the frontend, which will appear as a popup message on the screen.
 
|-  
 
|-  
| style="background:silver" | [[Frontend_Service#SendAction | SendAction]]
+
| style="background:silver" | [[Frontend_Service#SendNotification | SendNotification]]
 
| style="background:silver" align="center" | No
 
| style="background:silver" align="center" | No
| style="background:silver" | Send an action such as UP, DOWN, SELECT, etc. to the frontend.
+
| style="background:silver" | Send a notification to the frontend which will appear in the Notification Center.
 
|-  
 
|-  
| [[Frontend_Service#GetActionList | GetActionList]]
+
| [[Frontend_Service#SendAction | SendAction]]
| align="center" | No
+
| align="center" | No
| Get a list of actions which can be performed on the frontend using SendAction.
+
| Send an action such as UP, DOWN, SELECT, etc. to the frontend.
 
|-  
 
|-  
| style="background:silver" | [[Frontend_Service#PlayRecording | PlayRecording]]
+
| style="background:silver" | [[Frontend_Service#GetActionList | GetActionList]]
| style="background:silver" align="center" | No
+
| style="background:silver" align="center" | No
| style="background:silver" | Play a television recording.
+
| style="background:silver" | Get a list of actions which can be performed on the frontend using SendAction.
 +
|-
 +
| [[Frontend_Service#PlayRecording | PlayRecording]]
 +
| align="center" | No
 +
| Play a television recording.
 
|-  
 
|-  
 
| style="background:silver" | [[Frontend_Service#PlayVideo | PlayVideo]]
 
| style="background:silver" | [[Frontend_Service#PlayVideo | PlayVideo]]
Line 80: Line 84:
 
Example Query:
 
Example Query:
  
<code>http://FrontendIP:6547/Frontend/SendMessage?Message=Hello World!</code>
+
<code>http://FrontendIP:6547/Frontend/SendMessage?Message=Hello World</code>
  
 
Example Return:
 
Example Return:
Line 88: Line 92:
 
<pre><bool>true</bool></pre>
 
<pre><bool>true</bool></pre>
  
 +
==SendNotification==
 +
 +
The <span style="color:LimeGreen">SendNotification</span> API takes the following arguments:
 +
 +
:<span style="color:SteelBlue">Message</Span> ('''Required''')
 +
:: '''Parameter Type:''' String
 +
:: The message to appear on the frontend notification center.
 +
 +
:<span style="color:SteelBlue">Error</Span> ("Optional")
 +
:: '''Parameter Type:''' Boolean
 +
:: The notification will be set as an error
 +
 +
:<span style="color:SteelBlue">Origin</Span> ('''Optional''')
 +
:: '''Parameter Type:''' String
 +
:: The notification's origin
 +
 +
:<span style="color:SteelBlue">Description</Span> ('''Optional''')
 +
:: '''Parameter Type:''' String
 +
:: The description to be sent in the notification
 +
 +
:<span style="color:SteelBlue">Image</Span> ('''Optional''')
 +
:: '''Parameter Type:''' String
 +
:: The path or URL to image to be displayed in notification
 +
 +
:<span style="color:SteelBlue">Extra</Span> ('''Optional''')
 +
:: '''Parameter Type:''' String
 +
:: The extra text to be sent in the notification
 +
 +
:<span style="color:SteelBlue">Progress</Span> ('''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
 +
 +
:<span style="color:SteelBlue">ProgressText</Span> ('''Optional''')
 +
:: '''Parameter Type:''' String
 +
:: The text to be shown alongside the progress bar (if visible)
 +
 +
:<span style="color:SteelBlue">Timeout</Span> ('''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
 +
 +
:<span style="color:SteelBlue">Fullscreen</Span> ('''Optional''')
 +
:: '''Parameter Type:''' Boolean
 +
:: Display the notification in full screen mode
 +
 +
:<span style="color:SteelBlue">Visibility</Span> ('''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)
 +
 +
:<span style="color:SteelBlue">Priority</Span> ('''Optional''')
 +
:: '''Parameter Type:''' Unsigned Integer
 +
:: The priority level of the notification
 +
:: 0 = default, 1 = low, 2 = medium, 3 = high, 4 = higher, 5 = highest
 +
 +
Example Query:
 +
 +
<code>http://FrontendIP:6547/Frontend/SendNotification?Message=Hello World</code>
 +
 +
Example Return:
 +
 +
Boolean return.  Returns true if the notification was sent, false if the notification failed.
 +
 +
<pre><bool>true</bool></pre>
  
 
==SendAction==
 
==SendAction==

Revision as of 04:55, 19 July 2013

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 Send a message to the frontend, which will appear as a popup message on the screen.
SendNotification No Send a notification to the frontend which will appear in the Notification Center.
SendAction No 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 Play a television recording.
PlayVideo No Play a video.

Frontend APIs

GetStatus

The GetStatus API takes no arguments.

Example Query:

http://FrontendIP:6547/Frontend/GetStatus

Example Return:

<FrontendStatus version="1.0" serializerVersion="1.1">
    <State>
        <String key="behindtime"/>
        <String key="chanid">34750</String>
        <String key="chapteridx">1</String>
        <String key="description">0:25:25 of 1:02:25</String>
        <String key="playedtime">0:25:25</String>
        <String key="position">407</String>
        <String key="progafter">0</String>
        <String key="progbefore">0</String>
        <String key="programid">EP012968460038</String>
        <String key="remainingtime">37:00</String>
        <String key="starttime">2011-11-14T17:59:00</String>
        <String key="state">WatchingPreRecorded</String>
        <String key="subtitle">Free Rick</String>
        <String key="title">American Chopper: Senior vs. Junior</String>
        <String key="titleidx">1</String>
        <String key="totaltime">1:02:25</String>
    </State>
</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

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 version="1.0" serializerVersion="1.1">
    <ActionList>
        <Action key="0">0</Action>
        <Action key="1">1</Action>
        <Action key="2">2</Action>
        <Action key="3">3</Action>
        <Action key="4">4</Action>
        <Action key="5">5</Action>
        <Action key="6">6</Action>
        <Action key="7">7</Action>
        <Action key="8">8</Action>
        <Action key="9">9</Action>
        <Action key="ADJUSTSTRETCH">Turn on time stretch control</Action>
        <Action key="ARBSEEK">Arbitrary Seek</Action>
        <Action key="BACK">Exit or return to DVD menu</Action>
        <Action key="BACKSPACE">Backspace</Action>
        <Action key="BIGJUMPFWD">Jump forward 10x the normal amount</Action>
        <Action key="BIGJUMPREW">Jump back 10x the normal amount</Action>
        <Action key="BLANKSCR">Blank screen</Action>
        <Action key="BOTTOMLIST">Move to bottom of list</Action>
        <Action key="BROWSE">Change browsable in video manager</Action>
        <Action key="Burn DVD">Burn DVD</Action>
        <Action key="CANCEL">Cancel news item updating</Action>
        <Action key="CHANGEGROUPVIEW">Change Group View</Action>
        <Action key="CHANGERECGROUP">Change Recording Group</Action>
        <Action key="CHANNELDOWN">Channel down</Action>
        <Action key="CHANNELUP">Channel up</Action>
        <Action key="CHANUPDATE">Switch channels without exiting guide in Live TV mode.</Action>
        <Action key="CLEARMAP">Clear editing cut points</Action>
        <Action key="CLEAROSD">Clear OSD</Action>
        <Action key="COPY">Copy text from textedit</Action>
    </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>