kodi_client 0.5.0 → 0.6.0
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/files_types.rb +82 -0
- 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 +414 -91
- 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 +6 -9
- data/lib/kodi_client/global_types/video_types.rb +68 -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/files.rb +89 -0
- 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 +1 -1
- data/lib/kodi_client/util/comparable.rb +4 -1
- data/lib/kodi_client/util/creatable.rb +52 -0
- data/lib/kodi_client.rb +10 -9
- metadata +10 -5
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'kodi_client/global_types/global_types'
|
4
4
|
require 'kodi_client/util/comparable'
|
5
5
|
require 'kodi_client/util/iterable'
|
6
|
+
require 'kodi_client/util/creatable'
|
6
7
|
|
7
8
|
module KodiClient
|
8
9
|
module Types
|
@@ -10,6 +11,7 @@ module KodiClient
|
|
10
11
|
|
11
12
|
# GUI.Window https://kodi.wiki/view/JSON-RPC_API/v12#GUI.Window
|
12
13
|
module GUIWindow
|
14
|
+
extend Iterable
|
13
15
|
|
14
16
|
ACCESSPOINTS = 'accesspoints'
|
15
17
|
ADDON = 'addon'
|
@@ -139,6 +141,7 @@ module KodiClient
|
|
139
141
|
class StereoscopyMode
|
140
142
|
include Comparable
|
141
143
|
include Iterable
|
144
|
+
extend Creatable
|
142
145
|
|
143
146
|
attr_reader :label, :mode
|
144
147
|
|
@@ -152,32 +155,35 @@ module KodiClient
|
|
152
155
|
ANAGLYPH_YELLOW_BLUE = 'anaglyph_yellow_blue'
|
153
156
|
MONSCOPIC = 'monoscopic'
|
154
157
|
|
155
|
-
def initialize(
|
156
|
-
@label =
|
157
|
-
@mode =
|
158
|
-
end
|
159
|
-
|
160
|
-
def ==(other)
|
161
|
-
compare(self, other)
|
158
|
+
def initialize(label, mode)
|
159
|
+
@label = label
|
160
|
+
@mode = mode
|
162
161
|
end
|
163
162
|
end
|
164
163
|
|
165
164
|
# GUI.Property.Value https://kodi.wiki/view/JSON-RPC_API/v12#GUI.Property.Value
|
166
165
|
class PropertyValue
|
167
166
|
include Comparable
|
167
|
+
extend Creatable
|
168
168
|
|
169
169
|
attr_reader :current_control, :current_window, :fullscreen, :skin, :stereoscopic_mode
|
170
170
|
|
171
|
-
def
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
171
|
+
def self.create(hash)
|
172
|
+
return nil if hash.nil?
|
173
|
+
|
174
|
+
current_control = Global::IdLabel.create(hash['currentcontrol'])
|
175
|
+
current_window = Global::IdLabel.create(hash['currentwindow'])
|
176
|
+
skin = Global::IdName.create(hash['skin'])
|
177
|
+
stereoscopic_mode = StereoscopyMode.create(hash['stereoscopicmode'])
|
178
|
+
new(current_control, current_window, hash['fullscreen'], skin, stereoscopic_mode)
|
177
179
|
end
|
178
180
|
|
179
|
-
def
|
180
|
-
|
181
|
+
def initialize(current_control, current_window, fullscreen, skin, stereoscopic_mode)
|
182
|
+
@current_control = current_control
|
183
|
+
@current_window = current_window
|
184
|
+
@fullscreen = fullscreen
|
185
|
+
@skin = skin
|
186
|
+
@stereoscopic_mode = stereoscopic_mode
|
181
187
|
end
|
182
188
|
end
|
183
189
|
end
|
@@ -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'])
|
35
|
+
end
|
36
|
+
|
37
|
+
def initialize(list_start, list_end, total)
|
38
|
+
@list_start = list_start
|
39
|
+
@list_end = list_end
|
40
|
+
@total = total
|
37
41
|
end
|
42
|
+
end
|
38
43
|
|
39
|
-
|
40
|
-
|
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
|
|
@@ -130,6 +153,95 @@ module KodiClient
|
|
130
153
|
YEAR = 'year'
|
131
154
|
end
|
132
155
|
|
156
|
+
# List.Fields.Files https://kodi.wiki/view/JSON-RPC_API/v12#List.Fields.Files
|
157
|
+
module ListFieldFiles
|
158
|
+
extend Iterable
|
159
|
+
|
160
|
+
ALBUM = 'album'
|
161
|
+
ALBUMARTIST = 'albumartist'
|
162
|
+
ALBUMARTISTID = 'albumartistid'
|
163
|
+
ALBUMID = 'albumid'
|
164
|
+
ALBUMLABEL = 'albumlabel'
|
165
|
+
ART = 'art'
|
166
|
+
ARTIST = 'artist'
|
167
|
+
ARTISTID = 'artistid'
|
168
|
+
CAST = 'cast'
|
169
|
+
COMMENT = 'comment'
|
170
|
+
COUNTRY = 'country'
|
171
|
+
DATEADDED = 'dateadded'
|
172
|
+
DESCRIPTION = 'description'
|
173
|
+
DIRECTOR = 'director'
|
174
|
+
DISC = 'disc'
|
175
|
+
DISPLAYARTIST = 'displayartist'
|
176
|
+
DURATION = 'duration'
|
177
|
+
EPISODE = 'episode'
|
178
|
+
EPISODEGUIDE = 'episodeguide'
|
179
|
+
FANART = 'fanart'
|
180
|
+
FILE = 'file'
|
181
|
+
FIRSTAIRED = 'firstaired'
|
182
|
+
GENRE = 'genre'
|
183
|
+
GENREID = 'genreid'
|
184
|
+
IMDBNUMBER = 'imdbnumber'
|
185
|
+
LASTMODIFIED = 'lastmodified'
|
186
|
+
LASTPLAYED = 'lastplayed'
|
187
|
+
LYRICS = 'lyrics'
|
188
|
+
MIMETYPE = 'mimetype'
|
189
|
+
MOOD = 'mood'
|
190
|
+
MPAA = 'mpaa'
|
191
|
+
MUSICBRAINZALBUMARTISTID = 'musicbrainzalbumartistid'
|
192
|
+
MUSICBRAINZALBUMID = 'musicbrainzalbumid'
|
193
|
+
MUSICBRAINZARTISTID = 'musicbrainzartistid'
|
194
|
+
MUSICBRAINZTRACKID = 'musicbrainztrackid'
|
195
|
+
ORIGINALTITLE = 'originaltitle'
|
196
|
+
PLAYCOUNT = 'playcount'
|
197
|
+
PLOT = 'plot'
|
198
|
+
PLOTOUTLINE = 'plotoutline'
|
199
|
+
PREMIERED = 'premiered'
|
200
|
+
PRODUCTIONCODE = 'productioncode'
|
201
|
+
RATING = 'rating'
|
202
|
+
RESUME = 'resume'
|
203
|
+
RUNTIME = 'runtime'
|
204
|
+
SEASON = 'season'
|
205
|
+
SET = 'set'
|
206
|
+
SETID = 'setid'
|
207
|
+
SHOWLINK = 'showlink'
|
208
|
+
SHOWTITLE = 'showtitle'
|
209
|
+
SIZE = 'size'
|
210
|
+
SORTTITLE = 'sorttitle'
|
211
|
+
SPECIALSORTEPISODE = 'specialsortepisode'
|
212
|
+
SPECIALSORTSEASON = 'specialsortseason'
|
213
|
+
STREAMDETAILS = 'streamdetails'
|
214
|
+
STUDIO = 'studio'
|
215
|
+
STYLE = 'style'
|
216
|
+
TAG = 'tag'
|
217
|
+
TAGLINE = 'tagline'
|
218
|
+
THEME = 'theme'
|
219
|
+
THUMBNAIL = 'thumbnail'
|
220
|
+
TITLE = 'title'
|
221
|
+
TOP250 = 'top250'
|
222
|
+
TRACK = 'track'
|
223
|
+
TRAILER = 'trailer'
|
224
|
+
TVSHOWID = 'tvshowid'
|
225
|
+
UNIQUEID = 'uniqueid'
|
226
|
+
VOTES = 'votes'
|
227
|
+
WATCHEDEPISODES = 'watchedepisodes'
|
228
|
+
WRITER = 'writer'
|
229
|
+
YEAR = 'year'
|
230
|
+
end
|
231
|
+
|
232
|
+
# File/Label tuple
|
233
|
+
class FileLabel
|
234
|
+
include Comparable
|
235
|
+
extend Creatable
|
236
|
+
|
237
|
+
attr_reader :file, :label
|
238
|
+
|
239
|
+
def initialize(file, label)
|
240
|
+
@file = file
|
241
|
+
@label = label
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
133
245
|
# List.Item.Base https://kodi.wiki/view/JSON-RPC_API/v12#List.Item.Base
|
134
246
|
module ListItemBase
|
135
247
|
include Video::VideoDetailsFile
|
@@ -145,75 +257,116 @@ module KodiClient
|
|
145
257
|
:special_sort_season, :studio, :style, :tag, :tag_line, :theme, :top250, :total_discs, :track,
|
146
258
|
:trailer, :tv_show_id, :type, :unique_id, :votes, :watched_episodes, :writer
|
147
259
|
|
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
|
-
|
260
|
+
def list_item_base_by_hash(hash)
|
261
|
+
cast = Types::Video::VideoCast.create_list(hash['cast'])
|
262
|
+
contributors = Types::Audio::AudioContributor.create_list(hash['contributors'])
|
263
|
+
resume = Types::Video::VideoResume.create(hash['resume'])
|
264
|
+
stream_details = Types::Video::Streams.create(hash['streamdetails'])
|
265
|
+
art = Types::Media::MediaArtwork.create(hash['art'])
|
266
|
+
hash['type'] = 'unknown' if hash['type'].nil?
|
267
|
+
list_item_base(*Creatable.hash_to_arr(hash, %w[album album_artist album_artist_id album_id
|
268
|
+
album_release_type album_status bit_rate bpm]), cast,
|
269
|
+
hash['channels'], hash['comment'], hash['compilation'], contributors,
|
270
|
+
*Creatable.hash_to_arr(hash, %w[country description disc disc_title display_composer
|
271
|
+
display_conductor display_lyricist display_orchestra duration
|
272
|
+
dyn_path episode episode_guide first_aired id imdb_number
|
273
|
+
is_box_set lyrics media_path mood mpaa musicbrainz_artist_id
|
274
|
+
musicbrainz_track_id original_date original_title plot_outline
|
275
|
+
premiered production_code release_date release_type sample_rate
|
276
|
+
season set set_id show_link show_title sort_title
|
277
|
+
special_sort_episode special_sort_season studio style tag
|
278
|
+
tag_line theme top250 total_discs track trailer tv_show_id
|
279
|
+
type unique_id votes watched_episodes writer director]),
|
280
|
+
resume, hash['runtime'], stream_details,
|
281
|
+
*Creatable.hash_to_arr(hash, %w[date_added file last_played plot title]), art,
|
282
|
+
*Creatable.hash_to_arr(hash, %w[play_count fan_art thumbnail label artist artist_id
|
283
|
+
display_artist musicbrainz_album_artist_id rating sort_artist
|
284
|
+
user_rating year genre]))
|
285
|
+
end
|
286
|
+
|
287
|
+
def list_item_base(album, album_artist, album_artist_id, album_id, album_release_type, album_status, bit_rate,
|
288
|
+
bpm, cast, channels, comment, compilation, contributors, country, description, disc,
|
289
|
+
disc_title, display_composer, display_conductor, display_lyricist, display_orchestra,
|
290
|
+
duration, dyn_path, episode, episode_guide, first_aired, id, imdb_number, is_box_set,
|
291
|
+
lyrics, media_path, mood, mpaa, musicbrainz_artist_id, musicbrainz_track_id, original_date,
|
292
|
+
original_title, plot_outline, premiered, production_code, release_date, release_type,
|
293
|
+
sample_rate, season, set, set_id, show_link, show_title, sort_title, special_sort_episode,
|
294
|
+
special_sort_season, studio, style, tag, tag_line, theme, top250, total_discs, track,
|
295
|
+
trailer, tv_show_id, type, unique_id, votes, watched_episodes, writer, director, resume,
|
296
|
+
runtime, stream_details, date_added, file, last_played, plot, title, art, play_count,
|
297
|
+
fan_art, thumbnail, label, artist, artist_id, display_artist, musicbrainz_album_artist_id,
|
298
|
+
rating, sort_artist, user_rating, year, genre)
|
299
|
+
@album = album
|
300
|
+
@album_artist = album_artist
|
301
|
+
@album_artist_id = album_artist_id
|
302
|
+
@album_id = album_id
|
303
|
+
@album_release_type = album_release_type
|
304
|
+
@album_status = album_status
|
305
|
+
@bit_rate = bit_rate
|
306
|
+
@bpm = bpm
|
307
|
+
@cast = cast
|
308
|
+
@channels = channels
|
309
|
+
@comment = comment
|
310
|
+
@compilation = compilation
|
311
|
+
@contributors = contributors
|
312
|
+
@country = country
|
313
|
+
@description = description
|
314
|
+
@disc = disc
|
315
|
+
@disc_title = disc_title
|
316
|
+
@display_composer = display_composer
|
317
|
+
@display_conductor = display_conductor
|
318
|
+
@display_lyricist = display_lyricist
|
319
|
+
@display_orchestra = display_orchestra
|
320
|
+
@duration = duration
|
321
|
+
@dyn_path = dyn_path
|
322
|
+
@episode = episode
|
323
|
+
@episode_guide = episode_guide
|
324
|
+
@first_aired = first_aired
|
325
|
+
@id = id
|
326
|
+
@imdb_number = imdb_number
|
327
|
+
@is_box_set = is_box_set
|
328
|
+
@lyrics = lyrics
|
329
|
+
@media_path = media_path
|
330
|
+
@mood = mood
|
331
|
+
@mpaa = mpaa
|
332
|
+
@musicbrainz_artist_id = musicbrainz_artist_id
|
333
|
+
@musicbrainz_track_id = musicbrainz_track_id
|
334
|
+
@original_date = original_date
|
335
|
+
@original_title = original_title
|
336
|
+
@plot_outline = plot_outline
|
337
|
+
@premiered = premiered
|
338
|
+
@production_code = production_code
|
339
|
+
@release_date = release_date
|
340
|
+
@release_type = release_type
|
341
|
+
@sample_rate = sample_rate
|
342
|
+
@season = season
|
343
|
+
@set = set
|
344
|
+
@set_id = set_id
|
345
|
+
@show_link = show_link
|
346
|
+
@show_title = show_title
|
347
|
+
@sort_title = sort_title
|
348
|
+
@special_sort_episode = special_sort_episode
|
349
|
+
@special_sort_season = special_sort_season
|
350
|
+
@studio = studio
|
351
|
+
@style = style
|
352
|
+
@tag = tag
|
353
|
+
@tag_line = tag_line
|
354
|
+
@theme = theme
|
355
|
+
@top250 = top250
|
356
|
+
@total_discs = total_discs
|
357
|
+
@track = track
|
358
|
+
@trailer = trailer
|
359
|
+
@tv_show_id = tv_show_id
|
360
|
+
@type = type
|
361
|
+
@unique_id = unique_id
|
362
|
+
@votes = votes
|
363
|
+
@watched_episodes = watched_episodes
|
364
|
+
@writer = writer
|
365
|
+
video_details_file(director, resume, runtime, stream_details, date_added, file, last_played, plot, title,
|
366
|
+
art, play_count, fan_art, thumbnail, label)
|
367
|
+
audio_details_media(artist, artist_id, display_artist, musicbrainz_album_artist_id, original_date, rating,
|
368
|
+
release_date, sort_artist, title, user_rating, votes, year, art, date_added, genre,
|
369
|
+
fan_art, thumbnail, label)
|
217
370
|
end
|
218
371
|
end
|
219
372
|
|
@@ -221,26 +374,196 @@ module KodiClient
|
|
221
374
|
class ListItemAll
|
222
375
|
include ListItemBase
|
223
376
|
include Comparable
|
377
|
+
extend Creatable
|
224
378
|
|
225
379
|
attr_reader :channel, :channel_number, :channel_type, :end_time, :hidden, :locked, :start_time,
|
226
380
|
:sub_channel_number
|
227
381
|
|
228
|
-
def
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
382
|
+
def self.create(hash)
|
383
|
+
return nil if hash.nil?
|
384
|
+
|
385
|
+
cast = Types::Video::VideoCast.create_list(hash['cast'])
|
386
|
+
contributors = Types::Audio::AudioContributor.create_list(hash['contributors'])
|
387
|
+
resume = Types::Video::VideoResume.create(hash['resume'])
|
388
|
+
stream_details = Types::Video::Streams.create(hash['streamdetails'])
|
389
|
+
art = Types::Media::MediaArtwork.create(hash['art'])
|
390
|
+
hash['type'] = 'unknown' if hash['type'].nil?
|
391
|
+
new(*Creatable.hash_to_arr(hash, %w[channel channel_number channel_type end_time hidden locked start_time
|
392
|
+
sub_channel_number album album_artist album_artist_id album_id
|
393
|
+
album_release_type album_status bit_rate bpm]), cast,
|
394
|
+
hash['channels'], hash['comment'], hash['compilation'], contributors,
|
395
|
+
*Creatable.hash_to_arr(hash, %w[country description disc disc_title display_composer
|
396
|
+
display_conductor display_lyricist display_orchestra duration
|
397
|
+
dyn_path episode episode_guide first_aired id imdb_number
|
398
|
+
is_box_set lyrics media_path mood mpaa musicbrainz_artist_id
|
399
|
+
musicbrainz_track_id original_date original_title plot_outline
|
400
|
+
premiered production_code release_date release_type sample_rate
|
401
|
+
season set set_id show_link show_title sort_title
|
402
|
+
special_sort_episode special_sort_season studio style tag
|
403
|
+
tag_line theme top250 total_discs track trailer tv_show_id
|
404
|
+
type unique_id votes watched_episodes writer director]),
|
405
|
+
resume, hash['runtime'], stream_details,
|
406
|
+
*Creatable.hash_to_arr(hash, %w[date_added file last_played plot title]), art,
|
407
|
+
*Creatable.hash_to_arr(hash, %w[play_count fan_art thumbnail label artist artist_id
|
408
|
+
display_artist musicbrainz_album_artist_id rating sort_artist
|
409
|
+
user_rating year genre]))
|
410
|
+
end
|
411
|
+
|
412
|
+
def initialize(channel, channel_number, channel_type, end_time, hidden, locked, start_time, sub_channel_number,
|
413
|
+
album, album_artist, album_artist_id, album_id, album_release_type, album_status, bit_rate,
|
414
|
+
bpm, cast, channels, comment, compilation, contributors, country, description, disc,
|
415
|
+
disc_title, display_composer, display_conductor, display_lyricist, display_orchestra,
|
416
|
+
duration, dyn_path, episode, episode_guide, first_aired, id, imdb_number, is_box_set,
|
417
|
+
lyrics, media_path, mood, mpaa, musicbrainz_artist_id, musicbrainz_track_id, original_date,
|
418
|
+
original_title, plot_outline, premiered, production_code, release_date, release_type,
|
419
|
+
sample_rate, season, set, set_id, show_link, show_title, sort_title, special_sort_episode,
|
420
|
+
special_sort_season, studio, style, tag, tag_line, theme, top250, total_discs, track,
|
421
|
+
trailer, tv_show_id, type, unique_id, votes, watched_episodes, writer, director, resume,
|
422
|
+
runtime, stream_details, date_added, file, last_played, plot, title, art, play_count,
|
423
|
+
fan_art, thumbnail, label, artist, artist_id, display_artist, musicbrainz_album_artist_id,
|
424
|
+
rating, sort_artist, user_rating, year, genre)
|
425
|
+
|
426
|
+
@channel = channel
|
427
|
+
@channel_number = channel_number
|
428
|
+
@channel_type = channel_type
|
429
|
+
@end_time = end_time
|
430
|
+
@hidden = hidden
|
431
|
+
@locked = locked
|
432
|
+
@start_time = start_time
|
433
|
+
@sub_channel_number = sub_channel_number
|
434
|
+
|
435
|
+
list_item_base(album, album_artist, album_artist_id, album_id, album_release_type, album_status, bit_rate,
|
436
|
+
bpm, cast, channels, comment, compilation, contributors, country, description, disc,
|
437
|
+
disc_title, display_composer, display_conductor, display_lyricist, display_orchestra,
|
438
|
+
duration, dyn_path, episode, episode_guide, first_aired, id, imdb_number, is_box_set,
|
439
|
+
lyrics, media_path, mood, mpaa, musicbrainz_artist_id, musicbrainz_track_id, original_date,
|
440
|
+
original_title, plot_outline, premiered, production_code, release_date, release_type,
|
441
|
+
sample_rate, season, set, set_id, show_link, show_title, sort_title, special_sort_episode,
|
442
|
+
special_sort_season, studio, style, tag, tag_line, theme, top250, total_discs, track,
|
443
|
+
trailer, tv_show_id, type, unique_id, votes, watched_episodes, writer, director, resume,
|
444
|
+
runtime, stream_details, date_added, file, last_played, plot, title, art, play_count,
|
445
|
+
fan_art, thumbnail, label, artist, artist_id, display_artist, musicbrainz_album_artist_id,
|
446
|
+
rating, sort_artist, user_rating, year, genre)
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
450
|
+
# List.Item.File https://kodi.wiki/view/JSON-RPC_API/v12#List.Item.File
|
451
|
+
class ListItemFile
|
452
|
+
include ListItemBase
|
453
|
+
include Comparable
|
454
|
+
extend Creatable
|
455
|
+
|
456
|
+
attr_reader :file, :file_type, :last_modified, :mime_type, :size
|
457
|
+
|
458
|
+
def self.create(hash)
|
459
|
+
return nil if hash.nil?
|
460
|
+
|
461
|
+
cast = Types::Video::VideoCast.create_list(hash['cast'])
|
462
|
+
contributors = Types::Audio::AudioContributor.create_list(hash['contributors'])
|
463
|
+
resume = Types::Video::VideoResume.create(hash['resume'])
|
464
|
+
stream_details = Types::Video::Streams.create(hash['streamdetails'])
|
465
|
+
art = Types::Media::MediaArtwork.create(hash['art'])
|
466
|
+
hash['type'] = 'unknown' if hash['type'].nil?
|
467
|
+
new(*Creatable.hash_to_arr(hash, %w[file_type last_modified mime_type size]),
|
468
|
+
*Creatable.hash_to_arr(hash, %w[album album_artist album_artist_id album_id
|
469
|
+
album_release_type album_status bit_rate bpm]), cast,
|
470
|
+
hash['channels'], hash['comment'], hash['compilation'], contributors,
|
471
|
+
*Creatable.hash_to_arr(hash, %w[country description disc disc_title display_composer
|
472
|
+
display_conductor display_lyricist display_orchestra duration
|
473
|
+
dyn_path episode episode_guide first_aired id imdb_number
|
474
|
+
is_box_set lyrics media_path mood mpaa musicbrainz_artist_id
|
475
|
+
musicbrainz_track_id original_date original_title plot_outline
|
476
|
+
premiered production_code release_date release_type sample_rate
|
477
|
+
season set set_id show_link show_title sort_title
|
478
|
+
special_sort_episode special_sort_season studio style tag
|
479
|
+
tag_line theme top250 total_discs track trailer tv_show_id
|
480
|
+
type unique_id votes watched_episodes writer director]),
|
481
|
+
resume, hash['runtime'], stream_details,
|
482
|
+
*Creatable.hash_to_arr(hash, %w[date_added file last_played plot title]), art,
|
483
|
+
*Creatable.hash_to_arr(hash, %w[play_count fan_art thumbnail label artist artist_id
|
484
|
+
display_artist musicbrainz_album_artist_id rating sort_artist
|
485
|
+
user_rating year genre]))
|
238
486
|
end
|
239
487
|
|
240
|
-
def
|
241
|
-
|
488
|
+
def initialize(file_type, last_modified, mime_type, size,
|
489
|
+
album, album_artist, album_artist_id, album_id, album_release_type, album_status, bit_rate,
|
490
|
+
bpm, cast, channels, comment, compilation, contributors, country, description, disc,
|
491
|
+
disc_title, display_composer, display_conductor, display_lyricist, display_orchestra,
|
492
|
+
duration, dyn_path, episode, episode_guide, first_aired, id, imdb_number, is_box_set,
|
493
|
+
lyrics, media_path, mood, mpaa, musicbrainz_artist_id, musicbrainz_track_id, original_date,
|
494
|
+
original_title, plot_outline, premiered, production_code, release_date, release_type,
|
495
|
+
sample_rate, season, set, set_id, show_link, show_title, sort_title, special_sort_episode,
|
496
|
+
special_sort_season, studio, style, tag, tag_line, theme, top250, total_discs, track,
|
497
|
+
trailer, tv_show_id, type, unique_id, votes, watched_episodes, writer, director, resume,
|
498
|
+
runtime, stream_details, date_added, file, last_played, plot, title, art, play_count,
|
499
|
+
fan_art, thumbnail, label, artist, artist_id, display_artist, musicbrainz_album_artist_id,
|
500
|
+
rating, sort_artist, user_rating, year, genre)
|
501
|
+
@file = file
|
502
|
+
@file_type = file_type
|
503
|
+
@last_modified = last_modified
|
504
|
+
@mime_type = mime_type
|
505
|
+
@size = size
|
506
|
+
list_item_base(album, album_artist, album_artist_id, album_id, album_release_type, album_status, bit_rate,
|
507
|
+
bpm, cast, channels, comment, compilation, contributors, country, description, disc,
|
508
|
+
disc_title, display_composer, display_conductor, display_lyricist, display_orchestra,
|
509
|
+
duration, dyn_path, episode, episode_guide, first_aired, id, imdb_number, is_box_set,
|
510
|
+
lyrics, media_path, mood, mpaa, musicbrainz_artist_id, musicbrainz_track_id, original_date,
|
511
|
+
original_title, plot_outline, premiered, production_code, release_date, release_type,
|
512
|
+
sample_rate, season, set, set_id, show_link, show_title, sort_title, special_sort_episode,
|
513
|
+
special_sort_season, studio, style, tag, tag_line, theme, top250, total_discs, track,
|
514
|
+
trailer, tv_show_id, type, unique_id, votes, watched_episodes, writer, director, resume,
|
515
|
+
runtime, stream_details, date_added, file, last_played, plot, title, art, play_count,
|
516
|
+
fan_art, thumbnail, label, artist, artist_id, display_artist, musicbrainz_album_artist_id,
|
517
|
+
rating, sort_artist, user_rating, year, genre)
|
242
518
|
end
|
243
519
|
end
|
520
|
+
|
521
|
+
# methods for list sorting
|
522
|
+
module ListSortMethod
|
523
|
+
extend Iterable
|
524
|
+
|
525
|
+
NONE = 'none'
|
526
|
+
LABEL = 'label'
|
527
|
+
DATE = 'date'
|
528
|
+
SIZE = 'size'
|
529
|
+
FILE = 'file'
|
530
|
+
PATH = 'path'
|
531
|
+
DRIVE_TYPE = 'drivetype'
|
532
|
+
TITLE = 'title'
|
533
|
+
TRACK = 'track'
|
534
|
+
TIME = 'time'
|
535
|
+
ARTIST = 'artist'
|
536
|
+
ALBUM = 'album'
|
537
|
+
ALBUM_TYPE = 'albumtype'
|
538
|
+
GENRE = 'genre'
|
539
|
+
COUNTRY = 'country'
|
540
|
+
YEAR = 'year'
|
541
|
+
RATING = 'rating'
|
542
|
+
USER_RATING = 'userrating'
|
543
|
+
VOTES = 'votes'
|
544
|
+
TOP_250 = 'top250'
|
545
|
+
PROGRAM_COUNT = 'programcount'
|
546
|
+
PLAYLIST = 'playlist'
|
547
|
+
EPISODE = 'episode'
|
548
|
+
SEASON = 'season'
|
549
|
+
TOTAL_EPISODES = 'totalepisodes'
|
550
|
+
WATCHED_EPISODES = 'watchedepisodes'
|
551
|
+
TV_SHOW_STATUS = 'tvshowstatus'
|
552
|
+
TV_SHOW_TITLE = 'tvshowtitle'
|
553
|
+
SORT_TITLE = 'sorttitle'
|
554
|
+
PRODUCTION_CODE = 'productioncode'
|
555
|
+
MPAA = 'mpaa'
|
556
|
+
STUDIO = 'studio'
|
557
|
+
DATE_ADDED = 'dateadded'
|
558
|
+
LAST_PLAYED = 'lastplayed'
|
559
|
+
PLAY_COUNT = 'playcount'
|
560
|
+
LISTENERS = 'listeners'
|
561
|
+
BITRATE = 'bitrate'
|
562
|
+
RANDOM = 'random'
|
563
|
+
TOTAL_DISCS = 'totaldiscs'
|
564
|
+
ORIGINAL_DATE = 'originaldate'
|
565
|
+
BPM = 'bpm'
|
566
|
+
end
|
244
567
|
end
|
245
568
|
end
|
246
569
|
end
|