kodi_client 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/kodi_client.gemspec +5 -2
  4. data/lib/kodi_client/Chainable.rb +3 -1
  5. data/lib/kodi_client/global_types/addon_types.rb +60 -48
  6. data/lib/kodi_client/global_types/application_types.rb +19 -16
  7. data/lib/kodi_client/global_types/audio_types.rb +41 -30
  8. data/lib/kodi_client/global_types/favourites_types.rb +18 -17
  9. data/lib/kodi_client/global_types/files_types.rb +82 -0
  10. data/lib/kodi_client/global_types/global_types.rb +29 -27
  11. data/lib/kodi_client/global_types/gui_types.rb +21 -15
  12. data/lib/kodi_client/global_types/input_types.rb +1 -1
  13. data/lib/kodi_client/global_types/item_types.rb +6 -2
  14. data/lib/kodi_client/global_types/list_types.rb +414 -91
  15. data/lib/kodi_client/global_types/media_types.rb +16 -11
  16. data/lib/kodi_client/global_types/player_type.rb +126 -107
  17. data/lib/kodi_client/global_types/profiles_types.rb +80 -0
  18. data/lib/kodi_client/global_types/pvr_type.rb +2 -0
  19. data/lib/kodi_client/global_types/system_types.rb +6 -9
  20. data/lib/kodi_client/global_types/video_types.rb +68 -41
  21. data/lib/kodi_client/kodi_module.rb +1 -0
  22. data/lib/kodi_client/method/addons.rb +2 -3
  23. data/lib/kodi_client/method/application.rb +1 -1
  24. data/lib/kodi_client/method/favourites.rb +1 -1
  25. data/lib/kodi_client/method/files.rb +89 -0
  26. data/lib/kodi_client/method/gui.rb +2 -2
  27. data/lib/kodi_client/method/player.rb +6 -6
  28. data/lib/kodi_client/method/profiles.rb +48 -0
  29. data/lib/kodi_client/method/system.rb +1 -1
  30. data/lib/kodi_client/util/comparable.rb +4 -1
  31. data/lib/kodi_client/util/creatable.rb +52 -0
  32. data/lib/kodi_client.rb +10 -9
  33. metadata +10 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d7046ba7c1c40c4302d7563b33a8805b83b3275069697af432b2880a59daf05
4
- data.tar.gz: 340843f609031566aee613714f5a0e52b65add52bee208141e6ef3eee8fe929c
3
+ metadata.gz: 5686743b785e5b591798992689064cec6c1e0d48a54721b97d9d28ae5a97ded3
4
+ data.tar.gz: fc7516af1d65c10ef63897253979bdb67b8d74f6f11bb74c959ccc942f8c026e
5
5
  SHA512:
6
- metadata.gz: 3af04fc11780d040693c50348d3ce5aded43cb67ae8ae8487498d4a9d66f6d3286b684716798d57e70bc6f58128ba4022d9fae35af635ce6ce016a7663e53c74
7
- data.tar.gz: de5b32cc6ad5c54b3efd5bc0e75544c66444a2c566d097fd13244122019da1dc3435df15a649d0a4ebda1e8171e5f4afd6865fc2d092fcfddbe351587a67d5c3
6
+ metadata.gz: ed6fbc05813a0f0a606c08c2e18606603af576e06f4af5941912097b477ad0a622a5ea7f47c7ce52062188b38522d60522337a06261d23f6894f5e1fbb6480c6
7
+ data.tar.gz: fb200b6342ff5a29d291d60e8c8e61d53de6012bcc5b29058e16ae2eee8d3df9583ed7e8f6f78a72a2da02481d74e9e48d6dbc945dbad73ed85526e711220532
data/README.md CHANGED
@@ -6,9 +6,11 @@ Currently implemented are the following Methods:
6
6
  * Addons
7
7
  * Application
8
8
  * Favourites
9
+ * Files
9
10
  * GUI
10
11
  * Input
11
12
  * Player
13
+ * Profiles
12
14
  * System
13
15
 
14
16
  ## Installation
data/kodi_client.gemspec CHANGED
@@ -2,12 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'kodi_client'
5
- spec.version = '0.5.0'
5
+ spec.version = '0.6.0'
6
6
  spec.authors = ['Christian Feier']
7
7
  spec.email = ['christian.feier@gmail.com']
8
8
 
9
9
  spec.summary = 'A work-in-progress client for Kodi JSON API v2.'
10
- spec.description = 'A client for the Kodi JSON API v12, currently implemented methods are addons, application, favourites, gui, input, player and system (more will be added with the time). For more information how to use it and how to activate Remote Control in Kodi, please check the github page https://github.com/cfe86/RubyKodiClient'
10
+ spec.description = 'A client for the Kodi JSON API v12, currently implemented methods are Addons, Application, '\
11
+ 'Favourites, Files, GUI, Input, Player, Profiles and System (more will be added with the time). '\
12
+ 'For more information how to use it and how to activate Remote Control in Kodi, '\
13
+ 'please check the github page https://github.com/cfe86/RubyKodiClient'
11
14
  spec.homepage = 'https://github.com/cfe86/RubyKodiClient'
12
15
  spec.license = 'MIT'
13
16
  spec.required_ruby_version = '>= 2.5.0'
@@ -24,7 +24,7 @@ module KodiClient
24
24
  client = def_client
25
25
  options = def_options
26
26
  set_command.call(options)
27
- client.apply_options(options)
27
+ client.apply_options_to_methods(options)
28
28
  client
29
29
  end
30
30
 
@@ -43,5 +43,7 @@ module KodiClient
43
43
  end
44
44
  @options
45
45
  end
46
+
47
+ private :def_client, :def_options, :merge_options
46
48
  end
47
49
  end
@@ -3,6 +3,7 @@
3
3
  require 'kodi_client/global_types/item_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,7 +11,7 @@ module KodiClient
10
11
 
11
12
  # Addon Types https://kodi.wiki/view/JSON-RPC_API/v12#Addon.Types
12
13
  module AddonTypes
13
- include Iterable
14
+ extend Iterable
14
15
 
15
16
  UNKNOWN = 'unknown'
16
17
  KODI_ADSP = 'kodi.adsp'
@@ -51,7 +52,8 @@ module KodiClient
51
52
 
52
53
  # Addon.Content https://kodi.wiki/view/JSON-RPC_API/v12#Addon.Content
53
54
  module AddonContent
54
- include Iterable
55
+ extend Iterable
56
+
55
57
  UNKNOWN = 'unknown'
56
58
  AUDIO = 'audio'
57
59
  EXECUTABLE = 'executable'
@@ -83,33 +85,27 @@ module KodiClient
83
85
  # represents addon dependency
84
86
  class AddonDependency
85
87
  include Comparable
88
+ extend Creatable
86
89
 
87
- attr_reader :addonid, :optional, :version
90
+ attr_reader :addon_id, :optional, :version
88
91
 
89
- def initialize(hash)
90
- @addonid = hash['addonid']
91
- @optional = hash['optional']
92
- @version = hash['version']
93
- end
94
-
95
- def ==(other)
96
- compare(self, other)
92
+ def initialize(addon_id, optional, version)
93
+ @addon_id = addon_id
94
+ @optional = optional
95
+ @version = version
97
96
  end
98
97
  end
99
98
 
100
99
  # represents addon extra info
101
100
  class AddonExtraInfo
102
101
  include Comparable
102
+ extend Creatable
103
103
 
104
104
  attr_reader :key, :value
105
105
 
106
- def initialize(hash)
107
- @key = hash['key']
108
- @value = hash['value']
109
- end
110
-
111
- def ==(other)
112
- compare(self, other)
106
+ def initialize(key, value)
107
+ @key = key
108
+ @value = value
113
109
  end
114
110
  end
115
111
 
@@ -117,33 +113,43 @@ module KodiClient
117
113
  class AddonDetails
118
114
  include Comparable
119
115
  include Items::ItemDetailsBase
116
+ extend Creatable
120
117
 
121
118
  attr_reader :addon_id, :author, :broken, :dependencies, :description, :disclaimer, :enabled, :extra_info,
122
119
  :fan_art, :installed, :name, :path, :rating, :summary, :thumbnail, :type, :version
123
120
 
124
- def initialize(hash)
125
- @addon_id = hash['addonid']
126
- @author = hash['author']
127
- @broken = hash['broken']
128
- @dependencies = hash['dependencies'].nil? ? nil : hash['dependencies'].map { |it| AddonDependency.new(it) }
129
- @description = hash['description']
130
- @disclaimer = hash['disclaimer']
131
- @enabled = hash['enabled']
132
- @extra_info = hash['extrainfo'].nil? ? nil : hash['extrainfo'].map { |it| AddonExtraInfo.new(it) }
133
- @fan_art = hash['fanart']
134
- @installed = hash['installed']
135
- @name = hash['name']
136
- @path = hash['path']
137
- @rating = hash['rating']
138
- @summary = hash['summary']
139
- @thumbnail = hash['thumbnail']
140
- @type = hash['type']
141
- @version = hash['version']
142
- item_details_base(hash)
121
+ def self.create(hash)
122
+ return nil if hash.nil?
123
+
124
+ dependencies = AddonDependency.create_list(hash['dependencies'])
125
+ extra_info = AddonExtraInfo.create_list(hash['extrainfo'])
126
+
127
+ new(hash['addonid'], hash['author'], hash['broken'], dependencies, hash['description'], hash['disclaimer'],
128
+ hash['enabled'], extra_info, hash['fanart'], hash['installed'], hash['name'], hash['path'],
129
+ hash['rating'], hash['summary'], hash['thumbnail'], hash['type'], hash['version'],
130
+ *hash_to_arr(hash, ['label']))
143
131
  end
144
132
 
145
- def ==(other)
146
- compare(self, other)
133
+ def initialize(addon_id, author, broken, dependencies, description, disclaimer, enabled, extra_info,
134
+ fan_art, installed, name, path, rating, summary, thumbnail, type, version, label)
135
+ @addon_id = addon_id
136
+ @author = author
137
+ @broken = broken
138
+ @dependencies = dependencies
139
+ @description = description
140
+ @disclaimer = disclaimer
141
+ @enabled = enabled
142
+ @extra_info = extra_info
143
+ @fan_art = fan_art
144
+ @installed = installed
145
+ @name = name
146
+ @path = path
147
+ @rating = rating
148
+ @summary = summary
149
+ @thumbnail = thumbnail
150
+ @type = type
151
+ @version = version
152
+ item_details_base(label)
147
153
  end
148
154
  end
149
155
 
@@ -153,13 +159,17 @@ module KodiClient
153
159
 
154
160
  attr_reader :addons, :limits
155
161
 
156
- def initialize(hash)
157
- @addons = hash['addons'].map { |it| AddonDetails.new(it) }
158
- @limits = List::ListLimitsReturned.new(hash['limits'])
162
+ def self.create(hash)
163
+ return nil if hash.nil?
164
+
165
+ addons = AddonDetails.create_list(hash['addons'])
166
+ limits = List::ListLimitsReturned.create(hash['limits'])
167
+ new(addons, limits)
159
168
  end
160
169
 
161
- def ==(other)
162
- compare(self, other)
170
+ def initialize(addons, limits)
171
+ @addons = addons
172
+ @limits = limits
163
173
  end
164
174
  end
165
175
 
@@ -169,12 +179,14 @@ module KodiClient
169
179
 
170
180
  attr_reader :addon
171
181
 
172
- def initialize(hash)
173
- @addon = AddonDetails.new(hash['addon'])
182
+ def self.create(hash)
183
+ return nil if hash.nil?
184
+
185
+ new(AddonDetails.create(hash['addon']))
174
186
  end
175
187
 
176
- def ==(other)
177
- compare(self, other)
188
+ def initialize(addon)
189
+ @addon = addon
178
190
  end
179
191
  end
180
192
  end
@@ -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
@@ -22,35 +23,37 @@ module KodiClient
22
23
  # Application.Property.Value https://kodi.wiki/view/JSON-RPC_API/v12#Application.Property.Value
23
24
  class PropertyValue
24
25
  include Comparable
26
+ extend Creatable
25
27
 
26
28
  attr_reader :name, :version, :muted, :volume
27
29
 
28
- def initialize(hash)
29
- @name = hash['name']
30
- @version = hash['version'].nil? ? nil : Version.new(hash['version'])
31
- @muted = hash['muted']
32
- @volume = hash['volume']
30
+ def self.create(hash)
31
+ return null if hash.nil?
32
+
33
+ version = Version.create(hash['version'])
34
+ new(hash['name'], version, hash['muted'], hash['volume'])
33
35
  end
34
36
 
35
- def ==(other)
36
- compare(self, other)
37
+ def initialize(name, version, muted, volume)
38
+ @name = name
39
+ @version = version
40
+ @muted = muted
41
+ @volume = volume
37
42
  end
38
43
  end
39
44
 
40
45
  # represent application properties version
41
46
  class Version
42
47
  include Comparable
43
- attr_reader :major, :minor, :revision, :tag
48
+ extend Creatable
44
49
 
45
- def initialize(hash)
46
- @major = hash['major']
47
- @minor = hash['minor']
48
- @revision = hash['revision']
49
- @tag = hash['tag']
50
- end
50
+ attr_reader :major, :minor, :revision, :tag
51
51
 
52
- def ==(other)
53
- compare(self, other)
52
+ def initialize(major, minor, revision, tag)
53
+ @major = major
54
+ @minor = minor
55
+ @revision = revision
56
+ @tag = tag
54
57
  end
55
58
  end
56
59
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'kodi_client/global_types/media_types'
4
- require 'kodi_client/global_types/player_type'
5
4
  require 'kodi_client/util/comparable'
6
5
  require 'kodi_client/util/iterable'
6
+ require 'kodi_client/util/creatable'
7
7
 
8
8
  module KodiClient
9
9
  module Types
@@ -12,18 +12,15 @@ module KodiClient
12
12
  # Audio.Contributor https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Contributors
13
13
  class AudioContributor
14
14
  include Comparable
15
+ extend Creatable
15
16
 
16
17
  attr_reader :artist_id, :name, :role, :role_id
17
18
 
18
- def initialize(hash)
19
- @artist_id = hash['artistid']
20
- @name = hash['name']
21
- @role = hash['role']
22
- @role_id = hash['roleid']
23
- end
24
-
25
- def ==(other)
26
- compare(self, other)
19
+ def initialize(artist_id, name, role, role_id)
20
+ @artist_id = artist_id
21
+ @name = name
22
+ @role = role
23
+ @role_id = role_id
27
24
  end
28
25
  end
29
26
 
@@ -41,11 +38,16 @@ module KodiClient
41
38
 
42
39
  attr_reader :art, :date_added, :genre
43
40
 
44
- def audio_details_base(hash)
45
- @art = Types::Media::MediaArtwork.new(hash['art'])
46
- @date_added = hash['date_added']
47
- @genre = hash['genre']
48
- media_details_base(hash)
41
+ def audio_details_base_by_hash(hash)
42
+ audio_details_base(Types::Media::MediaArtwork.create(hash['art']), hash['date_added'], hash['genre'],
43
+ *Creatable.hash_to_arr(hash, %w[fan_art thumbnail label]))
44
+ end
45
+
46
+ def audio_details_base(art, date_added, genre, fan_art, thumbnail, label)
47
+ @art = art
48
+ @date_added = date_added
49
+ @genre = genre
50
+ media_details_base(fan_art, thumbnail, label)
49
51
  end
50
52
  end
51
53
 
@@ -53,23 +55,32 @@ module KodiClient
53
55
  module AudioDetailsMedia
54
56
  include AudioDetailsBase
55
57
 
56
- attr_reader :artist, :artist_id, :display_artist, :musicbrainz_albumartist_id, :original_date, :rating,
58
+ attr_reader :artist, :artist_id, :display_artist, :musicbrainz_album_artist_id, :original_date, :rating,
57
59
  :release_date, :sort_artist, :title, :user_rating, :votes, :year
58
60
 
59
- def audio_details_media(hash)
60
- @artist = hash['artist']
61
- @artist_id = hash['artistid']
62
- @display_artist = hash['displayartist']
63
- @musicbrainz_albumartist_id = hash['musicbrainzalbumartistid']
64
- @original_date = hash['originaldate']
65
- @rating = hash['rating']
66
- @release_date = hash['releasedate']
67
- @sort_artist = hash['sortartist']
68
- @title = hash['title']
69
- @user_rating = hash['userrating']
70
- @votes = hash['votes']
71
- @year = hash['year']
72
- audio_details_base(hash)
61
+ def audio_details_media_by_hash(hash)
62
+ audio_details_media(hash['artist'], hash['artistid'], hash['displayartist'], hash['musicbrainzalbumartistid'],
63
+ hash['originaldate'], hash['rating'], hash['releasedate'], hash['sortartist'],
64
+ hash['title'], hash['userrating'], hash['votes'], hash['year'],
65
+ *Creatable.hash_to_arr(hash, %w[art date_added genre fan_art thumbnail label]))
66
+ end
67
+
68
+ def audio_details_media(artist, artist_id, display_artist, musicbrainz_album_artist_id, original_date,
69
+ rating, release_date, sort_artist, title, user_rating, votes, year,
70
+ art, date_added, genre, fan_art, thumbnail, label)
71
+ @artist = artist
72
+ @artist_id = artist_id
73
+ @display_artist = display_artist
74
+ @musicbrainz_album_artist_id = musicbrainz_album_artist_id
75
+ @original_date = original_date
76
+ @rating = rating
77
+ @release_date = release_date
78
+ @sort_artist = sort_artist
79
+ @title = title
80
+ @user_rating = user_rating
81
+ @votes = votes
82
+ @year = year
83
+ audio_details_base(art, date_added, genre, fan_art, thumbnail, label)
73
84
  end
74
85
  end
75
86
  end
@@ -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
  require 'kodi_client/global_types/list_types'
6
7
 
7
8
  module KodiClient
@@ -30,38 +31,38 @@ module KodiClient
30
31
  end
31
32
 
32
33
  # Favourite.Details.Favourite https://kodi.wiki/view/JSON-RPC_API/v12#Favourite.Details.Favourite
33
- class Favourite
34
+ class DetailsFavourite
34
35
  include Comparable
36
+ extend Creatable
35
37
 
36
38
  attr_reader :path, :thumbnail, :title, :type, :window, :window_parameter
37
39
 
38
- def initialize(hash)
39
- @path = hash['path']
40
- @thumbnail = hash['thumbnail']
41
- @title = hash['title']
42
- @type = hash['type']
43
- @window = hash['window']
44
- @window_parameter = hash['windowparameter']
45
- end
46
-
47
- def ==(other)
48
- compare(self, other)
40
+ def initialize(path, thumbnail, title, type, window, window_parameter)
41
+ @path = path
42
+ @thumbnail = thumbnail
43
+ @title = title
44
+ @type = type
45
+ @window = window
46
+ @window_parameter = window_parameter
49
47
  end
50
48
  end
51
49
 
52
50
  # return type for Favourites.GetFavourites
53
51
  class GetFavouriteReturned
54
52
  include Comparable
53
+ extend Creatable
55
54
 
56
55
  attr_reader :favourites, :limits
57
56
 
58
- def initialize(hash)
59
- @favourites = hash['favourites'].map { |it| Favourite.new(it) }
60
- @limits = Types::List::ListLimitsReturned.new(hash['limits'])
57
+ def self.create(hash)
58
+ favourites = DetailsFavourite.create_list(hash['favourites'])
59
+ limits = Types::List::ListLimitsReturned.create(hash['limits'])
60
+ new(favourites, limits)
61
61
  end
62
62
 
63
- def ==(other)
64
- compare(self, other)
63
+ def initialize(favourites, limits)
64
+ @favourites = favourites
65
+ @limits = limits
65
66
  end
66
67
  end
67
68
  end
@@ -0,0 +1,82 @@
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/list_types'
7
+
8
+ module KodiClient
9
+ module Types
10
+ module Files
11
+
12
+ # Files.Media https://kodi.wiki/view/JSON-RPC_API/v12#Files.Media
13
+ module Media
14
+ extend Iterable
15
+
16
+ VIDEO = 'video'
17
+ MUSIC = 'music'
18
+ PICTURES = 'pictures'
19
+ FILES = 'files'
20
+ PROGRAMS = 'programs'
21
+ end
22
+
23
+ # return value for GetDirectory
24
+ class GetDirectoryReturned
25
+ include Comparable
26
+ extend Creatable
27
+
28
+ attr_reader :files, :limits
29
+
30
+ def self.create(hash)
31
+ return nil if hash.nil?
32
+
33
+ files = Types::List::ListItemFile.create_list(hash['files'])
34
+ limits = Types::List::ListLimitsReturned.create(hash['limits'])
35
+
36
+ new(files, limits)
37
+ end
38
+
39
+ def initialize(files, limits)
40
+ @files = files
41
+ @limits = limits
42
+ end
43
+ end
44
+
45
+ # return value for GetSources
46
+ class GetSourcesReturned
47
+ include Comparable
48
+ extend Creatable
49
+
50
+ attr_reader :sources, :limits
51
+
52
+ def self.create(hash)
53
+ return nil if hash.nil?
54
+
55
+ sources = Types::List::FileLabel.create_list(hash['sources'])
56
+ limits = Types::List::ListLimitsReturned.create(hash['limits'])
57
+
58
+ new(sources, limits)
59
+ end
60
+
61
+ def initialize(sources, limits)
62
+ @sources = sources
63
+ @limits = limits
64
+ end
65
+ end
66
+
67
+ # return value for GetPrepareDownload
68
+ class PrepareDownloadReturned
69
+ include Comparable
70
+ extend Creatable
71
+
72
+ attr_reader :details, :mode, :protocol
73
+
74
+ def initialize(details, mode, protocol)
75
+ @details = details
76
+ @mode = mode
77
+ @protocol = protocol
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -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
@@ -18,7 +19,7 @@ module KodiClient
18
19
 
19
20
  # rotate for clockwise and counter clockwise
20
21
  module Rotate
21
- include Iterable
22
+ extend Iterable
22
23
 
23
24
  CLOCKWISE = 'clockwise'
24
25
  COUNTER_CLOCKWISE = 'counterclockwise'
@@ -26,7 +27,7 @@ module KodiClient
26
27
 
27
28
  # direction for left, right, up, down
28
29
  module Direction
29
- include Iterable
30
+ extend Iterable
30
31
 
31
32
  LEFT = 'left'
32
33
  RIGHT = 'right'
@@ -36,7 +37,7 @@ module KodiClient
36
37
 
37
38
  # enum for prev/next
38
39
  module NextPrev
39
- include Iterable
40
+ extend Iterable
40
41
 
41
42
  NEXT = 'next'
42
43
  PREV = 'previous'
@@ -46,7 +47,7 @@ module KodiClient
46
47
 
47
48
  # Global.IncrementDecrement https://kodi.wiki/view/JSON-RPC_API/v12#Global.IncrementDecrement
48
49
  module IncrementDecrement
49
- include Iterable
50
+ extend Iterable
50
51
 
51
52
  INCREMENT = 'increment'
52
53
  DECREMENT = 'decrement'
@@ -55,49 +56,50 @@ 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']
89
+ def initialize(hours, minutes, seconds, milliseconds)
90
+ @hours = hours
91
+ @minutes = minutes
92
+ @seconds = seconds
93
+ @milliseconds = milliseconds
96
94
  end
95
+ end
97
96
 
98
- def ==(other)
99
- compare(self, other)
100
- end
97
+ # available Password Encryptions
98
+ module PasswordEncryption
99
+ extend Iterable
100
+
101
+ NONE = 'none'
102
+ MD5 = 'md5'
101
103
  end
102
104
  end
103
105
  end