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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5686743b785e5b591798992689064cec6c1e0d48a54721b97d9d28ae5a97ded3
|
4
|
+
data.tar.gz: fc7516af1d65c10ef63897253979bdb67b8d74f6f11bb74c959ccc942f8c026e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed6fbc05813a0f0a606c08c2e18606603af576e06f4af5941912097b477ad0a622a5ea7f47c7ce52062188b38522d60522337a06261d23f6894f5e1fbb6480c6
|
7
|
+
data.tar.gz: fb200b6342ff5a29d291d60e8c8e61d53de6012bcc5b29058e16ae2eee8d3df9583ed7e8f6f78a72a2da02481d74e9e48d6dbc945dbad73ed85526e711220532
|
data/README.md
CHANGED
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
|
+
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
|
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.
|
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
|
-
|
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
|
-
|
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 :
|
90
|
+
attr_reader :addon_id, :optional, :version
|
88
91
|
|
89
|
-
def initialize(
|
90
|
-
@
|
91
|
-
@optional =
|
92
|
-
@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(
|
107
|
-
@key =
|
108
|
-
@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
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
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
|
146
|
-
|
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
|
157
|
-
|
158
|
-
|
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
|
162
|
-
|
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
|
173
|
-
|
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
|
177
|
-
|
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
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
36
|
-
|
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
|
-
|
48
|
+
extend Creatable
|
44
49
|
|
45
|
-
|
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
|
53
|
-
|
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(
|
19
|
-
@artist_id =
|
20
|
-
@name =
|
21
|
-
@role =
|
22
|
-
@role_id =
|
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
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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, :
|
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
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
@
|
70
|
-
@
|
71
|
-
@
|
72
|
-
|
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
|
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(
|
39
|
-
@path =
|
40
|
-
@thumbnail =
|
41
|
-
@title =
|
42
|
-
@type =
|
43
|
-
@window =
|
44
|
-
@window_parameter =
|
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
|
59
|
-
|
60
|
-
|
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
|
64
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
59
|
+
extend Creatable
|
59
60
|
|
60
|
-
|
61
|
-
@id = hash['id']
|
62
|
-
@label = hash['label']
|
63
|
-
end
|
61
|
+
attr_reader :id, :label
|
64
62
|
|
65
|
-
def
|
66
|
-
|
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
|
-
|
72
|
+
extend Creatable
|
74
73
|
|
75
|
-
|
76
|
-
@id = hash['id']
|
77
|
-
@name = hash['name']
|
78
|
-
end
|
74
|
+
attr_reader :id, :name
|
79
75
|
|
80
|
-
def
|
81
|
-
|
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(
|
92
|
-
@hours =
|
93
|
-
@minutes =
|
94
|
-
@seconds =
|
95
|
-
@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
|
-
|
99
|
-
|
100
|
-
|
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
|