Class: KodiClient::Methods::GUI

Inherits:
KodiMethod show all
Defined in:
lib/kodi_client/methods/gui.rb

Overview

contains all Kodi GUI methods

Constant Summary collapse

ACTIVATE_WINDOW =
'GUI.ActivateWindow'
GET_PROPERTIES =
'GUI.GetProperties'
GET_STEREOSCOPIC_MODES =
'GUI.GetStereoscopicModes'
SET_STEREOSCOPIC_MODES =
'GUI.SetStereoscopicMode'
SET_FULLSCREEN =
'GUI.SetFullscreen'
SHOW_NOTIFICATION =
'GUI.ShowNotification'

Instance Method Summary collapse

Methods inherited from KodiMethod

#apply_options, #invoke_api

Instance Method Details

#activate_window(window = Types::GUI::GUIWindow::HOME, parameters = [], kodi_id = 1) ⇒ Object



15
16
17
18
19
# File 'lib/kodi_client/methods/gui.rb', line 15

def activate_window(window = Types::GUI::GUIWindow::HOME, parameters = [], kodi_id = 1)
  request = KodiRequest.new(kodi_id, ACTIVATE_WINDOW, { 'window' => window, 'parameters' => parameters })
  json = invoke_api(request)
  KodiResponse.new(json)
end

#get_properties(properties = Types::GUI::PropertyName.all_properties, kodi_id = 1) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/kodi_client/methods/gui.rb', line 21

def get_properties(properties = Types::GUI::PropertyName.all_properties, kodi_id = 1)
  request = KodiRequest.new(kodi_id, GET_PROPERTIES, { 'properties' => properties })
  json = invoke_api(request)
  result = KodiClient::Types::GUI::PropertyValue.create(json['result'])
  json['result'] = result
  KodiResponse.new(json)
end

#get_stereoscopic_modes(kodi_id = 1) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/kodi_client/methods/gui.rb', line 29

def get_stereoscopic_modes(kodi_id = 1)
  request = KodiRequest.new(kodi_id, GET_STEREOSCOPIC_MODES, {})
  json = invoke_api(request)
  result = Types::GUI::StereoscopyMode.create_list(json['result']['stereoscopicmodes'])
  json['result'] = result
  KodiResponse.new(json)
end

#set_fullscreen(fullscreen = Types::Global::Toggle, kodi_id = 1) ⇒ Object



37
38
39
40
41
# File 'lib/kodi_client/methods/gui.rb', line 37

def set_fullscreen(fullscreen = Types::Global::Toggle, kodi_id = 1)
  request = KodiRequest.new(kodi_id, SET_FULLSCREEN, { 'fullscreen' => fullscreen })
  json = invoke_api(request)
  KodiResponse.new(json)
end

#set_stereoscopic_mode(mode = Types::GUI::StereoscopyMode::OFF, kodi_id = 1) ⇒ Object



43
44
45
46
47
# File 'lib/kodi_client/methods/gui.rb', line 43

def set_stereoscopic_mode(mode = Types::GUI::StereoscopyMode::OFF, kodi_id = 1)
  request = KodiRequest.new(kodi_id, SET_STEREOSCOPIC_MODES, { 'mode' => mode })
  json = invoke_api(request)
  KodiResponse.new(json)
end

#show_notification(title, message, image = '', display_time_in_ms = 5000, kodi_id = 1) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/kodi_client/methods/gui.rb', line 49

def show_notification(title, message, image = '', display_time_in_ms = 5000, kodi_id = 1)
  request = KodiRequest.new(kodi_id, SHOW_NOTIFICATION, { 'title' => title,
                                                          'message' => message,
                                                          'image' => image,
                                                          'displaytime' => display_time_in_ms })
  json = invoke_api(request)
  KodiResponse.new(json)
end