Documentation
¶
Overview ¶
Package roku is a External Control API package for Golang
Index ¶
- Constants
- Variables
- func LiteralKey(key string) string
- type App
- type Apps
- type DeviceInfo
- type Endpoint
- func (e *Endpoint) ActiveApp() (*App, error)
- func (e *Endpoint) Apps() (Apps, error)
- func (e *Endpoint) DeviceInfo() (*DeviceInfo, error)
- func (e *Endpoint) FindRemote() error
- func (e *Endpoint) Icon(id string) ([]byte, error)
- func (e *Endpoint) Input(params map[string]string, options *InputOptions) error
- func (e *Endpoint) InstallApp(id string, params map[string]string) error
- func (e *Endpoint) IsInstalledApp(appID string) (bool, error)
- func (e *Endpoint) KeyDown(key string) error
- func (e *Endpoint) KeyUp(key string) error
- func (e *Endpoint) Keypress(key string) error
- func (e *Endpoint) LaunchApp(id string, params map[string]string) error
- func (e *Endpoint) PlayVideo(uri string) error
- func (e *Endpoint) Search(params map[string]string) error
- func (e *Endpoint) String() string
- type Endpoints
- type InputOptions
- type Params
Examples ¶
Constants ¶
const ( TVInput = "tvinput." YouTubeAppID = "837" NetflixAppID = "12" PrimeVideoAppID = "13" HuluAppID = "2285" PandoraAppID = "28" SpotifyAppID = "19977" ESPNAppID = "34376" PlayOnRokuID = "15985" HDMI1 = TVInput + "hdmi1" HDMI2 = TVInput + "hdmi2" HDMI3 = TVInput + "hdmi3" AV = TVInput + "cvbs" LiveTV = TVInput + "dtv" AppleTV = "551012" Peacock = "593099" HBOMax = "61322" CBS = "619667" DisneyPlus = "291097" ParamountPlus = "31440" Spotify = "22297" CW = "111255" ABC = "73376" FoxSports = "95307" )
Found from querying App IDs once installed on a TV https://channelstore.roku.com/details/{AppID} will take you to the channel's page Note that this will redirect you to a URL of the form https://channelstore.roku.com/details/{WebID}/{AppName} where WebID also identifies the app but only via Roku's website (and not on your TV)
Variables ¶
var ( // ErrNoAppFound is the error returned when no applicaiton is found. ErrNoAppFound = errors.New("no app found") // ErrNoAppsFound is the error returned when there are no applications found. ErrNoAppsFound = errors.New("no apps found") // ErrNoRespBody is the error returned when there was no response body from // the roku device. ErrNoRespBody = errors.New("no response body") // ErrAppNotFound is the error returned when the target app. was not found. ErrAppNotFound = errors.New("Failed to find app") )
var ( // HomeKey reprents the "Home" button. HomeKey = "Home" // RevKey reprents the "Rev" button. RevKey = "Rev" // FwdKey reprents the "Fwd" button. FwdKey = "Fwd" // PlayKey reprents the "Play" button. PlayKey = "Play" // SelectKey reprents the "Select" button. SelectKey = "Select" // LeftKey reprents the "Left" button. LeftKey = "Left" // RightKey reprents the "Right" button. RightKey = "Right" // DownKey reprents the "Down" button. DownKey = "Down" // UpKey reprents the "Up" button. UpKey = "Up" // BackKey reprents the "Back" button. BackKey = "Back" // InstantReplayKey reprents the "InstantReplay" button. InstantReplayKey = "InstantReplay" // InfoKey reprents the "Info" button. InfoKey = "Info" // BackspaceKey reprents the "Backspace" button. BackspaceKey = "Backspace" // SearchKey reprents the "Search" button. SearchKey = "Search" // EnterKey reprents the "Enter" button. EnterKey = "Enter" // FindRemoteKey reprents the "FindRemote" button. FindRemoteKey = "FindRemote" // VolumeDownKey reprents the "VolumeDown" button. VolumeDownKey = "VolumeDown" // VolumeMuteKey reprents the "VolumeMute" button. VolumeMuteKey = "VolumeMute" // VolumeUpKey reprents the "VolumeUp" button. VolumeUpKey = "VolumeUp" // PowerOffKey reprents the "PowerOff" button. PowerOffKey = "PowerOff" // ChannelUpKey reprents the "ChannelUp" button. ChannelUpKey = "ChannelUp" // ChannelDownKey reprents the "ChannelDown" button. ChannelDownKey = "ChannelDown" // InputTunerKey reprents the "InputTuner" button. InputTunerKey = "InputTuner" // InputHDMI1Key reprents the "InputHDMI1" button. InputHDMI1Key = "InputHDMI1" // InputHDMI2Key reprents the "InputHDMI2" button. InputHDMI2Key = "InputHDMI2" // InputHDMI3Key reprents the "InputHDMI3" button. InputHDMI3Key = "InputHDMI3" // InputHDMI4Key reprents the "InputHDMI4" button. InputHDMI4Key = "InputHDMI4" // InputAV1Key reprents the "InputAV1" button. InputAV1Key = "InputAV1" )
var DefaultWaitTime = 5
DefaultWaitTime is the default value (in seconds) to Find roku devices on the network.
Functions ¶
func LiteralKey ¶
LiteralKey formats a given (plaintext/string) key for Keypress that helps simulate the on-screen keyboard for roku input.
Types ¶
type App ¶
type App struct {
Name string `xml:",chardata" json:"name,omitempty"`
ID string `xml:"id,attr" json:"id,omitempty"`
Type string `xml:"type,attr" json:"type,omitempty"`
SubType string `xml:"subtype,attr" json:"sub_type,omitempty"`
Version string `xml:"version,attr" json:"version,omitempty"`
}
App has all the information of an application. https://github.com/kinghrothgar/roku/blob/master/roku/roku.go#L63
type DeviceInfo ¶
type DeviceInfo struct {
XMLName xml.Name `xml:"device-info" json:"-"`
Text string `xml:",chardata" json:"text,omitempty"`
Udn string `xml:"udn" json:"udn,omitempty"`
SerialNumber string `xml:"serial-number" json:"serial_number,omitempty"`
DeviceID string `xml:"device-id" json:"device_id,omitempty"`
AdvertisingID string `xml:"advertising-id" json:"advertising_id,omitempty"`
VendorName string `xml:"vendor-name" json:"vendor_name,omitempty"`
ModelName string `xml:"model-name" json:"model_name,omitempty"`
ModelNumber string `xml:"model-number" json:"model_number,omitempty"`
ModelRegion string `xml:"model-region" json:"model_region,omitempty"`
IsTv string `xml:"is-tv" json:"is_tv,omitempty"`
IsStick string `xml:"is-stick" json:"is_stick,omitempty"`
SupportsEthernet string `xml:"supports-ethernet" json:"supports_ethernet,omitempty"`
WifiMac string `xml:"wifi-mac" json:"wifi_mac,omitempty"`
WifiDriver string `xml:"wifi-driver" json:"wifi_driver,omitempty"`
EthernetMac string `xml:"ethernet-mac" json:"ethernet_mac,omitempty"`
NetworkType string `xml:"network-type" json:"network_type,omitempty"`
NetworkName string `xml:"network-name" json:"network_name,omitempty"`
FriendlyDeviceName string `xml:"friendly-device-name" json:"friendly_device_name,omitempty"`
FriendlyModelName string `xml:"friendly-model-name" json:"friendly_model_name,omitempty"`
DefaultDeviceName string `xml:"default-device-name" json:"default_device_name,omitempty"`
UserDeviceName string `xml:"user-device-name" json:"user_device_name,omitempty"`
BuildNumber string `xml:"build-number" json:"build_number,omitempty"`
SoftwareVersion string `xml:"software-version" json:"software_version,omitempty"`
SoftwareBuild string `xml:"software-build" json:"software_build,omitempty"`
SecureDevice string `xml:"secure-device" json:"secure_device,omitempty"`
Language string `xml:"language" json:"language,omitempty"`
Country string `xml:"country" json:"country,omitempty"`
Locale string `xml:"locale" json:"locale,omitempty"`
TimeZoneAuto string `xml:"time-zone-auto" json:"time_zone_auto,omitempty"`
TimeZone string `xml:"time-zone" json:"time_zone,omitempty"`
TimeZoneName string `xml:"time-zone-name" json:"time_zone_name,omitempty"`
TimeZoneTz string `xml:"time-zone-tz" json:"time_zone_tz,omitempty"`
TimeZoneOffset string `xml:"time-zone-offset" json:"time_zone_offset,omitempty"`
ClockFormat string `xml:"clock-format" json:"clock_format,omitempty"`
Uptime string `xml:"uptime" json:"uptime,omitempty"`
PowerMode string `xml:"power-mode" json:"power_mode,omitempty"`
SupportsSuspend string `xml:"supports-suspend" json:"supports_suspend,omitempty"`
SupportsFindRemote string `xml:"supports-find-remote" json:"supports_find_remote,omitempty"`
FindRemoteIsPossible string `xml:"find-remote-is-possible" json:"find_remote_is_possible,omitempty"`
SupportsAudioGuide string `xml:"supports-audio-guide" json:"supports_audio_guide,omitempty"`
SupportsRva string `xml:"supports-rva" json:"supports_rva,omitempty"`
DeveloperEnabled string `xml:"developer-enabled" json:"developer_enabled,omitempty"`
KeyedDeveloperID string `xml:"keyed-developer-id" json:"keyed_developer_id,omitempty"`
SearchEnabled string `xml:"search-enabled" json:"search_enabled,omitempty"`
SearchChannelsEnabled string `xml:"search-channels-enabled" json:"search_channels_enabled,omitempty"`
VoiceSearchEnabled string `xml:"voice-search-enabled" json:"voice_search_enabled,omitempty"`
NotificationsEnabled string `xml:"notifications-enabled" json:"notifications_enabled,omitempty"`
NotificationsFirstUse string `xml:"notifications-first-use" json:"notifications_first_use,omitempty"`
SupportsPrivateListening string `xml:"supports-private-listening" json:"supports_private_listening,omitempty"`
HeadphonesConnected string `xml:"headphones-connected" json:"headphones_connected,omitempty"`
SupportsEcsTextedit string `xml:"supports-ecs-textedit" json:"supports_ecs_textedit,omitempty"`
SupportsEcsMicrophone string `xml:"supports-ecs-microphone" json:"supports_ecs_microphone,omitempty"`
SupportsWakeOnWlan string `xml:"supports-wake-on-wlan" json:"supports_wake_on_wlan,omitempty"`
HasPlayOnRoku string `xml:"has-play-on-roku" json:"has_play_on_roku,omitempty"`
HasMobileScreensaver string `xml:"has-mobile-screensaver" json:"has_mobile_screensaver,omitempty"`
SupportURL string `xml:"support-url" json:"support_url,omitempty"`
GrandcentralVersion string `xml:"grandcentral-version" json:"grandcentral_version,omitempty"`
TrcVersion string `xml:"trc-version" json:"trc_version,omitempty"`
TrcChannelVersion string `xml:"trc-channel-version" json:"trc_channel_version,omitempty"`
DavinciVersion string `xml:"davinci-version" json:"davinci_version,omitempty"`
}
DeviceInfo contains all the information about the roku device.
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint represents a roku device on the network.
func NewEndpoint ¶
New create a new endpoint struct, url needs to be in the format 'http://ENDPOINT:PORT/' eg http://192.168.0.100:8060/
func (*Endpoint) DeviceInfo ¶
func (e *Endpoint) DeviceInfo() (*DeviceInfo, error)
DeviceInfo returns the DeviceInfo for a roku device endpoint.
func (*Endpoint) FindRemote ¶
FindRemote is a short-cut to the Keypress to find a roku remote control.
func (*Endpoint) Input ¶
func (e *Endpoint) Input(params map[string]string, options *InputOptions) error
Input provides input functionality for a roku device.
func (*Endpoint) InstallApp ¶
InstallApp attempts to install an application on the roku device.
func (*Endpoint) IsInstalledApp ¶
IsInstalledApp checks if the device has a given application ID
func (*Endpoint) PlayVideo ¶
PlayVideo wraps Input for the Play On Roku app. to play a custom video.
type InputOptions ¶
type InputOptions struct {
AppID string
}
InputOptions holds optional values for the "Input" method.