kodi_client 0.4.5 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/kodi_client.gemspec +5 -2
- data/lib/kodi_client/Chainable.rb +3 -1
- data/lib/kodi_client/global_types/addon_types.rb +60 -48
- data/lib/kodi_client/global_types/application_types.rb +19 -16
- data/lib/kodi_client/global_types/audio_types.rb +41 -30
- data/lib/kodi_client/global_types/favourites_types.rb +18 -17
- data/lib/kodi_client/global_types/global_types.rb +29 -27
- data/lib/kodi_client/global_types/gui_types.rb +21 -15
- data/lib/kodi_client/global_types/input_types.rb +1 -1
- data/lib/kodi_client/global_types/item_types.rb +6 -2
- data/lib/kodi_client/global_types/list_types.rb +256 -89
- data/lib/kodi_client/global_types/media_types.rb +16 -11
- data/lib/kodi_client/global_types/player_type.rb +126 -107
- data/lib/kodi_client/global_types/profiles_types.rb +80 -0
- data/lib/kodi_client/global_types/pvr_type.rb +2 -0
- data/lib/kodi_client/global_types/system_types.rb +36 -0
- data/lib/kodi_client/global_types/video_types.rb +66 -41
- data/lib/kodi_client/kodi_module.rb +1 -0
- data/lib/kodi_client/method/addons.rb +2 -3
- data/lib/kodi_client/method/application.rb +1 -1
- data/lib/kodi_client/method/favourites.rb +1 -1
- data/lib/kodi_client/method/gui.rb +2 -2
- data/lib/kodi_client/method/player.rb +6 -6
- data/lib/kodi_client/method/profiles.rb +48 -0
- data/lib/kodi_client/method/system.rb +58 -0
- data/lib/kodi_client/util/comparable.rb +4 -1
- data/lib/kodi_client/util/creatable.rb +52 -0
- data/lib/kodi_client.rb +10 -8
- metadata +10 -5
@@ -9,8 +9,12 @@ module KodiClient
|
|
9
9
|
|
10
10
|
attr_reader :label
|
11
11
|
|
12
|
-
def
|
13
|
-
|
12
|
+
def item_details_base_by_hash(hash)
|
13
|
+
item_details_base(hash['label'])
|
14
|
+
end
|
15
|
+
|
16
|
+
def item_details_base(label)
|
17
|
+
@label = label
|
14
18
|
end
|
15
19
|
end
|
16
20
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'kodi_client/util/comparable'
|
4
|
+
require 'kodi_client/util/creatable'
|
4
5
|
require 'kodi_client/global_types/video_types'
|
5
6
|
require 'kodi_client/global_types/audio_types'
|
6
7
|
|
@@ -18,26 +19,48 @@ module KodiClient
|
|
18
19
|
@list_start = list_start
|
19
20
|
@list_end = list_end
|
20
21
|
end
|
21
|
-
|
22
|
-
def ==(other)
|
23
|
-
compare(self, other)
|
24
|
-
end
|
25
22
|
end
|
26
23
|
|
27
24
|
# List.LimitsReturned https://kodi.wiki/view/JSON-RPC_API/v12#List.LimitsReturned
|
28
25
|
class ListLimitsReturned
|
29
26
|
include Comparable
|
27
|
+
extend Creatable
|
30
28
|
|
31
29
|
attr_reader :list_start, :list_end, :total
|
32
30
|
|
33
|
-
def
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
def self.create(hash)
|
32
|
+
return nil if hash.nil?
|
33
|
+
|
34
|
+
new(hash['start'], hash['end'], hash['total'])
|
37
35
|
end
|
38
36
|
|
39
|
-
def
|
40
|
-
|
37
|
+
def initialize(list_start, list_end, total)
|
38
|
+
@list_start = list_start
|
39
|
+
@list_end = list_end
|
40
|
+
@total = total
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# ascending/descending for sorting
|
45
|
+
module SortOrder
|
46
|
+
extend Iterable
|
47
|
+
|
48
|
+
ASCENDING = 'ascending'
|
49
|
+
DESCENDING = 'descending'
|
50
|
+
end
|
51
|
+
|
52
|
+
# List.Sort https://kodi.wiki/view/JSON-RPC_API/v12#List.Sort
|
53
|
+
class ListSort
|
54
|
+
include Comparable
|
55
|
+
|
56
|
+
attr_reader :ignore_article, :method, :order, :use_artist_sort_name
|
57
|
+
|
58
|
+
def initialize(ignore_article = false, method = ListSortMethod::NONE,
|
59
|
+
sort_order = SortOrder::ASCENDING, use_artist_sort_name = false)
|
60
|
+
@ignore_article = ignore_article
|
61
|
+
@method = method
|
62
|
+
@order = sort_order
|
63
|
+
@use_artist_sort_name = use_artist_sort_name
|
41
64
|
end
|
42
65
|
end
|
43
66
|
|
@@ -145,75 +168,116 @@ module KodiClient
|
|
145
168
|
:special_sort_season, :studio, :style, :tag, :tag_line, :theme, :top250, :total_discs, :track,
|
146
169
|
:trailer, :tv_show_id, :type, :unique_id, :votes, :watched_episodes, :writer
|
147
170
|
|
148
|
-
def
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
@
|
188
|
-
@
|
189
|
-
@
|
190
|
-
@
|
191
|
-
@
|
192
|
-
@
|
193
|
-
@
|
194
|
-
@
|
195
|
-
@
|
196
|
-
@
|
197
|
-
@
|
198
|
-
@
|
199
|
-
@
|
200
|
-
@
|
201
|
-
@
|
202
|
-
@
|
203
|
-
@
|
204
|
-
@
|
205
|
-
@
|
206
|
-
@
|
207
|
-
@
|
208
|
-
@
|
209
|
-
@
|
210
|
-
@
|
211
|
-
@
|
212
|
-
@
|
213
|
-
@
|
214
|
-
@
|
215
|
-
|
216
|
-
|
171
|
+
def list_item_base_by_hash(hash)
|
172
|
+
cast = Types::Video::VideoCast.create_list(hash['cast'])
|
173
|
+
contributors = Types::Audio::AudioContributor.create_list(hash['contributors'])
|
174
|
+
resume = Types::Video::VideoResume.create(hash['resume'])
|
175
|
+
stream_details = Types::Video::Streams.create(hash['streamdetails'])
|
176
|
+
art = Types::Media::MediaArtwork.create(hash['art'])
|
177
|
+
hash['type'] = 'unknown' if hash['type'].nil?
|
178
|
+
list_item_base(*Creatable.hash_to_arr(hash, %w[album album_artist album_artist_id album_id
|
179
|
+
album_release_type album_status bit_rate bpm]), cast,
|
180
|
+
hash['channels'], hash['comment'], hash['compilation'], contributors,
|
181
|
+
*Creatable.hash_to_arr(hash, %w[country description disc disc_title display_composer
|
182
|
+
display_conductor display_lyricist display_orchestra duration
|
183
|
+
dyn_path episode episode_guide first_aired id imdb_number
|
184
|
+
is_box_set lyrics media_path mood mpaa musicbrainz_artist_id
|
185
|
+
musicbrainz_track_id original_date original_title plot_outline
|
186
|
+
premiered production_code release_date release_type sample_rate
|
187
|
+
season set set_id show_link show_title sort_title
|
188
|
+
special_sort_episode special_sort_season studio style tag
|
189
|
+
tag_line theme top250 total_discs track trailer tv_show_id
|
190
|
+
type unique_id votes watched_episodes writer director]),
|
191
|
+
resume, hash['runtime'], stream_details,
|
192
|
+
*Creatable.hash_to_arr(hash, %w[date_added file last_played plot title]), art,
|
193
|
+
*Creatable.hash_to_arr(hash, %w[play_count fan_art thumbnail label artist artist_id
|
194
|
+
display_artist musicbrainz_album_artist_id rating sort_artist
|
195
|
+
user_rating year genre]))
|
196
|
+
end
|
197
|
+
|
198
|
+
def list_item_base(album, album_artist, album_artist_id, album_id, album_release_type, album_status, bit_rate,
|
199
|
+
bpm, cast, channels, comment, compilation, contributors, country, description, disc,
|
200
|
+
disc_title, display_composer, display_conductor, display_lyricist, display_orchestra,
|
201
|
+
duration, dyn_path, episode, episode_guide, first_aired, id, imdb_number, is_box_set,
|
202
|
+
lyrics, media_path, mood, mpaa, musicbrainz_artist_id, musicbrainz_track_id, original_date,
|
203
|
+
original_title, plot_outline, premiered, production_code, release_date, release_type,
|
204
|
+
sample_rate, season, set, set_id, show_link, show_title, sort_title, special_sort_episode,
|
205
|
+
special_sort_season, studio, style, tag, tag_line, theme, top250, total_discs, track,
|
206
|
+
trailer, tv_show_id, type, unique_id, votes, watched_episodes, writer, director, resume,
|
207
|
+
runtime, stream_details, date_added, file, last_played, plot, title, art, play_count,
|
208
|
+
fan_art, thumbnail, label, artist, artist_id, display_artist, musicbrainz_album_artist_id,
|
209
|
+
rating, sort_artist, user_rating, year, genre)
|
210
|
+
@album = album
|
211
|
+
@album_artist = album_artist
|
212
|
+
@album_artist_id = album_artist_id
|
213
|
+
@album_id = album_id
|
214
|
+
@album_release_type = album_release_type
|
215
|
+
@album_status = album_status
|
216
|
+
@bit_rate = bit_rate
|
217
|
+
@bpm = bpm
|
218
|
+
@cast = cast
|
219
|
+
@channels = channels
|
220
|
+
@comment = comment
|
221
|
+
@compilation = compilation
|
222
|
+
@contributors = contributors
|
223
|
+
@country = country
|
224
|
+
@description = description
|
225
|
+
@disc = disc
|
226
|
+
@disc_title = disc_title
|
227
|
+
@display_composer = display_composer
|
228
|
+
@display_conductor = display_conductor
|
229
|
+
@display_lyricist = display_lyricist
|
230
|
+
@display_orchestra = display_orchestra
|
231
|
+
@duration = duration
|
232
|
+
@dyn_path = dyn_path
|
233
|
+
@episode = episode
|
234
|
+
@episode_guide = episode_guide
|
235
|
+
@first_aired = first_aired
|
236
|
+
@id = id
|
237
|
+
@imdb_number = imdb_number
|
238
|
+
@is_box_set = is_box_set
|
239
|
+
@lyrics = lyrics
|
240
|
+
@media_path = media_path
|
241
|
+
@mood = mood
|
242
|
+
@mpaa = mpaa
|
243
|
+
@musicbrainz_artist_id = musicbrainz_artist_id
|
244
|
+
@musicbrainz_track_id = musicbrainz_track_id
|
245
|
+
@original_date = original_date
|
246
|
+
@original_title = original_title
|
247
|
+
@plot_outline = plot_outline
|
248
|
+
@premiered = premiered
|
249
|
+
@production_code = production_code
|
250
|
+
@release_date = release_date
|
251
|
+
@release_type = release_type
|
252
|
+
@sample_rate = sample_rate
|
253
|
+
@season = season
|
254
|
+
@set = set
|
255
|
+
@set_id = set_id
|
256
|
+
@show_link = show_link
|
257
|
+
@show_title = show_title
|
258
|
+
@sort_title = sort_title
|
259
|
+
@special_sort_episode = special_sort_episode
|
260
|
+
@special_sort_season = special_sort_season
|
261
|
+
@studio = studio
|
262
|
+
@style = style
|
263
|
+
@tag = tag
|
264
|
+
@tag_line = tag_line
|
265
|
+
@theme = theme
|
266
|
+
@top250 = top250
|
267
|
+
@total_discs = total_discs
|
268
|
+
@track = track
|
269
|
+
@trailer = trailer
|
270
|
+
@tv_show_id = tv_show_id
|
271
|
+
@type = type
|
272
|
+
@unique_id = unique_id
|
273
|
+
@votes = votes
|
274
|
+
@watched_episodes = watched_episodes
|
275
|
+
@writer = writer
|
276
|
+
video_details_file(director, resume, runtime, stream_details, date_added, file, last_played, plot, title,
|
277
|
+
art, play_count, fan_art, thumbnail, label)
|
278
|
+
audio_details_media(artist, artist_id, display_artist, musicbrainz_album_artist_id, original_date, rating,
|
279
|
+
release_date, sort_artist, title, user_rating, votes, year, art, date_added, genre,
|
280
|
+
fan_art, thumbnail, label)
|
217
281
|
end
|
218
282
|
end
|
219
283
|
|
@@ -221,26 +285,129 @@ module KodiClient
|
|
221
285
|
class ListItemAll
|
222
286
|
include ListItemBase
|
223
287
|
include Comparable
|
288
|
+
extend Creatable
|
224
289
|
|
225
290
|
attr_reader :channel, :channel_number, :channel_type, :end_time, :hidden, :locked, :start_time,
|
226
291
|
:sub_channel_number
|
227
292
|
|
228
|
-
def
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
293
|
+
def self.create(hash)
|
294
|
+
return nil if hash.nil?
|
295
|
+
|
296
|
+
cast = Types::Video::VideoCast.create_list(hash['cast'])
|
297
|
+
contributors = Types::Audio::AudioContributor.create_list(hash['contributors'])
|
298
|
+
resume = Types::Video::VideoResume.create(hash['resume'])
|
299
|
+
stream_details = Types::Video::Streams.create(hash['streamdetails'])
|
300
|
+
art = Types::Media::MediaArtwork.create(hash['art'])
|
301
|
+
hash['type'] = 'unknown' if hash['type'].nil?
|
302
|
+
new(*Creatable.hash_to_arr(hash, %w[channel channel_number channel_type end_time hidden locked start_time
|
303
|
+
sub_channel_number album album_artist album_artist_id album_id
|
304
|
+
album_release_type album_status bit_rate bpm]), cast,
|
305
|
+
hash['channels'], hash['comment'], hash['compilation'], contributors,
|
306
|
+
*Creatable.hash_to_arr(hash, %w[country description disc disc_title display_composer
|
307
|
+
display_conductor display_lyricist display_orchestra duration
|
308
|
+
dyn_path episode episode_guide first_aired id imdb_number
|
309
|
+
is_box_set lyrics media_path mood mpaa musicbrainz_artist_id
|
310
|
+
musicbrainz_track_id original_date original_title plot_outline
|
311
|
+
premiered production_code release_date release_type sample_rate
|
312
|
+
season set set_id show_link show_title sort_title
|
313
|
+
special_sort_episode special_sort_season studio style tag
|
314
|
+
tag_line theme top250 total_discs track trailer tv_show_id
|
315
|
+
type unique_id votes watched_episodes writer director]),
|
316
|
+
resume, hash['runtime'], stream_details,
|
317
|
+
*Creatable.hash_to_arr(hash, %w[date_added file last_played plot title]), art,
|
318
|
+
*Creatable.hash_to_arr(hash, %w[play_count fan_art thumbnail label artist artist_id
|
319
|
+
display_artist musicbrainz_album_artist_id rating sort_artist
|
320
|
+
user_rating year genre]))
|
321
|
+
end
|
322
|
+
|
323
|
+
def initialize(channel, channel_number, channel_type, end_time, hidden, locked, start_time, sub_channel_number,
|
324
|
+
album, album_artist, album_artist_id, album_id, album_release_type, album_status, bit_rate,
|
325
|
+
bpm, cast, channels, comment, compilation, contributors, country, description, disc,
|
326
|
+
disc_title, display_composer, display_conductor, display_lyricist, display_orchestra,
|
327
|
+
duration, dyn_path, episode, episode_guide, first_aired, id, imdb_number, is_box_set,
|
328
|
+
lyrics, media_path, mood, mpaa, musicbrainz_artist_id, musicbrainz_track_id, original_date,
|
329
|
+
original_title, plot_outline, premiered, production_code, release_date, release_type,
|
330
|
+
sample_rate, season, set, set_id, show_link, show_title, sort_title, special_sort_episode,
|
331
|
+
special_sort_season, studio, style, tag, tag_line, theme, top250, total_discs, track,
|
332
|
+
trailer, tv_show_id, type, unique_id, votes, watched_episodes, writer, director, resume,
|
333
|
+
runtime, stream_details, date_added, file, last_played, plot, title, art, play_count,
|
334
|
+
fan_art, thumbnail, label, artist, artist_id, display_artist, musicbrainz_album_artist_id,
|
335
|
+
rating, sort_artist, user_rating, year, genre)
|
336
|
+
|
337
|
+
@channel = channel
|
338
|
+
@channel_number = channel_number
|
339
|
+
@channel_type = channel_type
|
340
|
+
@end_time = end_time
|
341
|
+
@hidden = hidden
|
342
|
+
@locked = locked
|
343
|
+
@start_time = start_time
|
344
|
+
@sub_channel_number = sub_channel_number
|
345
|
+
|
346
|
+
list_item_base(album, album_artist, album_artist_id, album_id, album_release_type, album_status, bit_rate,
|
347
|
+
bpm, cast, channels, comment, compilation, contributors, country, description, disc,
|
348
|
+
disc_title, display_composer, display_conductor, display_lyricist, display_orchestra,
|
349
|
+
duration, dyn_path, episode, episode_guide, first_aired, id, imdb_number, is_box_set,
|
350
|
+
lyrics, media_path, mood, mpaa, musicbrainz_artist_id, musicbrainz_track_id, original_date,
|
351
|
+
original_title, plot_outline, premiered, production_code, release_date, release_type,
|
352
|
+
sample_rate, season, set, set_id, show_link, show_title, sort_title, special_sort_episode,
|
353
|
+
special_sort_season, studio, style, tag, tag_line, theme, top250, total_discs, track,
|
354
|
+
trailer, tv_show_id, type, unique_id, votes, watched_episodes, writer, director, resume,
|
355
|
+
runtime, stream_details, date_added, file, last_played, plot, title, art, play_count,
|
356
|
+
fan_art, thumbnail, label, artist, artist_id, display_artist, musicbrainz_album_artist_id,
|
357
|
+
rating, sort_artist, user_rating, year, genre)
|
238
358
|
end
|
239
359
|
|
240
360
|
def ==(other)
|
241
361
|
compare(self, other)
|
242
362
|
end
|
243
363
|
end
|
364
|
+
|
365
|
+
# methods for list sorting
|
366
|
+
module ListSortMethod
|
367
|
+
extend Iterable
|
368
|
+
|
369
|
+
NONE = 'none'
|
370
|
+
LABEL = 'label'
|
371
|
+
DATE = 'date'
|
372
|
+
SIZE = 'size'
|
373
|
+
FILE = 'file'
|
374
|
+
PATH = 'path'
|
375
|
+
DRIVE_TYPE = 'drivetype'
|
376
|
+
TITLE = 'title'
|
377
|
+
TRACK = 'track'
|
378
|
+
TIME = 'time'
|
379
|
+
ARTIST = 'artist'
|
380
|
+
ALBUM = 'album'
|
381
|
+
ALBUM_TYPE = 'albumtype'
|
382
|
+
GENRE = 'genre'
|
383
|
+
COUNTRY = 'country'
|
384
|
+
YEAR = 'year'
|
385
|
+
RATING = 'rating'
|
386
|
+
USER_RATING = 'userrating'
|
387
|
+
VOTES = 'votes'
|
388
|
+
TOP_250 = 'top250'
|
389
|
+
PROGRAM_COUNT = 'programcount'
|
390
|
+
PLAYLIST = 'playlist'
|
391
|
+
EPISODE = 'episode'
|
392
|
+
SEASON = 'season'
|
393
|
+
TOTAL_EPISODES = 'totalepisodes'
|
394
|
+
WATCHED_EPISODES = 'watchedepisodes'
|
395
|
+
TV_SHOW_STATUS = 'tvshowstatus'
|
396
|
+
TV_SHOW_TITLE = 'tvshowtitle'
|
397
|
+
SORT_TITLE = 'sorttitle'
|
398
|
+
PRODUCTION_CODE = 'productioncode'
|
399
|
+
MPAA = 'mpaa'
|
400
|
+
STUDIO = 'studio'
|
401
|
+
DATE_ADDED = 'dateadded'
|
402
|
+
LAST_PLAYED = 'lastplayed'
|
403
|
+
PLAY_COUNT = 'playcount'
|
404
|
+
LISTENERS = 'listeners'
|
405
|
+
BITRATE = 'bitrate'
|
406
|
+
RANDOM = 'random'
|
407
|
+
TOTAL_DISCS = 'totaldiscs'
|
408
|
+
ORIGINAL_DATE = 'originaldate'
|
409
|
+
BPM = 'bpm'
|
410
|
+
end
|
244
411
|
end
|
245
412
|
end
|
246
413
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'kodi_client/global_types/item_types'
|
4
4
|
require 'kodi_client/util/comparable'
|
5
|
+
require 'kodi_client/util/creatable'
|
5
6
|
|
6
7
|
module KodiClient
|
7
8
|
module Types
|
@@ -10,6 +11,7 @@ module KodiClient
|
|
10
11
|
# media types
|
11
12
|
module MediaType
|
12
13
|
extend Iterable
|
14
|
+
|
13
15
|
VIDEO = 'video'
|
14
16
|
AUDIO = 'audio'
|
15
17
|
ALL = 'all'
|
@@ -21,28 +23,31 @@ module KodiClient
|
|
21
23
|
|
22
24
|
attr_reader :fan_art, :thumbnail
|
23
25
|
|
24
|
-
def
|
26
|
+
def media_details_base_by_hash(hash)
|
25
27
|
@fan_art = hash['fanart']
|
26
28
|
@thumbnail = hash['thumbnail']
|
27
|
-
|
29
|
+
item_details_base_by_hash(hash)
|
30
|
+
end
|
31
|
+
|
32
|
+
def media_details_base(fan_art, thumbnail, label)
|
33
|
+
@fan_art = fan_art
|
34
|
+
@thumbnail = thumbnail
|
35
|
+
item_details_base(label)
|
28
36
|
end
|
29
37
|
end
|
30
38
|
|
31
39
|
# Media.Artwork https://kodi.wiki/view/JSON-RPC_API/v12#Media.Artwork
|
32
40
|
class MediaArtwork
|
33
41
|
include Comparable
|
42
|
+
extend Creatable
|
34
43
|
|
35
44
|
attr_reader :banner, :fan_art, :poster, :thumb
|
36
45
|
|
37
|
-
def initialize(
|
38
|
-
@banner =
|
39
|
-
@fan_art =
|
40
|
-
@poster =
|
41
|
-
@thumb =
|
42
|
-
end
|
43
|
-
|
44
|
-
def ==(other)
|
45
|
-
compare(self, other)
|
46
|
+
def initialize(banner, fan_art, poster, thumb)
|
47
|
+
@banner = banner
|
48
|
+
@fan_art = fan_art
|
49
|
+
@poster = poster
|
50
|
+
@thumb = thumb
|
46
51
|
end
|
47
52
|
end
|
48
53
|
end
|