kodi_client 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/README.md +1 -0
- data/kodi_client.gemspec +2 -2
- data/lib/kodi_client/extensions/chainable.rb +71 -0
- data/lib/kodi_client/extensions/comparable.rb +29 -0
- data/lib/kodi_client/extensions/creatable.rb +137 -0
- data/lib/kodi_client/extensions/iterable.rb +14 -0
- data/lib/kodi_client/kodi_error.rb +14 -0
- data/lib/kodi_client/kodi_method.rb +34 -0
- data/lib/kodi_client/{options.rb → kodi_options.rb} +1 -1
- data/lib/kodi_client/kodi_request.rb +16 -0
- data/lib/kodi_client/kodi_response.rb +21 -0
- data/lib/kodi_client/{method → methods}/addons.rb +6 -10
- data/lib/kodi_client/{method → methods}/application.rb +2 -5
- data/lib/kodi_client/methods/audio_library.rb +334 -0
- data/lib/kodi_client/{method → methods}/favourites.rb +2 -5
- data/lib/kodi_client/{method → methods}/files.rb +6 -14
- data/lib/kodi_client/{method → methods}/gui.rb +2 -5
- data/lib/kodi_client/{method → methods}/input.rb +2 -6
- data/lib/kodi_client/{method → methods}/player.rb +2 -7
- data/lib/kodi_client/{method → methods}/profiles.rb +5 -10
- data/lib/kodi_client/{method → methods}/system.rb +2 -6
- data/lib/kodi_client/types/addons/addon_content_type.rb +18 -0
- data/lib/kodi_client/types/addons/addon_dependency_type.rb +21 -0
- data/lib/kodi_client/types/addons/addon_details_type.rb +44 -0
- data/lib/kodi_client/types/addons/addon_extra_info_type.rb +20 -0
- data/lib/kodi_client/types/addons/addon_fields_type.rb +28 -0
- data/lib/kodi_client/types/addons/addon_types_type.rb +48 -0
- data/lib/kodi_client/types/addons/get_addon_returned_type.rb +21 -0
- data/lib/kodi_client/types/addons/get_addons_returned_type.rb +22 -0
- data/lib/kodi_client/types/application/property_name_type.rb +19 -0
- data/lib/kodi_client/types/application/property_value_type.rb +24 -0
- data/lib/kodi_client/types/application/version_type.rb +22 -0
- data/lib/kodi_client/types/audio/audio_album_release_type_type.rb +15 -0
- data/lib/kodi_client/types/audio/audio_artist_role_type.rb +21 -0
- data/lib/kodi_client/types/audio/audio_contributor_type.rb +22 -0
- data/lib/kodi_client/types/audio/audio_details_album_type.rb +58 -0
- data/lib/kodi_client/types/audio/audio_details_artist_type.rb +54 -0
- data/lib/kodi_client/types/audio/audio_details_base_type.rb +31 -0
- data/lib/kodi_client/types/audio/audio_details_media_type.rb +46 -0
- data/lib/kodi_client/types/audio/audio_details_role_type.rb +25 -0
- data/lib/kodi_client/types/audio/audio_details_song_type.rb +76 -0
- data/lib/kodi_client/types/audio/audio_fields_album_type.rb +50 -0
- data/lib/kodi_client/types/audio/audio_fields_artist_type.rb +39 -0
- data/lib/kodi_client/types/audio/audio_fields_role_type.rb +15 -0
- data/lib/kodi_client/types/audio/audio_fields_song_type.rb +61 -0
- data/lib/kodi_client/types/audio/available_art_type.rb +21 -0
- data/lib/kodi_client/types/audio/genre_type.rb +20 -0
- data/lib/kodi_client/types/audio/get_albums_returned_type.rb +22 -0
- data/lib/kodi_client/types/audio/get_artists_returned_type.rb +23 -0
- data/lib/kodi_client/types/audio/get_genres_returned_type.rb +24 -0
- data/lib/kodi_client/types/audio/get_roles_returned_type.rb +25 -0
- data/lib/kodi_client/types/audio/get_songs_returned_type.rb +25 -0
- data/lib/kodi_client/types/audio/get_sources_return_type.rb +25 -0
- data/lib/kodi_client/types/audio/property_name_type.rb +25 -0
- data/lib/kodi_client/types/audio/property_value_type.rb +33 -0
- data/lib/kodi_client/types/favourites/details_favourite_type.rb +24 -0
- data/lib/kodi_client/types/favourites/fields_favourite_type.rb +17 -0
- data/lib/kodi_client/types/favourites/get_favourite_returned_type.rb +22 -0
- data/lib/kodi_client/types/favourites/type_type.rb +18 -0
- data/lib/kodi_client/types/files/file_label_type.rb +20 -0
- data/lib/kodi_client/types/files/get_directory_returned_type.rb +22 -0
- data/lib/kodi_client/types/files/get_sources_returned_type.rb +22 -0
- data/lib/kodi_client/types/files/media_type.rb +18 -0
- data/lib/kodi_client/types/files/prepare_download_returned_type.rb +21 -0
- data/lib/kodi_client/types/global/direction_type.rb +17 -0
- data/lib/kodi_client/types/global/global_time_type.rb +22 -0
- data/lib/kodi_client/types/global/id_label_type.rb +20 -0
- data/lib/kodi_client/types/global/id_name_type.rb +20 -0
- data/lib/kodi_client/types/global/increment_decrement_type.rb +15 -0
- data/lib/kodi_client/types/global/next_prev_type.rb +17 -0
- data/lib/kodi_client/types/global/password_encryption_type.rb +16 -0
- data/lib/kodi_client/types/global/rotate_type.rb +15 -0
- data/lib/kodi_client/types/global/toggle_type.rb +16 -0
- data/lib/kodi_client/types/gui/gui_window_type.rb +124 -0
- data/lib/kodi_client/types/gui/property_name_type.rb +18 -0
- data/lib/kodi_client/types/gui/property_value_type.rb +26 -0
- data/lib/kodi_client/types/gui/stereoscopy_mode_type.rb +31 -0
- data/lib/kodi_client/types/input/input_action_type.rb +212 -0
- data/lib/kodi_client/{global_types/item_types.rb → types/items/item_details_base_type.rb} +1 -3
- data/lib/kodi_client/types/library/library_details_genre_type.rb +27 -0
- data/lib/kodi_client/types/library/library_details_source_type.rb +26 -0
- data/lib/kodi_client/types/library/library_fields_genre_type.rb +17 -0
- data/lib/kodi_client/types/library/library_fields_source_type.rb +17 -0
- data/lib/kodi_client/types/list/list_field_files_type.rb +83 -0
- data/lib/kodi_client/types/list/list_fields_all_type.rb +96 -0
- data/lib/kodi_client/types/list/list_item_all_type.rb +73 -0
- data/lib/kodi_client/types/list/list_item_base_type.rb +138 -0
- data/lib/kodi_client/types/list/list_item_file_type.rb +68 -0
- data/lib/kodi_client/types/list/list_limits_returned_type.rb +23 -0
- data/lib/kodi_client/types/list/list_limits_type.rb +23 -0
- data/lib/kodi_client/types/list/list_sort_method_type.rb +54 -0
- data/lib/kodi_client/types/list/list_sort_type.rb +28 -0
- data/lib/kodi_client/types/list/sort_order_type.rb +15 -0
- data/lib/kodi_client/types/media/media_artwork_type.rb +26 -0
- data/lib/kodi_client/types/media/media_details_base_type.rb +28 -0
- data/lib/kodi_client/types/media/media_type_type.rb +16 -0
- data/lib/kodi_client/types/player/audio_stream_type.rb +29 -0
- data/lib/kodi_client/types/player/player_position_time_type.rb +22 -0
- data/lib/kodi_client/types/player/player_repeat_type.rb +17 -0
- data/lib/kodi_client/types/player/player_speed_type.rb +26 -0
- data/lib/kodi_client/types/player/player_type.rb +24 -0
- data/lib/kodi_client/types/player/player_type_type.rb +16 -0
- data/lib/kodi_client/types/player/player_view_mode_type.rb +23 -0
- data/lib/kodi_client/types/player/player_visibility_type.rb +16 -0
- data/lib/kodi_client/types/player/property_name_type.rb +38 -0
- data/lib/kodi_client/types/player/property_value_type.rb +60 -0
- data/lib/kodi_client/types/player/seek_jump_type.rb +17 -0
- data/lib/kodi_client/types/player/seek_returned_type.rb +23 -0
- data/lib/kodi_client/types/player/subtitle_type.rb +24 -0
- data/lib/kodi_client/types/player/video_stream_type.rb +26 -0
- data/lib/kodi_client/types/player/view_mode_type.rb +22 -0
- data/lib/kodi_client/types/player/zoom_type.rb +15 -0
- data/lib/kodi_client/types/profiles/details_profile_type.rb +24 -0
- data/lib/kodi_client/types/profiles/fields_profile_type.rb +15 -0
- data/lib/kodi_client/types/profiles/get_profiles_returned_type.rb +22 -0
- data/lib/kodi_client/types/profiles/profile_password_type.rb +20 -0
- data/lib/kodi_client/{global_types/pvr_type.rb → types/pvr/channel_type_type.rb} +2 -6
- data/lib/kodi_client/types/system/property_name_type.rb +17 -0
- data/lib/kodi_client/{global_types/system_types.rb → types/system/property_value_type.rb} +2 -17
- data/lib/kodi_client/types/video/stream_details_type.rb +24 -0
- data/lib/kodi_client/types/video/video_cast_type.rb +22 -0
- data/lib/kodi_client/types/video/video_details_base_type.rb +29 -0
- data/lib/kodi_client/types/video/video_details_file_type.rb +37 -0
- data/lib/kodi_client/types/video/video_details_item_type.rb +32 -0
- data/lib/kodi_client/types/video/video_details_media_type.rb +28 -0
- data/lib/kodi_client/types/video/video_resume_type.rb +20 -0
- data/lib/kodi_client.rb +156 -24
- metadata +129 -37
- data/lib/kodi_client/Chainable.rb +0 -49
- data/lib/kodi_client/global_types/addon_types.rb +0 -180
- data/lib/kodi_client/global_types/application_types.rb +0 -56
- data/lib/kodi_client/global_types/audio_types.rb +0 -226
- data/lib/kodi_client/global_types/favourites_types.rb +0 -66
- data/lib/kodi_client/global_types/files_types.rb +0 -68
- data/lib/kodi_client/global_types/global_types.rb +0 -106
- data/lib/kodi_client/global_types/gui_types.rb +0 -184
- data/lib/kodi_client/global_types/input_types.rb +0 -216
- data/lib/kodi_client/global_types/list_types.rb +0 -548
- data/lib/kodi_client/global_types/media_types.rb +0 -58
- data/lib/kodi_client/global_types/player_type.rb +0 -300
- data/lib/kodi_client/global_types/profiles_types.rb +0 -70
- data/lib/kodi_client/global_types/video_types.rb +0 -155
- data/lib/kodi_client/kodi_module.rb +0 -87
- data/lib/kodi_client/method/audio_library.rb +0 -49
- data/lib/kodi_client/util/comparable.rb +0 -20
- data/lib/kodi_client/util/creatable.rb +0 -106
- data/lib/kodi_client/util/iterable.rb +0 -11
@@ -1,300 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'kodi_client/global_types/item_types'
|
4
|
-
require 'kodi_client/global_types/global_types'
|
5
|
-
require 'kodi_client/util/comparable'
|
6
|
-
require 'kodi_client/util/iterable'
|
7
|
-
require 'kodi_client/util/creatable'
|
8
|
-
|
9
|
-
module KodiClient
|
10
|
-
module Types
|
11
|
-
module Player
|
12
|
-
|
13
|
-
# enum for in/out zoom
|
14
|
-
module Zoom
|
15
|
-
extend Iterable
|
16
|
-
|
17
|
-
IN = 'in'
|
18
|
-
OUT = 'out'
|
19
|
-
end
|
20
|
-
|
21
|
-
# Player.ViewMode https://kodi.wiki/view/JSON-RPC_API/v12#Player.ViewMode
|
22
|
-
module ViewMode
|
23
|
-
extend Iterable
|
24
|
-
|
25
|
-
NORMAL = 'normal'
|
26
|
-
ZOOM = 'zoom'
|
27
|
-
STRETCH_4x3 = 'strech4x3'
|
28
|
-
WIDE_ZOOM = 'widezoom'
|
29
|
-
STRETCH_16x9 = 'stretch16x9'
|
30
|
-
ORIGINAL = 'original'
|
31
|
-
STRETCH_16x9_NONLIN = 'stretch16x9nonline'
|
32
|
-
ZOOM_120_WIDTH = 'zoom120width'
|
33
|
-
ZOOM_110_WIDTH = 'zoom110width'
|
34
|
-
end
|
35
|
-
|
36
|
-
# player types
|
37
|
-
module PlayerVisibilityType
|
38
|
-
extend Iterable
|
39
|
-
|
40
|
-
INTERNAL = 'internal'
|
41
|
-
EXTERNAL = 'external'
|
42
|
-
REMOTE = 'remote'
|
43
|
-
end
|
44
|
-
|
45
|
-
# Player.Type https://kodi.wiki/view/JSON-RPC_API/v12#Player.Type
|
46
|
-
module PlayerType
|
47
|
-
extend Iterable
|
48
|
-
|
49
|
-
VIDEO = 'video'
|
50
|
-
AUDIO = 'audio'
|
51
|
-
PICTURE = 'picture'
|
52
|
-
end
|
53
|
-
|
54
|
-
# Player.Repeat https://kodi.wiki/view/JSON-RPC_API/v12#Player.Repeat
|
55
|
-
module PlayerRepeat
|
56
|
-
extend Iterable
|
57
|
-
|
58
|
-
OFF = 'off'
|
59
|
-
ONE = 'one'
|
60
|
-
ALL = 'all'
|
61
|
-
CYCLE = 'cycle'
|
62
|
-
end
|
63
|
-
|
64
|
-
# player speed enum, -32 to 32
|
65
|
-
module PlayerSpeed
|
66
|
-
extend Iterable
|
67
|
-
|
68
|
-
MINUS_32 = -32
|
69
|
-
MINUS_16 = -16
|
70
|
-
MINUS_8 = -8
|
71
|
-
MINUS_4 = -4
|
72
|
-
MINUS_2 = -2
|
73
|
-
MINUS_1 = -1
|
74
|
-
NEUTRAL = 0
|
75
|
-
PLUS_1 = 1
|
76
|
-
PLUS_2 = 2
|
77
|
-
PLUS_4 = 4
|
78
|
-
PLUS_8 = 8
|
79
|
-
PLUS_16 = 16
|
80
|
-
PLUS_32 = 32
|
81
|
-
end
|
82
|
-
|
83
|
-
# player id and type
|
84
|
-
class Player
|
85
|
-
include Comparable
|
86
|
-
extend Creatable
|
87
|
-
|
88
|
-
attr_reader :player_id, :player_type, :type, :name, :plays_audio, :plays_video
|
89
|
-
|
90
|
-
def initialize(player_id, player_type, type, name, plays_audio, plays_video)
|
91
|
-
@player_id = player_id
|
92
|
-
@player_type = player_type
|
93
|
-
@type = type
|
94
|
-
@name = name
|
95
|
-
@plays_audio = plays_audio
|
96
|
-
@plays_video = plays_video
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
# Player Subtitle https://kodi.wiki/view/JSON-RPC_API/v12#Player.Subtitle
|
101
|
-
class Subtitle
|
102
|
-
include Comparable
|
103
|
-
extend Creatable
|
104
|
-
|
105
|
-
attr_reader :index, :is_default, :is_forced, :is_impaired, :language, :name
|
106
|
-
|
107
|
-
def initialize(index, is_default, is_forced, is_impaired, language, name)
|
108
|
-
@index = index
|
109
|
-
@is_default = is_default
|
110
|
-
@is_forced = is_forced
|
111
|
-
@is_impaired = is_impaired
|
112
|
-
@language = language
|
113
|
-
@name = name
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
# Player.Audio.Stream https://kodi.wiki/view/JSON-RPC_API/v12#Player.Audio.Stream
|
118
|
-
class AudioStream
|
119
|
-
include Comparable
|
120
|
-
extend Creatable
|
121
|
-
|
122
|
-
attr_reader :bitrate, :channels, :codec, :index, :is_default, :is_forced, :is_original, :language,
|
123
|
-
:name, :sample_rate
|
124
|
-
|
125
|
-
def initialize(bitrate, channels, codec, index, is_default, is_forced, is_original, language, name, sample_rate)
|
126
|
-
@bitrate = bitrate
|
127
|
-
@channels = channels
|
128
|
-
@codec = codec
|
129
|
-
@index = index
|
130
|
-
@is_default = is_default
|
131
|
-
@is_forced = is_forced
|
132
|
-
@is_original = is_original
|
133
|
-
@language = language
|
134
|
-
@name = name
|
135
|
-
@sample_rate = sample_rate
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
# Player.Video.Stream https://kodi.wiki/view/JSON-RPC_API/v12#Player.Video.Stream
|
140
|
-
class VideoStream
|
141
|
-
include Comparable
|
142
|
-
extend Creatable
|
143
|
-
|
144
|
-
attr_reader :codec, :height, :index, :language, :name, :width, :duration, :aspect
|
145
|
-
|
146
|
-
def initialize(codec, height, index, language, name, width, duration, aspect)
|
147
|
-
@codec = codec
|
148
|
-
@height = height
|
149
|
-
@index = index
|
150
|
-
@language = language
|
151
|
-
@name = name
|
152
|
-
@width = width
|
153
|
-
@duration = duration
|
154
|
-
@aspect = aspect
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
# Player.Property.Name https://kodi.wiki/view/JSON-RPC_API/v12#Player.Property.Name
|
159
|
-
module PropertyName
|
160
|
-
extend Iterable
|
161
|
-
|
162
|
-
AUDIOSTREAMS = 'audiostreams'
|
163
|
-
CANCHANGESPEED = 'canchangespeed'
|
164
|
-
CANMOVE = 'canmove'
|
165
|
-
CANREPEAT = 'canrepeat'
|
166
|
-
CANROTATE = 'canrotate'
|
167
|
-
CANSEEK = 'canseek'
|
168
|
-
CANSHUFFLE = 'canshuffle'
|
169
|
-
CANZOOM = 'canzoom'
|
170
|
-
CURRENTAUDIOSTREAM = 'currentaudiostream'
|
171
|
-
CURRENTSUBTITLE = 'currentsubtitle'
|
172
|
-
CURRENTVIDEOSTREAM = 'currentvideostream'
|
173
|
-
LIVE = 'live'
|
174
|
-
PARTYMODE = 'partymode'
|
175
|
-
PERCENTAGE = 'percentage'
|
176
|
-
PLAYLISTID = 'playlistid'
|
177
|
-
POSITION = 'position'
|
178
|
-
REPEAT = 'repeat'
|
179
|
-
SHUFFLED = 'shuffled'
|
180
|
-
SPEED = 'speed'
|
181
|
-
SUBTITLEENABLED = 'subtitleenabled'
|
182
|
-
SUBTITLES = 'subtitles'
|
183
|
-
TIME = 'time'
|
184
|
-
TOTALTIME = 'totaltime'
|
185
|
-
TYPE = 'type'
|
186
|
-
VIDEOSTREAMS = 'videostreams'
|
187
|
-
end
|
188
|
-
|
189
|
-
# Player.Property.Value https://kodi.wiki/view/JSON-RPC_API/v12#Player.Property.Name
|
190
|
-
class PropertyValue
|
191
|
-
include Comparable
|
192
|
-
extend Creatable
|
193
|
-
|
194
|
-
attr_reader :audio_streams, :cache_percentage, :can_change_speed, :can_move, :can_repeat, :can_rotate,
|
195
|
-
:can_seek, :can_shuffle, :can_zoom, :current_audio_stream, :current_subtitle, :current_video_stream,
|
196
|
-
:live, :party_mode, :percentage, :playlist_id, :position, :repeat, :shuffled, :speed,
|
197
|
-
:subtitle_enabled, :subtitles, :time, :total_time, :type, :video_streams
|
198
|
-
|
199
|
-
type_mapping ['audiostreams', AudioStream, true], ['currentaudiostream', AudioStream],
|
200
|
-
['currentsubtitle', Subtitle], ['currentvideostream', VideoStream],
|
201
|
-
['subtitles', Subtitle, true], ['time', Global::GlobalTime],
|
202
|
-
['totaltime', Global::GlobalTime], ['videostreams', VideoStream, true]
|
203
|
-
|
204
|
-
def initialize(audio_streams, cache_percentage, can_change_speed, can_move, can_repeat, can_rotate, can_seek,
|
205
|
-
can_shuffle, can_zoom, current_audio_stream, current_subtitle, current_video_stream, live,
|
206
|
-
party_mode, percentage, playlist_id, position, repeat, shuffled, speed,
|
207
|
-
subtitle_enabled, subtitles, time, total_time, type, video_streams)
|
208
|
-
type = type.nil? ? PlayerType::VIDEO : type
|
209
|
-
playlist_id = playlist_id.nil? ? -1 : playlist_id
|
210
|
-
position = position.nil? ? -1 : position
|
211
|
-
repeat = repeat.nil? ? PlayerRepeat::OFF : repeat
|
212
|
-
|
213
|
-
@audio_streams = audio_streams
|
214
|
-
@cache_percentage = cache_percentage
|
215
|
-
@can_change_speed = can_change_speed
|
216
|
-
@can_move = can_move
|
217
|
-
@can_repeat = can_repeat
|
218
|
-
@can_rotate = can_rotate
|
219
|
-
@can_seek = can_seek
|
220
|
-
@can_shuffle = can_shuffle
|
221
|
-
@can_zoom = can_zoom
|
222
|
-
@current_audio_stream = current_audio_stream
|
223
|
-
@current_subtitle = current_subtitle
|
224
|
-
@current_video_stream = current_video_stream
|
225
|
-
@live = live
|
226
|
-
@party_mode = party_mode
|
227
|
-
@percentage = percentage
|
228
|
-
@playlist_id = playlist_id
|
229
|
-
@position = position
|
230
|
-
@repeat = repeat
|
231
|
-
@shuffled = shuffled
|
232
|
-
@speed = speed
|
233
|
-
@subtitle_enabled = subtitle_enabled
|
234
|
-
@subtitles = subtitles
|
235
|
-
@time = time
|
236
|
-
@total_time = total_time
|
237
|
-
@type = type
|
238
|
-
@video_streams = video_streams
|
239
|
-
end
|
240
|
-
end
|
241
|
-
|
242
|
-
# return value for Player.GetViewMode
|
243
|
-
class PlayerViewMode
|
244
|
-
include Comparable
|
245
|
-
extend Creatable
|
246
|
-
|
247
|
-
attr_reader :nonlinear_stretch, :pixel_ratio, :vertical_shift, :view_mode, :zoom
|
248
|
-
|
249
|
-
def initialize(nonlinear_stretch, pixel_ratio, vertical_shift, view_mode, zoom)
|
250
|
-
@nonlinear_stretch = nonlinear_stretch
|
251
|
-
@pixel_ratio = pixel_ratio
|
252
|
-
@vertical_shift = vertical_shift
|
253
|
-
@view_mode = view_mode
|
254
|
-
@zoom = zoom
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
# Player.Position.Time https://kodi.wiki/view/JSON-RPC_API/v12#Player.Position.Time
|
259
|
-
class PlayerPositionTime
|
260
|
-
include Comparable
|
261
|
-
extend Creatable
|
262
|
-
|
263
|
-
attr_reader :hours, :minutes, :seconds, :milliseconds
|
264
|
-
|
265
|
-
def initialize(hours, minutes, seconds, milliseconds)
|
266
|
-
@hours = hours
|
267
|
-
@minutes = minutes
|
268
|
-
@seconds = seconds
|
269
|
-
@milliseconds = milliseconds
|
270
|
-
end
|
271
|
-
end
|
272
|
-
|
273
|
-
# defines the jump size for seek
|
274
|
-
module SeekJump
|
275
|
-
include Iterable
|
276
|
-
|
277
|
-
SMALL_FORWARD = 'smallforward'
|
278
|
-
SMALL_BACKWARD = 'smallbackward'
|
279
|
-
BIG_FORWARD = 'bigforward'
|
280
|
-
BIG_BACKWARD = 'bigbackward'
|
281
|
-
end
|
282
|
-
|
283
|
-
# return value of Player.Seek
|
284
|
-
class SeekReturned
|
285
|
-
include Comparable
|
286
|
-
extend Creatable
|
287
|
-
|
288
|
-
attr_reader :percentage, :time, :total_time
|
289
|
-
|
290
|
-
type_mapping ['time', Global::GlobalTime], ['totaltime', Global::GlobalTime]
|
291
|
-
|
292
|
-
def initialize(percentage, time, total_time)
|
293
|
-
@percentage = percentage
|
294
|
-
@time = time
|
295
|
-
@total_time = total_time
|
296
|
-
end
|
297
|
-
end
|
298
|
-
end
|
299
|
-
end
|
300
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'kodi_client/util/comparable'
|
4
|
-
require 'kodi_client/util/iterable'
|
5
|
-
require 'kodi_client/util/creatable'
|
6
|
-
require 'kodi_client/global_types/item_types'
|
7
|
-
|
8
|
-
module KodiClient
|
9
|
-
module Types
|
10
|
-
module Profiles
|
11
|
-
|
12
|
-
# Profiles.Fields.Profile https://kodi.wiki/view/JSON-RPC_API/v12#Profiles.Fields.Profile
|
13
|
-
module FieldsProfile
|
14
|
-
extend Iterable
|
15
|
-
|
16
|
-
LOCK_MODE = 'lockmode'
|
17
|
-
THUMBNAIL = 'thumbnail'
|
18
|
-
end
|
19
|
-
|
20
|
-
# Profiles.Details.Profile https://kodi.wiki/view/JSON-RPC_API/v12#Profiles.Details.Profile
|
21
|
-
class DetailsProfile
|
22
|
-
include Comparable
|
23
|
-
include Items::ItemDetailsBase
|
24
|
-
extend Creatable
|
25
|
-
|
26
|
-
attr_reader :lock_mode, :thumbnail
|
27
|
-
|
28
|
-
fields_to_map %w[lock_mode thumbnail label]
|
29
|
-
|
30
|
-
def initialize(lock_mode, thumbnail, label)
|
31
|
-
@lock_mode = lock_mode
|
32
|
-
@thumbnail = thumbnail
|
33
|
-
item_details_base(label)
|
34
|
-
end
|
35
|
-
|
36
|
-
def ==(other)
|
37
|
-
compare(self, other)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# return type for Profiles.GetProfiles
|
42
|
-
class GetProfilesReturned
|
43
|
-
include Comparable
|
44
|
-
extend Creatable
|
45
|
-
|
46
|
-
attr_reader :limits, :profiles
|
47
|
-
|
48
|
-
type_mapping ['limits', List::ListLimitsReturned], ['profiles', DetailsProfile, true]
|
49
|
-
|
50
|
-
def initialize(limits, profiles)
|
51
|
-
@limits = limits
|
52
|
-
@profiles = profiles
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
# Profiles.Password https://kodi.wiki/view/JSON-RPC_API/v12#Profiles.Password
|
57
|
-
class ProfilePassword
|
58
|
-
include Comparable
|
59
|
-
extend Creatable
|
60
|
-
|
61
|
-
attr_reader :value, :encryption
|
62
|
-
|
63
|
-
def initialize(value, encryption = Types::Global::PasswordEncryption::MD5)
|
64
|
-
@value = value
|
65
|
-
@encryption = encryption
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,155 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'kodi_client/global_types/media_types'
|
4
|
-
require 'kodi_client/global_types/player_type'
|
5
|
-
require 'kodi_client/util/comparable'
|
6
|
-
require 'kodi_client/util/creatable'
|
7
|
-
|
8
|
-
module KodiClient
|
9
|
-
module Types
|
10
|
-
module Video
|
11
|
-
# Video.Details.Base https://kodi.wiki/view/JSON-RPC_API/v12#Video.Details.Base
|
12
|
-
module VideoDetailsBase
|
13
|
-
include Media::MediaDetailsBase
|
14
|
-
|
15
|
-
attr_reader :art, :play_count
|
16
|
-
|
17
|
-
def video_details_base_mappings
|
18
|
-
media_details_base_mappings
|
19
|
-
end
|
20
|
-
|
21
|
-
def video_details_base_by_hash(hash)
|
22
|
-
video_details_base(*Creatable.hash_to_arr(hash, %w[art play_count fan_art thumbnail label],
|
23
|
-
video_details_base_mappings))
|
24
|
-
end
|
25
|
-
|
26
|
-
def video_details_base(art, play_count, fan_art, thumbnail, label)
|
27
|
-
@art = art
|
28
|
-
@play_count = play_count
|
29
|
-
media_details_base(fan_art, thumbnail, label)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# Video.Cast https://kodi.wiki/view/JSON-RPC_API/v12#Video.Cast
|
34
|
-
class VideoCast
|
35
|
-
include Comparable
|
36
|
-
extend Creatable
|
37
|
-
|
38
|
-
attr_reader :name, :order, :role, :thumbnail
|
39
|
-
|
40
|
-
def initialize(name, order, role, thumbnail)
|
41
|
-
@name = name
|
42
|
-
@order = order
|
43
|
-
@role = role
|
44
|
-
@thumbnail = thumbnail
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# Video.Details.Media https://kodi.wiki/view/JSON-RPC_API/v12#Video.Details.Media
|
49
|
-
module VideoDetailsMedia
|
50
|
-
include VideoDetailsBase
|
51
|
-
|
52
|
-
attr_reader :title
|
53
|
-
|
54
|
-
def video_details_media_mappings
|
55
|
-
video_details_base_mappings
|
56
|
-
end
|
57
|
-
|
58
|
-
def video_details_media_by_hash(hash)
|
59
|
-
video_details_media(*Creatable.hash_to_arr(hash, %w[title art play_count fan_art thumbnail label]),
|
60
|
-
video_details_base_mappings)
|
61
|
-
end
|
62
|
-
|
63
|
-
def video_details_media(title, art, play_count, fan_art, thumbnail, label)
|
64
|
-
@title = title
|
65
|
-
video_details_base(art, play_count, fan_art, thumbnail, label)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
# Video.Details.Item https://kodi.wiki/view/JSON-RPC_API/v12#Video.Details.Item
|
70
|
-
module VideoDetailsItem
|
71
|
-
include VideoDetailsMedia
|
72
|
-
|
73
|
-
attr_reader :date_added, :file, :last_played, :plot
|
74
|
-
|
75
|
-
def video_details_item_mappings
|
76
|
-
video_details_media_mappings
|
77
|
-
end
|
78
|
-
|
79
|
-
def video_details_item_by_hash(hash)
|
80
|
-
video_details_item(*Creatable.hash_to_arr(hash, %w[date_added file last_played plot title art
|
81
|
-
play_count fan_art thumbnail label],
|
82
|
-
video_details_item_mappings))
|
83
|
-
end
|
84
|
-
|
85
|
-
def video_details_item(date_added, file, last_played, plot, title, art, play_count, fan_art, thumbnail, label)
|
86
|
-
@date_added = date_added
|
87
|
-
@file = file
|
88
|
-
@last_played = last_played
|
89
|
-
@plot = plot
|
90
|
-
video_details_media(title, art, play_count, fan_art, thumbnail, label)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
# Video.Details.File https://kodi.wiki/view/JSON-RPC_API/v12#Video.Details.File
|
95
|
-
module VideoDetailsFile
|
96
|
-
include VideoDetailsItem
|
97
|
-
|
98
|
-
attr_reader :director, :resume, :runtime, :stream_details
|
99
|
-
|
100
|
-
def video_details_file_mappings
|
101
|
-
mappings = {
|
102
|
-
'resume' => Creatable::CreateMap.new(VideoResume),
|
103
|
-
'streamdetails' => Creatable::CreateMap.new(Streams)
|
104
|
-
}
|
105
|
-
mappings.merge(video_details_item_mappings)
|
106
|
-
end
|
107
|
-
|
108
|
-
def video_details_file_by_hash(hash)
|
109
|
-
video_details_file(*Creatable.hash_to_arr(hash, %w[director resume runtime stream_details date_added
|
110
|
-
file last_played plot title art play_count fan_art
|
111
|
-
thumbnail label], video_details_file_mappings))
|
112
|
-
end
|
113
|
-
|
114
|
-
def video_details_file(director, resume, runtime, stream_details, date_added, file, last_played, plot, title,
|
115
|
-
art, play_count, fan_art, thumbnail, label)
|
116
|
-
@director = director
|
117
|
-
@resume = resume
|
118
|
-
@runtime = runtime
|
119
|
-
@stream_details = stream_details
|
120
|
-
video_details_item(date_added, file, last_played, plot, title, art, play_count, fan_art, thumbnail, label)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
# Video.Resume https://kodi.wiki/view/JSON-RPC_API/v12#Video.Resume
|
125
|
-
class VideoResume
|
126
|
-
include Comparable
|
127
|
-
extend Creatable
|
128
|
-
|
129
|
-
attr_reader :position, :total
|
130
|
-
|
131
|
-
def initialize(position, total)
|
132
|
-
@position = position
|
133
|
-
@total = total
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
# Video.Streams https://kodi.wiki/view/JSON-RPC_API/v12#Video.Streams
|
138
|
-
class Streams
|
139
|
-
include Comparable
|
140
|
-
extend Creatable
|
141
|
-
|
142
|
-
attr_reader :audio, :subtitle, :video
|
143
|
-
|
144
|
-
type_mapping ['audio', Player::AudioStream, true], ['subtitle', Player::Subtitle, true],
|
145
|
-
['video', Player::VideoStream, true]
|
146
|
-
|
147
|
-
def initialize(audio, subtitle, video)
|
148
|
-
@audio = audio
|
149
|
-
@subtitle = subtitle
|
150
|
-
@video = video
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'http'
|
4
|
-
require 'kodi_client/util/comparable'
|
5
|
-
|
6
|
-
module KodiClient
|
7
|
-
|
8
|
-
# the client that stores
|
9
|
-
class KodiModule
|
10
|
-
|
11
|
-
def apply_options(options)
|
12
|
-
@endpoint_url = "#{options.tls ? 'https://' : 'http://'}#{options.ip}:#{options.port}/jsonrpc"
|
13
|
-
@options = options
|
14
|
-
end
|
15
|
-
|
16
|
-
def invoke_api(request)
|
17
|
-
h = request.instance_variables.each_with_object({}) do |var, hash|
|
18
|
-
hash[var.to_s.delete('@')] = request.instance_variable_get(var)
|
19
|
-
end
|
20
|
-
|
21
|
-
@http_client ||= build_client
|
22
|
-
response = @http_client.post(@endpoint_url, json: h).to_s
|
23
|
-
JSON.parse(response)
|
24
|
-
end
|
25
|
-
|
26
|
-
def build_client
|
27
|
-
client = HTTP.headers(Content_Type: 'application/json')
|
28
|
-
if !@options.username.nil? && !@options.password.nil?
|
29
|
-
client = client.basic_auth({ user: @options.username, pass: @options.password })
|
30
|
-
end
|
31
|
-
|
32
|
-
client
|
33
|
-
end
|
34
|
-
|
35
|
-
private :build_client
|
36
|
-
end
|
37
|
-
|
38
|
-
# represents an error response
|
39
|
-
class KodiError
|
40
|
-
|
41
|
-
attr_reader :code, :message
|
42
|
-
|
43
|
-
def initialize(hash)
|
44
|
-
@code = hash['code']
|
45
|
-
@message = hash['message']
|
46
|
-
end
|
47
|
-
|
48
|
-
def ==(other)
|
49
|
-
@code == other.code && @message == other.message
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# represents a kodi requests
|
54
|
-
class KodiRequest
|
55
|
-
|
56
|
-
attr_accessor :id, :jsonrpc, :method, :params
|
57
|
-
|
58
|
-
def initialize(kodi_id, method, params = {}, jsonrpc = '2.0')
|
59
|
-
@id = kodi_id
|
60
|
-
@jsonrpc = jsonrpc
|
61
|
-
@method = method
|
62
|
-
@params = params
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# represents a kodi response
|
67
|
-
class KodiResponse
|
68
|
-
include Comparable
|
69
|
-
|
70
|
-
attr_reader :id, :jsonrpc, :result, :error
|
71
|
-
|
72
|
-
def initialize(hash)
|
73
|
-
@id = hash['id']
|
74
|
-
@jsonrpc = hash['jsonrpc']
|
75
|
-
@result = hash['result']
|
76
|
-
@error = KodiError.new(hash['error']) unless hash['error'].nil?
|
77
|
-
end
|
78
|
-
|
79
|
-
def error?
|
80
|
-
!@error.nil?
|
81
|
-
end
|
82
|
-
|
83
|
-
def ==(other)
|
84
|
-
compare(self, other)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'kodi_client/kodi_module'
|
4
|
-
require 'kodi_client/global_types/application_types'
|
5
|
-
|
6
|
-
module KodiClient
|
7
|
-
module Modules
|
8
|
-
# contains all Kodi Application methods
|
9
|
-
class AudioLibrary < KodiModule
|
10
|
-
|
11
|
-
CLEAN = 'AudioLibrary.Clean'
|
12
|
-
EXPORT = 'AudioLibrary.Export'
|
13
|
-
GET_ALBUM_DETAILS = 'AudioLibrary.GetAlbumDetails'
|
14
|
-
GET_ALBUMS = 'AudioLibrary.GetAlbums'
|
15
|
-
|
16
|
-
def clean(show_dialogs = true, kodi_id = 1)
|
17
|
-
request = KodiRequest.new(kodi_id, CLEAN, { 'showdialogs' => show_dialogs })
|
18
|
-
json = invoke_api(request)
|
19
|
-
KodiResponse.new(json)
|
20
|
-
end
|
21
|
-
|
22
|
-
def export(path, kodi_id = 1)
|
23
|
-
request = KodiRequest.new(kodi_id, EXPORT, { 'options' => { 'path' => path } })
|
24
|
-
json = invoke_api(request)
|
25
|
-
KodiResponse.new(json)
|
26
|
-
end
|
27
|
-
|
28
|
-
def get_album_details(album_id, properties = Types::Audio::AudioFieldsAlbum.all_properties, kodi_id = 1)
|
29
|
-
request = KodiRequest.new(kodi_id, GET_ALBUM_DETAILS, { 'albumid' => album_id, 'properties' => properties })
|
30
|
-
json = invoke_api(request)
|
31
|
-
KodiResponse.new(json)
|
32
|
-
end
|
33
|
-
|
34
|
-
def get_albums(properties = Types::Audio::AudioFieldsAlbum.all_properties,
|
35
|
-
limits = Types::List::ListLimits.new(0, 50),
|
36
|
-
sort = Types::List::ListSort.new, include_singles = false, all_roles = false, kodi_id = 1)
|
37
|
-
request = KodiRequest.new(kodi_id, GET_ALBUMS,
|
38
|
-
{ 'properties' => properties,
|
39
|
-
'limits' => { 'start' => limits.list_start, 'end' => limits.list_end },
|
40
|
-
'sort' => { 'ignorearticle' => sort.ignore_article, 'method' => sort.method,
|
41
|
-
'order' => sort.order,
|
42
|
-
'useartistsortname' => sort.use_artist_sort_name },
|
43
|
-
'includesingles' => include_singles, 'allroles' => all_roles })
|
44
|
-
json = invoke_api(request)
|
45
|
-
KodiResponse.new(json)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module KodiClient
|
4
|
-
|
5
|
-
# offers compare methods
|
6
|
-
module Comparable
|
7
|
-
def compare(obj1, obj2)
|
8
|
-
is_same = true
|
9
|
-
obj1.instance_variables.each do |it|
|
10
|
-
is_same = false if obj1.instance_variable_get(it) != obj2.instance_variable_get(it)
|
11
|
-
end
|
12
|
-
|
13
|
-
is_same
|
14
|
-
end
|
15
|
-
|
16
|
-
def ==(other)
|
17
|
-
compare(self, other)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|