Class: KodiClient::Methods::Player
Overview
contains all Kodi Application methods
Constant Summary
collapse
- ADD_SUBTITLE =
'Player.AddSubtitle'
- OPEN =
'Player.Open'
- GET_ACTIVE_PLAYER =
'Player.GetActivePlayers'
- GET_ITEM =
'Player.GetItem'
- GET_PLAYERS =
'Player.GetPlayers'
- GET_PROPERTIES =
'Player.GetProperties'
- GET_VIEW_MODE =
'Player.GetViewMode'
- GO_TO =
'Player.GoTo'
- MOVE =
'Player.Move'
- ROTATE =
'Player.Rotate'
- PLAY_PAUSE =
'Player.PlayPause'
- SEEK =
'Player.Seek'
- SET_AUDIO_STREAM =
'Player.SetAudioStream'
- SET_PARTY_MODE =
'Player.SetPartymode'
- SET_REPEAT =
'Player.SetRepeat'
- SET_SPEED =
'Player.SetSpeed'
- SET_SUBTITLE =
'Player.SetSubtitle'
- SET_VIDEO_STREAM =
'Player.SetVideoStream'
- SET_VIEW_MODE =
'Player.SetViewMode'
- STOP =
'Player.Stop'
- ZOOM =
'Player.Zoom'
Instance Method Summary
collapse
-
#add_subtitle(player_id, subtitle, kodi_id = 1) ⇒ Object
-
#get_active_players(kodi_id = 1) ⇒ Object
-
#get_item(player_id, properties = Types::List::ListFieldsAll.all_properties, kodi_id = 1) ⇒ Object
-
#get_players(media = Types::Media::MediaType::ALL, kodi_id = 1) ⇒ Object
-
#get_properties(player_id, properties = Types::Player::PropertyName.all_properties, kodi_id = 1) ⇒ Object
-
#get_view_mode(kodi_id = 1) ⇒ Object
-
#go_to(player_id, to = Types::Global::NextPrev::NEXT, kodi_id = 1) ⇒ KodiResponse
goes to the next/prev item or to a specific item in the playlist.
-
#move(player_id, direction = Types::Global::Direction::UP, kodi_id = 1) ⇒ Object
-
#play_pause(player_id, play = Types::Global::Toggle::TOGGLE, kodi_id = 1) ⇒ Object
-
#player_open(file, options = {}, kodi_id = 1) ⇒ Object
local file or stream url.
-
#rotate(player_id, rotate = Types::Global::Rotate::CLOCKWISE, kodi_id = 1) ⇒ Object
-
#seek(player_id, value, kodi_id = 1) ⇒ Object
seeks to the given position.
-
#set_audio_stream(player_id, stream, kodi_id = 1) ⇒ Object
sets the given audio stream.
-
#set_party_mode(player_id, mode = Types::Global::Toggle::TOGGLE, kodi_id = 1) ⇒ Object
-
#set_repeat(player_id, repeat = Types::Player::PlayerRepeat::ALL, kodi_id = 1) ⇒ Object
-
#set_speed(player_id, speed = Types::Global::IncrementDecrement::INCREMENT, kodi_id = 1) ⇒ Object
-
#set_subtitle(player_id, subtitle = Types::Global::NextPrev::NEXT, enabled = false, kodi_id = 1) ⇒ KodiResponse
-
#set_video_stream(player_id, stream = Types::Global::NextPrev::NEXT, kodi_id = 1) ⇒ KodiResponse
-
#set_view_mode(player_id, mode = Types::Player::ViewMode::NORMAL, kodi_id = 1) ⇒ Object
-
#stop(player_id, kodi_id = 1) ⇒ Object
-
#zoom(player_id, zoom, kodi_id = 1) ⇒ KodiResponse
Methods inherited from KodiMethod
#apply_options, #invoke_api
Instance Method Details
#add_subtitle(player_id, subtitle, kodi_id = 1) ⇒ Object
30
31
32
33
34
|
# File 'lib/kodi_client/methods/player.rb', line 30
def add_subtitle(player_id, subtitle, kodi_id = 1)
request = KodiRequest.new(kodi_id, ADD_SUBTITLE, { 'playerid' => player_id, 'subtitle' => subtitle })
json = invoke_api(request)
KodiResponse.new(json)
end
|
#get_active_players(kodi_id = 1) ⇒ Object
#get_item(player_id, properties = Types::List::ListFieldsAll.all_properties, kodi_id = 1) ⇒ Object
#get_players(media = Types::Media::MediaType::ALL, kodi_id = 1) ⇒ Object
#get_properties(player_id, properties = Types::Player::PropertyName.all_properties, kodi_id = 1) ⇒ Object
#get_view_mode(kodi_id = 1) ⇒ Object
#go_to(player_id, to = Types::Global::NextPrev::NEXT, kodi_id = 1) ⇒ KodiResponse
goes to the next/prev item or to a specific item in the playlist
#move(player_id, direction = Types::Global::Direction::UP, kodi_id = 1) ⇒ Object
98
99
100
101
102
|
# File 'lib/kodi_client/methods/player.rb', line 98
def move(player_id, direction = Types::Global::Direction::UP, kodi_id = 1)
request = KodiRequest.new(kodi_id, MOVE, { 'playerid' => player_id, 'direction' => direction })
json = invoke_api(request)
KodiResponse.new(json)
end
|
#play_pause(player_id, play = Types::Global::Toggle::TOGGLE, kodi_id = 1) ⇒ Object
110
111
112
113
114
115
116
|
# File 'lib/kodi_client/methods/player.rb', line 110
def play_pause(player_id, play = Types::Global::Toggle::TOGGLE, kodi_id = 1)
request = KodiRequest.new(kodi_id, PLAY_PAUSE, { 'playerid' => player_id, 'play' => play })
json = invoke_api(request)
result = json['result']['speed']
json['result'] = result
KodiResponse.new(json)
end
|
#player_open(file, options = {}, kodi_id = 1) ⇒ Object
45
46
47
48
49
|
# File 'lib/kodi_client/methods/player.rb', line 45
def player_open(file, options = {}, kodi_id = 1)
request = KodiRequest.new(kodi_id, OPEN, { 'item' => { 'file' => file }, 'options' => options })
json = invoke_api(request)
KodiResponse.new(json)
end
|
#rotate(player_id, rotate = Types::Global::Rotate::CLOCKWISE, kodi_id = 1) ⇒ Object
#seek(player_id, value, kodi_id = 1) ⇒ Object
seeks to the given position
return [KodiResponse] - return percentage, time and total time
125
126
127
128
129
130
131
|
# File 'lib/kodi_client/methods/player.rb', line 125
def seek(player_id, value, kodi_id = 1)
request = KodiRequest.new(kodi_id, SEEK, { 'playerid' => player_id, 'value' => value })
json = invoke_api(request)
result = Types::Player::SeekReturned.create(json['result'])
json['result'] = result
KodiResponse.new(json)
end
|
#set_audio_stream(player_id, stream, kodi_id = 1) ⇒ Object
sets the given audio stream
return [KodiResponse] ‘OK’ or error
138
139
140
141
142
|
# File 'lib/kodi_client/methods/player.rb', line 138
def set_audio_stream(player_id, stream, kodi_id = 1)
request = KodiRequest.new(kodi_id, SET_AUDIO_STREAM, { 'playerid' => player_id, 'stream' => stream })
json = invoke_api(request)
KodiResponse.new(json)
end
|
#set_party_mode(player_id, mode = Types::Global::Toggle::TOGGLE, kodi_id = 1) ⇒ Object
#set_repeat(player_id, repeat = Types::Player::PlayerRepeat::ALL, kodi_id = 1) ⇒ Object
#set_speed(player_id, speed = Types::Global::IncrementDecrement::INCREMENT, kodi_id = 1) ⇒ Object
#set_subtitle(player_id, subtitle = Types::Global::NextPrev::NEXT, enabled = false, kodi_id = 1) ⇒ KodiResponse
171
172
173
174
175
176
|
# File 'lib/kodi_client/methods/player.rb', line 171
def set_subtitle(player_id, subtitle = Types::Global::NextPrev::NEXT, enabled = false, kodi_id = 1)
request = KodiRequest.new(kodi_id, SET_SUBTITLE, { 'playerid' => player_id, 'subtitle' => subtitle,
'enabled' => enabled })
json = invoke_api(request)
KodiResponse.new(json)
end
|
#set_video_stream(player_id, stream = Types::Global::NextPrev::NEXT, kodi_id = 1) ⇒ KodiResponse
#set_view_mode(player_id, mode = Types::Player::ViewMode::NORMAL, kodi_id = 1) ⇒ Object
#stop(player_id, kodi_id = 1) ⇒ Object
196
197
198
199
200
|
# File 'lib/kodi_client/methods/player.rb', line 196
def stop(player_id, kodi_id = 1)
request = KodiRequest.new(kodi_id, STOP, { 'playerid' => player_id })
json = invoke_api(request)
KodiResponse.new(json)
end
|
#zoom(player_id, zoom, kodi_id = 1) ⇒ KodiResponse
208
209
210
211
212
|
# File 'lib/kodi_client/methods/player.rb', line 208
def zoom(player_id, zoom, kodi_id = 1)
request = KodiRequest.new(kodi_id, ZOOM, { 'playerid' => player_id, 'zoom' => zoom })
json = invoke_api(request)
KodiResponse.new(json)
end
|