kodi_client 0.5.5 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/kodi_client.gemspec +3 -3
  4. data/lib/kodi_client/Chainable.rb +3 -1
  5. data/lib/kodi_client/global_types/addon_types.rb +50 -52
  6. data/lib/kodi_client/global_types/application_types.rb +21 -23
  7. data/lib/kodi_client/global_types/audio_types.rb +179 -29
  8. data/lib/kodi_client/global_types/favourites_types.rb +14 -17
  9. data/lib/kodi_client/global_types/files_types.rb +68 -0
  10. data/lib/kodi_client/global_types/global_types.rb +18 -24
  11. data/lib/kodi_client/global_types/gui_types.rb +15 -16
  12. data/lib/kodi_client/global_types/item_types.rb +10 -2
  13. data/lib/kodi_client/global_types/list_types.rb +326 -98
  14. data/lib/kodi_client/global_types/media_types.rb +21 -13
  15. data/lib/kodi_client/global_types/player_type.rb +110 -110
  16. data/lib/kodi_client/global_types/profiles_types.rb +14 -14
  17. data/lib/kodi_client/global_types/system_types.rb +7 -9
  18. data/lib/kodi_client/global_types/video_types.rb +80 -43
  19. data/lib/kodi_client/method/addons.rb +7 -19
  20. data/lib/kodi_client/method/application.rb +1 -1
  21. data/lib/kodi_client/method/audio_library.rb +49 -0
  22. data/lib/kodi_client/method/favourites.rb +1 -1
  23. data/lib/kodi_client/method/files.rb +89 -0
  24. data/lib/kodi_client/method/gui.rb +2 -2
  25. data/lib/kodi_client/method/player.rb +6 -6
  26. data/lib/kodi_client/method/profiles.rb +2 -2
  27. data/lib/kodi_client/method/system.rb +1 -1
  28. data/lib/kodi_client/util/comparable.rb +4 -1
  29. data/lib/kodi_client/util/creatable.rb +106 -0
  30. data/lib/kodi_client.rb +10 -22
  31. metadata +9 -5
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'kodi_client/util/comparable'
4
4
  require 'kodi_client/util/iterable'
5
+ require 'kodi_client/util/creatable'
5
6
 
6
7
  module KodiClient
7
8
  module Types
@@ -9,7 +10,7 @@ module KodiClient
9
10
 
10
11
  # Global.Toggle https://kodi.wiki/view/JSON-RPC_API/v12#Global.Toggle
11
12
  module Toggle
12
- include Iterable
13
+ extend Iterable
13
14
 
14
15
  TOGGLE = 'toggle'
15
16
  TRUE = true
@@ -55,48 +56,41 @@ module KodiClient
55
56
  # id/label type
56
57
  class IdLabel
57
58
  include Comparable
58
- attr_reader :id, :label
59
+ extend Creatable
59
60
 
60
- def initialize(hash)
61
- @id = hash['id']
62
- @label = hash['label']
63
- end
61
+ attr_reader :id, :label
64
62
 
65
- def ==(other)
66
- compare(self, other)
63
+ def initialize(id, label)
64
+ @id = id
65
+ @label = label
67
66
  end
68
67
  end
69
68
 
70
69
  # id/name type
71
70
  class IdName
72
71
  include Comparable
73
- attr_reader :id, :name
72
+ extend Creatable
74
73
 
75
- def initialize(hash)
76
- @id = hash['id']
77
- @name = hash['name']
78
- end
74
+ attr_reader :id, :name
79
75
 
80
- def ==(other)
81
- compare(self, other)
76
+ def initialize(id, name)
77
+ @id = id
78
+ @name = name
82
79
  end
83
80
  end
84
81
 
85
82
  # Global.Time https://kodi.wiki/view/JSON-RPC_API/v12#Global.Time
86
83
  class GlobalTime
87
84
  include Comparable
85
+ extend Creatable
88
86
 
89
87
  attr_reader :hours, :minutes, :seconds, :milliseconds
90
88
 
91
- def initialize(hash)
92
- @hours = hash['hours']
93
- @minutes = hash['minutes']
94
- @seconds = hash['seconds']
95
- @milliseconds = hash['milliseconds']
96
- end
97
-
98
- def ==(other)
99
- compare(self, other)
89
+ def initialize(hours, minutes, seconds, milliseconds)
90
+ @hours = hours
91
+ @minutes = minutes
92
+ @seconds = seconds
93
+ @milliseconds = milliseconds
100
94
  end
101
95
  end
102
96
 
@@ -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,28 @@ module KodiClient
152
155
  ANAGLYPH_YELLOW_BLUE = 'anaglyph_yellow_blue'
153
156
  MONSCOPIC = 'monoscopic'
154
157
 
155
- def initialize(hash)
156
- @label = hash['label']
157
- @mode = hash['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 initialize(hash)
172
- @current_control = Global::IdLabel.new(hash['currentcontrol'])
173
- @current_window = Global::IdLabel.new(hash['currentwindow'])
174
- @fullscreen = hash['fullscreen']
175
- @skin = Global::IdName.new(hash['skin'])
176
- @stereoscopic_mode = StereoscopyMode.new(hash['stereoscopicmode'])
177
- end
171
+ type_mapping ['currentcontrol', Global::IdLabel], ['currentwindow', Global::IdLabel],
172
+ ['skin', Global::IdName], ['stereoscopicmode', StereoscopyMode]
178
173
 
179
- def ==(other)
180
- compare(self, other)
174
+ def initialize(current_control, current_window, fullscreen, skin, stereoscopic_mode)
175
+ @current_control = current_control
176
+ @current_window = current_window
177
+ @fullscreen = fullscreen
178
+ @skin = skin
179
+ @stereoscopic_mode = stereoscopic_mode
181
180
  end
182
181
  end
183
182
  end
@@ -9,8 +9,16 @@ module KodiClient
9
9
 
10
10
  attr_reader :label
11
11
 
12
- def item_details_base(hash)
13
- @label = hash['label']
12
+ def item_details_base_mappings
13
+ {}
14
+ end
15
+
16
+ def item_details_base_by_hash(hash)
17
+ item_details_base(*Creatable.hash_to_arr(hash, %w[label], item_details_base_mappings))
18
+ end
19
+
20
+ def item_details_base(label)
21
+ @label = label
14
22
  end
15
23
  end
16
24
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'kodi_client/util/comparable'
4
+ require 'kodi_client/util/creatable'
5
+ require 'kodi_client/util/iterable'
4
6
  require 'kodi_client/global_types/video_types'
5
7
  require 'kodi_client/global_types/audio_types'
6
8
 
@@ -18,26 +20,21 @@ module KodiClient
18
20
  @list_start = list_start
19
21
  @list_end = list_end
20
22
  end
21
-
22
- def ==(other)
23
- compare(self, other)
24
- end
25
23
  end
26
24
 
27
25
  # List.LimitsReturned https://kodi.wiki/view/JSON-RPC_API/v12#List.LimitsReturned
28
26
  class ListLimitsReturned
29
27
  include Comparable
28
+ extend Creatable
30
29
 
31
30
  attr_reader :list_start, :list_end, :total
32
31
 
33
- def initialize(hash)
34
- @list_start = hash['start']
35
- @list_end = hash['end']
36
- @total = hash['total']
37
- end
32
+ fields_to_map %w[start end total]
38
33
 
39
- def ==(other)
40
- compare(self, other)
34
+ def initialize(list_start, list_end, total)
35
+ @list_start = list_start
36
+ @list_end = list_end
37
+ @total = total
41
38
  end
42
39
  end
43
40
 
@@ -56,16 +53,12 @@ module KodiClient
56
53
  attr_reader :ignore_article, :method, :order, :use_artist_sort_name
57
54
 
58
55
  def initialize(ignore_article = false, method = ListSortMethod::NONE,
59
- sortOrder = SortOrder::ASCENDING, use_artist_sort_name = false)
56
+ sort_order = SortOrder::ASCENDING, use_artist_sort_name = false)
60
57
  @ignore_article = ignore_article
61
58
  @method = method
62
- @order = SortOrder::ASCENDING
59
+ @order = sort_order
63
60
  @use_artist_sort_name = use_artist_sort_name
64
61
  end
65
-
66
- def ==(other)
67
- compare(self, other)
68
- end
69
62
  end
70
63
 
71
64
  # List.Fields.All https://kodi.wiki/view/JSON-RPC_API/v12#List.Fields.All
@@ -157,6 +150,95 @@ module KodiClient
157
150
  YEAR = 'year'
158
151
  end
159
152
 
153
+ # List.Fields.Files https://kodi.wiki/view/JSON-RPC_API/v12#List.Fields.Files
154
+ module ListFieldFiles
155
+ extend Iterable
156
+
157
+ ALBUM = 'album'
158
+ ALBUMARTIST = 'albumartist'
159
+ ALBUMARTISTID = 'albumartistid'
160
+ ALBUMID = 'albumid'
161
+ ALBUMLABEL = 'albumlabel'
162
+ ART = 'art'
163
+ ARTIST = 'artist'
164
+ ARTISTID = 'artistid'
165
+ CAST = 'cast'
166
+ COMMENT = 'comment'
167
+ COUNTRY = 'country'
168
+ DATEADDED = 'dateadded'
169
+ DESCRIPTION = 'description'
170
+ DIRECTOR = 'director'
171
+ DISC = 'disc'
172
+ DISPLAYARTIST = 'displayartist'
173
+ DURATION = 'duration'
174
+ EPISODE = 'episode'
175
+ EPISODEGUIDE = 'episodeguide'
176
+ FANART = 'fanart'
177
+ FILE = 'file'
178
+ FIRSTAIRED = 'firstaired'
179
+ GENRE = 'genre'
180
+ GENREID = 'genreid'
181
+ IMDBNUMBER = 'imdbnumber'
182
+ LASTMODIFIED = 'lastmodified'
183
+ LASTPLAYED = 'lastplayed'
184
+ LYRICS = 'lyrics'
185
+ MIMETYPE = 'mimetype'
186
+ MOOD = 'mood'
187
+ MPAA = 'mpaa'
188
+ MUSICBRAINZALBUMARTISTID = 'musicbrainzalbumartistid'
189
+ MUSICBRAINZALBUMID = 'musicbrainzalbumid'
190
+ MUSICBRAINZARTISTID = 'musicbrainzartistid'
191
+ MUSICBRAINZTRACKID = 'musicbrainztrackid'
192
+ ORIGINALTITLE = 'originaltitle'
193
+ PLAYCOUNT = 'playcount'
194
+ PLOT = 'plot'
195
+ PLOTOUTLINE = 'plotoutline'
196
+ PREMIERED = 'premiered'
197
+ PRODUCTIONCODE = 'productioncode'
198
+ RATING = 'rating'
199
+ RESUME = 'resume'
200
+ RUNTIME = 'runtime'
201
+ SEASON = 'season'
202
+ SET = 'set'
203
+ SETID = 'setid'
204
+ SHOWLINK = 'showlink'
205
+ SHOWTITLE = 'showtitle'
206
+ SIZE = 'size'
207
+ SORTTITLE = 'sorttitle'
208
+ SPECIALSORTEPISODE = 'specialsortepisode'
209
+ SPECIALSORTSEASON = 'specialsortseason'
210
+ STREAMDETAILS = 'streamdetails'
211
+ STUDIO = 'studio'
212
+ STYLE = 'style'
213
+ TAG = 'tag'
214
+ TAGLINE = 'tagline'
215
+ THEME = 'theme'
216
+ THUMBNAIL = 'thumbnail'
217
+ TITLE = 'title'
218
+ TOP250 = 'top250'
219
+ TRACK = 'track'
220
+ TRAILER = 'trailer'
221
+ TVSHOWID = 'tvshowid'
222
+ UNIQUEID = 'uniqueid'
223
+ VOTES = 'votes'
224
+ WATCHEDEPISODES = 'watchedepisodes'
225
+ WRITER = 'writer'
226
+ YEAR = 'year'
227
+ end
228
+
229
+ # File/Label tuple
230
+ class FileLabel
231
+ include Comparable
232
+ extend Creatable
233
+
234
+ attr_reader :file, :label
235
+
236
+ def initialize(file, label)
237
+ @file = file
238
+ @label = label
239
+ end
240
+ end
241
+
160
242
  # List.Item.Base https://kodi.wiki/view/JSON-RPC_API/v12#List.Item.Base
161
243
  module ListItemBase
162
244
  include Video::VideoDetailsFile
@@ -172,75 +254,119 @@ module KodiClient
172
254
  :special_sort_season, :studio, :style, :tag, :tag_line, :theme, :top250, :total_discs, :track,
173
255
  :trailer, :tv_show_id, :type, :unique_id, :votes, :watched_episodes, :writer
174
256
 
175
- def list_item_base(hash)
176
- @album = hash['album']
177
- @album_artist = hash['albumartist']
178
- @album_artist_id = hash['albumartistid']
179
- @album_id = hash['albumid']
180
- @album_release_type = hash['albumreleasetype']
181
- @album_status = hash['albumstatus']
182
- @bit_rate = hash['bitrate']
183
- @bpm = hash['bpm']
184
- @cast = hash['cast'].nil? ? [] : hash['cast'].map { |it| Types::Video::VideoCast.new(it) }
185
- @channels = hash['channels']
186
- @comment = hash['comment']
187
- @compilation = hash['compilation']
188
- @contributors = hash['contributors'].nil? ? [] : hash['contributors'].map { |it| Types::Audio::AudioContributor.new(it) }
189
- @country = hash['country']
190
- @description = hash['description']
191
- @disc = hash['disc']
192
- @disc_title = hash['disctitle']
193
- @display_composer = hash['displaycomposer']
194
- @display_conductor = hash['displayconductor']
195
- @display_lyricist = hash['displaylyricist']
196
- @display_orchestra = hash['displayorchestra']
197
- @duration = hash['duration']
198
- @dyn_path = hash['dynpath']
199
- @episode = hash['episode']
200
- @episode_guide = hash['episodeguide']
201
- @first_aired = hash['firstaired']
202
- @id = hash['id']
203
- @imdb_number = hash['imdbnumber']
204
- @is_box_set = hash['isboxset']
205
- @lyrics = hash['lyrics']
206
- @media_path = hash['mediapath']
207
- @mood = hash['mood']
208
- @mpaa = hash['mpaa']
209
- @musicbrainz_artist_id = hash['musicbrainzartistid']
210
- @musicbrainz_track_id = hash['musicbrainztrackid']
211
- @original_date = hash['originaldate']
212
- @original_title = hash['originaltitle']
213
- @plot_outline = hash['plotoutline']
214
- @premiered = hash['premiered']
215
- @production_code = hash['productioncode']
216
- @release_date = hash['releasedate']
217
- @release_type = hash['releasetype']
218
- @sample_rate = hash['samplerate']
219
- @season = hash['season']
220
- @set = hash['set']
221
- @set_id = hash['setid']
222
- @show_link = hash['showlink']
223
- @show_title = hash['showtitle']
224
- @sort_title = hash['sorttitle']
225
- @special_sort_episode = hash['specialsortepisode']
226
- @special_sort_season = hash['specialsortseason']
227
- @studio = hash['studio']
228
- @style = hash['style']
229
- @tag = hash['tag']
230
- @tag_line = hash['tagline']
231
- @theme = hash['theme']
232
- @top250 = hash['top250']
233
- @total_discs = hash['totaldiscs']
234
- @track = hash['track']
235
- @trailer = hash['trailer']
236
- @tv_show_id = hash['tvshowid']
237
- @type = hash['type'].nil? ? 'unknown' : hash['type']
238
- @unique_id = hash['uniqueid']
239
- @votes = hash['votes']
240
- @watched_episodes = hash['watchedepisodes']
241
- @writer = hash['writer']
242
- video_details_file(hash)
243
- audio_details_media(hash)
257
+ def list_item_base_mappings
258
+ mappings = {
259
+ 'cast' => Creatable::CreateMap.new(Video::VideoCast, true),
260
+ 'contributors' => Creatable::CreateMap.new(Audio::AudioContributor, true),
261
+ 'resume' => Creatable::CreateMap.new(Video::VideoResume),
262
+ 'streamdetails' => Creatable::CreateMap.new(Video::Streams),
263
+ 'art' => Creatable::CreateMap.new(Media::MediaArtwork)
264
+ }
265
+ mappings.merge(video_details_file_mappings).merge(audio_details_media_mappings)
266
+ end
267
+
268
+ def list_item_base_by_hash(hash)
269
+ return nil if hash.nil?
270
+
271
+ list_item_base(*Creatable.hash_to_arr(
272
+ hash, %w[album album_artist album_artist_id album_id album_release_type album_status bit_rate
273
+ bpm cast channels comment compilation contributors country description disc
274
+ disc_title display_composer display_conductor display_lyricist display_orchestra
275
+ duration dyn_path episode episode_guide first_aired id imdb_number is_box_set
276
+ lyrics media_path mood mpaa musicbrainz_artist_id musicbrainz_track_id original_date
277
+ original_title plot_outline premiered production_code release_date release_type
278
+ sample_rate season set set_id show_link show_title sort_title special_sort_episode
279
+ special_sort_season studio style tag tag_line theme top250 total_discs track
280
+ trailer tv_show_id type unique_id votes watched_episodes writer director resume
281
+ runtime stream_details date_added file last_played plot title art play_count
282
+ fan_art thumbnail label artist artist_id display_artist musicbrainz_album_artist_id
283
+ rating sort_artist user_rating year genre], list_item_base_mappings
284
+ ))
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)
244
370
  end
245
371
  end
246
372
 
@@ -248,24 +374,126 @@ module KodiClient
248
374
  class ListItemAll
249
375
  include ListItemBase
250
376
  include Comparable
377
+ extend Creatable
378
+ extend ListItemBase
251
379
 
252
380
  attr_reader :channel, :channel_number, :channel_type, :end_time, :hidden, :locked, :start_time,
253
381
  :sub_channel_number
254
382
 
255
- def initialize(hash)
256
- @channel = hash['channel']
257
- @channel_number = hash['channelnumber']
258
- @channel_type = hash['channeltype']
259
- @end_time = hash['endtime']
260
- @hidden = hash['hidden']
261
- @locked = hash['locked']
262
- @start_time = hash['starttime']
263
- @sub_channel_number = hash['subchannelnumber']
264
- list_item_base(hash)
383
+ fields_to_map %w[channel channel_number channel_type end_time hidden locked start_time sub_channel_number
384
+ album album_artist album_artist_id album_id album_release_type album_status bit_rate
385
+ bpm cast channels comment compilation contributors country description disc
386
+ disc_title display_composer display_conductor display_lyricist display_orchestra
387
+ duration dyn_path episode episode_guide first_aired id imdb_number is_box_set
388
+ lyrics media_path mood mpaa musicbrainz_artist_id musicbrainz_track_id original_date
389
+ original_title plot_outline premiered production_code release_date release_type
390
+ sample_rate season set set_id show_link show_title sort_title special_sort_episode
391
+ special_sort_season studio style tag tag_line theme top250 total_discs track
392
+ trailer tv_show_id type unique_id votes watched_episodes writer director resume
393
+ runtime stream_details date_added file last_played plot title art play_count
394
+ fan_art thumbnail label artist artist_id display_artist musicbrainz_album_artist_id
395
+ rating sort_artist user_rating year genre]
396
+
397
+ def self.lazy_type_mapping
398
+ list_item_base_mappings
399
+ end
400
+
401
+ def initialize(channel, channel_number, channel_type, end_time, hidden, locked, start_time, sub_channel_number,
402
+ album, album_artist, album_artist_id, album_id, album_release_type, album_status, bit_rate,
403
+ bpm, cast, channels, comment, compilation, contributors, country, description, disc,
404
+ disc_title, display_composer, display_conductor, display_lyricist, display_orchestra,
405
+ duration, dyn_path, episode, episode_guide, first_aired, id, imdb_number, is_box_set,
406
+ lyrics, media_path, mood, mpaa, musicbrainz_artist_id, musicbrainz_track_id, original_date,
407
+ original_title, plot_outline, premiered, production_code, release_date, release_type,
408
+ sample_rate, season, set, set_id, show_link, show_title, sort_title, special_sort_episode,
409
+ special_sort_season, studio, style, tag, tag_line, theme, top250, total_discs, track,
410
+ trailer, tv_show_id, type, unique_id, votes, watched_episodes, writer, director, resume,
411
+ runtime, stream_details, date_added, file, last_played, plot, title, art, play_count,
412
+ fan_art, thumbnail, label, artist, artist_id, display_artist, musicbrainz_album_artist_id,
413
+ rating, sort_artist, user_rating, year, genre)
414
+ @channel = channel
415
+ @channel_number = channel_number
416
+ @channel_type = channel_type
417
+ @end_time = end_time
418
+ @hidden = hidden
419
+ @locked = locked
420
+ @start_time = start_time
421
+ @sub_channel_number = sub_channel_number
422
+ type = type.nil? ? 'unknown' : type
423
+
424
+ list_item_base(album, album_artist, album_artist_id, album_id, album_release_type, album_status, bit_rate,
425
+ bpm, cast, channels, comment, compilation, contributors, country, description, disc,
426
+ disc_title, display_composer, display_conductor, display_lyricist, display_orchestra,
427
+ duration, dyn_path, episode, episode_guide, first_aired, id, imdb_number, is_box_set,
428
+ lyrics, media_path, mood, mpaa, musicbrainz_artist_id, musicbrainz_track_id, original_date,
429
+ original_title, plot_outline, premiered, production_code, release_date, release_type,
430
+ sample_rate, season, set, set_id, show_link, show_title, sort_title, special_sort_episode,
431
+ special_sort_season, studio, style, tag, tag_line, theme, top250, total_discs, track,
432
+ trailer, tv_show_id, type, unique_id, votes, watched_episodes, writer, director, resume,
433
+ runtime, stream_details, date_added, file, last_played, plot, title, art, play_count,
434
+ fan_art, thumbnail, label, artist, artist_id, display_artist, musicbrainz_album_artist_id,
435
+ rating, sort_artist, user_rating, year, genre)
436
+ end
437
+ end
438
+
439
+ # List.Item.File https://kodi.wiki/view/JSON-RPC_API/v12#List.Item.File
440
+ class ListItemFile
441
+ include ListItemBase
442
+ include Comparable
443
+ extend Creatable
444
+ extend ListItemBase
445
+
446
+ attr_reader :file, :file_type, :last_modified, :mime_type, :size
447
+
448
+ fields_to_map %w[file_type last_modified mime_type size
449
+ album album_artist album_artist_id album_id album_release_type album_status bit_rate
450
+ bpm cast channels comment compilation contributors country description disc
451
+ disc_title display_composer display_conductor display_lyricist display_orchestra
452
+ duration dyn_path episode episode_guide first_aired id imdb_number is_box_set
453
+ lyrics media_path mood mpaa musicbrainz_artist_id musicbrainz_track_id original_date
454
+ original_title plot_outline premiered production_code release_date release_type
455
+ sample_rate season set set_id show_link show_title sort_title special_sort_episode
456
+ special_sort_season studio style tag tag_line theme top250 total_discs track
457
+ trailer tv_show_id type unique_id votes watched_episodes writer director resume
458
+ runtime stream_details date_added file last_played plot title art play_count
459
+ fan_art thumbnail label artist artist_id display_artist musicbrainz_album_artist_id
460
+ rating sort_artist user_rating year genre]
461
+
462
+ def self.lazy_type_mapping
463
+ list_item_base_mappings
265
464
  end
266
465
 
267
- def ==(other)
268
- compare(self, other)
466
+ def initialize(file_type, last_modified, mime_type, size,
467
+ album, album_artist, album_artist_id, album_id, album_release_type, album_status, bit_rate,
468
+ bpm, cast, channels, comment, compilation, contributors, country, description, disc,
469
+ disc_title, display_composer, display_conductor, display_lyricist, display_orchestra,
470
+ duration, dyn_path, episode, episode_guide, first_aired, id, imdb_number, is_box_set,
471
+ lyrics, media_path, mood, mpaa, musicbrainz_artist_id, musicbrainz_track_id, original_date,
472
+ original_title, plot_outline, premiered, production_code, release_date, release_type,
473
+ sample_rate, season, set, set_id, show_link, show_title, sort_title, special_sort_episode,
474
+ special_sort_season, studio, style, tag, tag_line, theme, top250, total_discs, track,
475
+ trailer, tv_show_id, type, unique_id, votes, watched_episodes, writer, director, resume,
476
+ runtime, stream_details, date_added, file, last_played, plot, title, art, play_count,
477
+ fan_art, thumbnail, label, artist, artist_id, display_artist, musicbrainz_album_artist_id,
478
+ rating, sort_artist, user_rating, year, genre)
479
+ @file = file
480
+ @file_type = file_type
481
+ @last_modified = last_modified
482
+ @mime_type = mime_type
483
+ @size = size
484
+ type = type.nil? ? 'unknown' : type
485
+ list_item_base(album, album_artist, album_artist_id, album_id, album_release_type, album_status, bit_rate,
486
+ bpm, cast, channels, comment, compilation, contributors, country, description, disc,
487
+ disc_title, display_composer, display_conductor, display_lyricist, display_orchestra,
488
+ duration, dyn_path, episode, episode_guide, first_aired, id, imdb_number, is_box_set,
489
+ lyrics, media_path, mood, mpaa, musicbrainz_artist_id, musicbrainz_track_id, original_date,
490
+ original_title, plot_outline, premiered, production_code, release_date, release_type,
491
+ sample_rate, season, set, set_id, show_link, show_title, sort_title, special_sort_episode,
492
+ special_sort_season, studio, style, tag, tag_line, theme, top250, total_discs, track,
493
+ trailer, tv_show_id, type, unique_id, votes, watched_episodes, writer, director, resume,
494
+ runtime, stream_details, date_added, file, last_played, plot, title, art, play_count,
495
+ fan_art, thumbnail, label, artist, artist_id, display_artist, musicbrainz_album_artist_id,
496
+ rating, sort_artist, user_rating, year, genre)
269
497
  end
270
498
  end
271
499