Yatse API

images

You can use Android intents to send commands to your Media Center from any application via Yatse: Kodi Remote and cast.
You can also use URI to start Yatse from a web page for example or listen to some broadcast to have detailed information on what is happening on your Media Center.
Remark: Yatse includes a Tasker plugin for easier usage of the API.

Yatse register some specific URI when installed:
yatse://command/show/remote
To show the Remote
yatse://command/show/select_host
To show the Select Host Dialog
yatse://command/show/volume_slider
To show the Volume Slider
yatse://command/browse/movies
To show the Movies library part
yatse://command/browse/tvshows
To show the TV Shows library part
yatse://command/browse/music
To show the Music library part
yatse://command/browse/pictures
To show the Pictures library part
yatse://command/browse/files
To show the Files library part
yatse://command/browse/pvr_tv
To show the Pvr tv library part
yatse://command/browse/pvr_radios
To show the Pvr radios library part
yatse://command/select/media_center?ID=xx
To change the current Media Center (where xx is the ID of the media center, visible in all media center list bottom right)
yatse://command/voicecommand/start
To start the Voice Command
yatse://command/play/mediatype/value (Unlocker only)
To start playing a media of type mediatype with the name value (Sample : yatse/command/play/Movie/avatar)
yatse://command/search/mediatype/value (Unlocker only)
To search a media of type mediatype with the name value (Sample : yatse://command/search/Movie/alien)

With the unlocker you can activate the option Send Broadcasts that allow Yatse to send public broadcast to inform other application on the phone on events.

The Broadcast Intent will have it's action set to : org.leetzone.android.yatsewidget.INFO_STATUS_CHANGED

You must then check the int extra : org.leetzone.android.yatsewidget.STATUS_FLAG to know the type of event.

This int is a bit flag that can have one or more of the following bits set :

0x1 : Media changed : This flag is set when the currently playing media change
0x2 : Status changed : This flag is set when the status of Media Center change (Play / Pause / Stop / Seeking)
0x8 : Connection changed : This flag is set when the connection status to Media Center change

Depending on the flags a number of extra fields will be filled with more details (The corresponding needed flag is show between () as the type)

• (0x8) org.leetzone.android.yatsewidget.HOST_STATUS - boolean : Contain the connection status to current Media Center
• (0x8) org.leetzone.android.yatsewidget.HOST_ID - long : Contain the id of current Media Center (Yatse 4.3.0+)
• (0x8) org.leetzone.android.yatsewidget.HOST_NAME - string : Contain the name of current Media Center (Yatse 4.3.0+)
• (0x2) org.leetzone.android.yatsewidget.MEDIA_ISACTIVE - boolean : True if a player is currently active
• (0x2) org.leetzone.android.yatsewidget.MEDIA_ISPLAYING - boolean : True if the media is currently playing (not paused)
• (0x2) org.leetzone.android.yatsewidget.MEDIA_ISSEEKING - boolean : True if the media is currently seeking or fast forwarding(rewinding)
• (0x1) org.leetzone.android.yatsewidget.MEDIA_FILENAME - string : The full filename of the media
• (0x1) org.leetzone.android.yatsewidget.MEDIA_ALBUM - string : The album name of the media if present
• (0x1) org.leetzone.android.yatsewidget.MEDIA_ARTIST - string : The artist name of the media if present
• (0x1) org.leetzone.android.yatsewidget.MEDIA_SHOW_EPISODE - int : The episode number of the media if present
• (0x1) org.leetzone.android.yatsewidget.MEDIA_SHOW_SEASON - int : The season number of the media if present
• (0x1) org.leetzone.android.yatsewidget.MEDIA_SHOW_TITLE - string : The Tv Show name of the media if present
• (0x1) org.leetzone.android.yatsewidget.MEDIA_TITLE - string : The title of the media
• (0x1) org.leetzone.android.yatsewidget.MEDIA_GENRE - string : The genre of the media if present
• (0x1) org.leetzone.android.yatsewidget.MEDIA_MEDIA_TYPE - string : The media type (movie / song / episode / unknown )
• (0x1) org.leetzone.android.yatsewidget.MEDIA_PLOT - string : The plot of the media if present
• (0x1) org.leetzone.android.yatsewidget.MEDIA_RATING - double : The rating of the media if present
• (0x1) org.leetzone.android.yatsewidget.MEDIA_TRACK - int : The track number of the media if present
• (0x1) org.leetzone.android.yatsewidget.MEDIA_IMDB - string : The IMDb of the media if present
• (0x1) org.leetzone.android.yatsewidget.MEDIA_THUMBNAIL - string : The string representation of the local uri to current media thumbnail cache (Large) (file://.....). This field can be missing if no image exists or if Yatse have not yet downloaded the image

Yatse 10.9+ exposes a Broadcast receiver that can handle a certain amount of commands to automate things.
The receiver component name is "org.leetzone.android.yatsewidgetfree/tv.yatse.api.ApiReceiver"
Fill the action value of the Intent to the API you want to call, and fill in the extras as documented below.

Sending notification to connected Kodi:
   - Action: "tv.yatse.api.SEND_NOTIFICATION"
   - Extras:
     • "TITLE" [String]: The title of the notification
     • "MESSAGE" [String]: The message of the notification
Force media sync:
   - Action: "tv.yatse.api.MEDIA_SYNC"
   - Extras:
     • "MEDIA_TYPE" [String]: The type of media
       Supported values:
       • Movie
       • MovieSet
       • Album
       • Artist
       • AudioGenre
       • Song
       • MusicVideo
       • Show
       • Episode
       • ALL


Sending direct command to connected Media Center:
   - Action: "tv.yatse.api.MEDIA_COMMAND"
   - Extras:
     • "COMMAND" [String]: The command to send
       Supported values:
       • playpause
       • play
       • pause
       • stop
       • rewind
       • forward
       • next
       • previous
       • subtitles
       • quit
       • togglemute
       • mute
       • unmute
       • seek (require Int parameter for the value)
       • volume (require Int parameter for the value)
       • wol (Also start Kodi with Kodi remote starter)
       • context
       • back
       • display
       • system
       • select
       • up
       • down
       • left
       • right
       • power
       • cectogglestate
       • aspectratio
       • info
       • shutdown
       • suspend
       • reboot
       • hibernate
       • home
       • cecon
       • cecoff
     • "INT_PARAMETER" [Int]: Int parameter for commands who require it
     • "STRING_PARAMETER" [String]: String parameter for commands who require it
Execute a custom command (Unlocker):
   - Action: "tv.yatse.api.CUSTOM_COMMAND"
   - Extras:
     • "ID" [Int]: The ID of the custom commands
       This id can be seen when clicking on the 3 dots on a Custom Command listing inside Yatse.
Execute a custom command (Unlocker):
   - Action: "tv.yatse.api.CUSTOM_COMMAND"
   - Extras:
     • "ID" [Int]: The ID of the custom commands
       This id can be seen when clicking on the 3 dots on a Custom Command listing inside Yatse.
Play URI (Unlocker):
   - Action: "tv.yatse.api.PLAY_URI"
   - Extras:
     • "URI" [String]: The uri to play on media center (Can contains Media Center specific Uri like: "plugins://.....")
Queue URI (Unlocker):
   - Action: "tv.yatse.api.QUEUE_URI"
   - Extras:
     • "URI" [String]: The uri to play on media center (Can contains Media Center specific Uri like: "plugins://.....")
Change current media center:
   - Action: "tv.yatse.api.SELECT_MEDIACENTER"
   - Extras:
     • "ID" [Int]: The ID of the media center
        This id can be seen in all media center listing inside Yatse.
Change current renderer (Unlocker):
   - Action: "tv.yatse.api.SELECT_RENDERER"
   - Extras:
     • "TYPE" [Int]: The Type of the renderer
        Possible value:
        • 1: Default Media Center
        • 2: Local Device
        • 3: Remote Media Center
        • 4: UPnP Player
        • 5: Airplay Player
        • 6: Chromecast Player
     • "IDENTIFIER" [String]: The identifier of the target renderer
       Identifier for corresponding types:
       • 3: String param contain the host id
       • 4: String param contain the UDN
       • 5: String param contains the Airplay key
       • 6: String param contains the Chromecast Id

Parse voice command (Unlocker):
   - Action: "tv.yatse.api.VOICE_COMMAND"
   - Extras:
     • "COMMAND" [String]: The voice command
        For example : "I want to listen to some lounge music.".
Change setting (Unlocker):
   - Action: "tv.yatse.api.CHANGE_SETTING"
   - Extras:
     • "SETTING" [String]: The setting
        Currenly only "onlyOffline" is supported
     • "INT_VALUE" [Int]: A value for the setting