kodi_client 0.6.4 → 0.7.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 +1 -0
- data/kodi_client.gemspec +2 -2
- data/lib/kodi_client/extensions/creatable.rb +2 -2
- data/lib/kodi_client/methods/addons.rb +2 -2
- data/lib/kodi_client/methods/audio_library.rb +292 -4
- data/lib/kodi_client/methods/files.rb +4 -8
- data/lib/kodi_client/methods/profiles.rb +3 -5
- data/lib/kodi_client/types/audio/audio_artist_role_type.rb +21 -0
- data/lib/kodi_client/types/audio/{details_album_type.rb → audio_details_album_type.rb} +1 -1
- data/lib/kodi_client/types/audio/audio_details_artist_type.rb +54 -0
- data/lib/kodi_client/types/audio/audio_details_media_type.rb +4 -3
- data/lib/kodi_client/types/audio/audio_details_role_type.rb +25 -0
- data/lib/kodi_client/types/audio/audio_details_song_type.rb +76 -0
- data/lib/kodi_client/types/audio/audio_fields_album_type.rb +0 -1
- data/lib/kodi_client/types/audio/audio_fields_artist_type.rb +39 -0
- data/lib/kodi_client/types/audio/audio_fields_role_type.rb +15 -0
- data/lib/kodi_client/types/audio/audio_fields_song_type.rb +61 -0
- data/lib/kodi_client/types/audio/available_art_type.rb +21 -0
- data/lib/kodi_client/types/audio/get_albums_returned_type.rb +1 -1
- data/lib/kodi_client/types/audio/get_artists_returned_type.rb +23 -0
- data/lib/kodi_client/types/audio/get_genres_returned_type.rb +24 -0
- data/lib/kodi_client/types/audio/get_roles_returned_type.rb +25 -0
- data/lib/kodi_client/types/audio/get_songs_returned_type.rb +25 -0
- data/lib/kodi_client/types/audio/get_sources_return_type.rb +25 -0
- data/lib/kodi_client/types/audio/property_name_type.rb +25 -0
- data/lib/kodi_client/types/audio/property_value_type.rb +33 -0
- data/lib/kodi_client/types/library/library_details_genre_type.rb +27 -0
- data/lib/kodi_client/types/library/library_details_source_type.rb +26 -0
- data/lib/kodi_client/types/library/library_fields_genre_type.rb +17 -0
- data/lib/kodi_client/types/library/library_fields_source_type.rb +17 -0
- data/lib/kodi_client/types/list/list_limits_type.rb +4 -0
- data/lib/kodi_client/types/list/list_sort_type.rb +6 -0
- data/lib/kodi_client/types/media/media_artwork_type.rb +4 -0
- data/lib/kodi_client.rb +21 -1
- metadata +25 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bbe8ae31b1c2f5092c6e6fa02a4641d3a73393dcedb44cd08e75f977b85b19b
|
4
|
+
data.tar.gz: 2d5362b89b5ef4e02542a2fcf9e548a8d33f38575496bbcd48a2b40c1c378003
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89796e76db1800a22e165a2bec14b2c3365318f87d7f57cf2861cdf2646ff0ca1e1108b47f0399782f4491fa9c2604e8fadec6f83f878b15e420bd74901510e8
|
7
|
+
data.tar.gz: f42bf33a0651081ec388e7bf5142d5284e00cd5d8e8d0b07d5766c05ea18197f7c523b97642fe993e6e789576c677945b1949764d592bdecab0d635d661d7edc
|
data/README.md
CHANGED
data/kodi_client.gemspec
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'kodi_client'
|
5
|
-
spec.version = '0.
|
5
|
+
spec.version = '0.7.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, '\
|
10
|
+
spec.description = 'A client for the Kodi JSON API v12, currently implemented methods are Addons, Application, AudioLibrary '\
|
11
11
|
'Favourites, Files, GUI, Input, Player, Profiles and System (more will be added with the time). '\
|
12
12
|
'For more information how to use it and how to activate Remote Control in Kodi, '\
|
13
13
|
'please check the github page https://github.com/cfe86/RubyKodiClient'
|
@@ -39,7 +39,7 @@ module KodiClient
|
|
39
39
|
# creates a Creatable using the provided hash and the attr_reader fields, or if given #fields_to_map instead
|
40
40
|
# The parameters will be passed to initialize the object in the same order as they are passed to attr_reader
|
41
41
|
# or #fields_to_map
|
42
|
-
# @param hash [Hash] the given hash to convert to an object
|
42
|
+
# @param hash [Hash, nil] the given hash to convert to an object
|
43
43
|
# @return the created object, or nil if the given hash is nil
|
44
44
|
def create(hash)
|
45
45
|
return nil if hash.nil?
|
@@ -83,7 +83,7 @@ module KodiClient
|
|
83
83
|
|
84
84
|
# extracts the given field from the given hash and optionally applies mapping if given
|
85
85
|
# @param field [String] the field name
|
86
|
-
# @param hash [Hash] the hash where to extract the field from
|
86
|
+
# @param hash [Hash, nil] the hash where to extract the field from
|
87
87
|
# @param mapping [Hash<String, CreateMap>] optional mapping for complex types
|
88
88
|
# @return the extracted object or nil, if the hash is empty, or [] if the expected value was a list and was nil
|
89
89
|
def self.extract_field_from_hash(field, hash, mapping)
|
@@ -13,14 +13,14 @@ module KodiClient
|
|
13
13
|
def get_addons(type = Types::Addons::AddonTypes::UNKNOWN,
|
14
14
|
content = Types::Addons::AddonContent::UNKNOWN,
|
15
15
|
enabled = nil, properties = [],
|
16
|
-
|
16
|
+
limits = Types::List::ListLimits.new(0, 50), installed = nil, kodi_id = 1)
|
17
17
|
request = KodiRequest.new(kodi_id, GET_ADDONS,
|
18
18
|
{
|
19
19
|
'type' => type,
|
20
20
|
'content' => content,
|
21
21
|
'enabled' => enabled.nil? || !enabled ? 'all' : 'enabled',
|
22
22
|
'properties' => properties,
|
23
|
-
'limits' =>
|
23
|
+
'limits' => limits.to_h,
|
24
24
|
'installed' => installed.nil? || !installed ? 'all' : 'installed'
|
25
25
|
})
|
26
26
|
json = invoke_api(request)
|
@@ -9,6 +9,24 @@ module KodiClient
|
|
9
9
|
EXPORT = 'AudioLibrary.Export'
|
10
10
|
GET_ALBUM_DETAILS = 'AudioLibrary.GetAlbumDetails'
|
11
11
|
GET_ALBUMS = 'AudioLibrary.GetAlbums'
|
12
|
+
GET_ARTIST_DETAILS = 'AudioLibrary.GetArtistDetails'
|
13
|
+
GET_ARTISTS = 'AudioLibrary.GetArtists'
|
14
|
+
GET_AVAILABLE_ART = 'AudioLibrary.GetAvailableArt'
|
15
|
+
GET_AVAILABLE_ART_TYPES = 'AudioLibrary.GetAvailableArtTypes'
|
16
|
+
GET_GENRES = 'AudioLibrary.GetGenres'
|
17
|
+
GET_PROPERTIES = 'AudioLibrary.GetProperties'
|
18
|
+
GET_RECENTLY_ADDED_ALBUMS = 'AudioLibrary.GetRecentlyAddedAlbums'
|
19
|
+
GET_RECENTLY_ADDED_SONGS = 'AudioLibrary.GetRecentlyAddedSongs'
|
20
|
+
GET_RECENTLY_PLAYED_ALBUMS = 'AudioLibrary.GetRecentlyPlayedAlbums'
|
21
|
+
GET_RECENTLY_PLAYED_SONGS = 'AudioLibrary.GetRecentlyPlayedSongs'
|
22
|
+
GET_ROLES = 'AudioLibrary.GetRoles'
|
23
|
+
GET_SONG_DETAILS = 'AudioLibrary.GetSongDetails'
|
24
|
+
GET_SOURCES = 'AudioLibrary.GetSources'
|
25
|
+
GET_SONGS = 'AudioLibrary.GetSongs'
|
26
|
+
SCAN = 'AudioLibrary.Scan'
|
27
|
+
SET_ALBUM_DETAILS = 'AudioLibrary.SetAlbumDetails'
|
28
|
+
SET_ARTIST_DETAILS = 'AudioLibrary.SetArtistDetails'
|
29
|
+
SET_SONG_DETAILS = 'AudioLibrary.SetSongDetails'
|
12
30
|
|
13
31
|
def clean(show_dialogs = true, kodi_id = 1)
|
14
32
|
request = KodiRequest.new(kodi_id, CLEAN, { 'showdialogs' => show_dialogs })
|
@@ -16,6 +34,12 @@ module KodiClient
|
|
16
34
|
KodiResponse.new(json)
|
17
35
|
end
|
18
36
|
|
37
|
+
def scan(show_dialogs = true, kodi_id = 1)
|
38
|
+
request = KodiRequest.new(kodi_id, SCAN, { 'showdialogs' => show_dialogs })
|
39
|
+
json = invoke_api(request)
|
40
|
+
KodiResponse.new(json)
|
41
|
+
end
|
42
|
+
|
19
43
|
def export(path, kodi_id = 1)
|
20
44
|
request = KodiRequest.new(kodi_id, EXPORT, { 'options' => { 'path' => path } })
|
21
45
|
json = invoke_api(request)
|
@@ -25,6 +49,8 @@ module KodiClient
|
|
25
49
|
def get_album_details(album_id, properties = Types::Audio::AudioFieldsAlbum.all_properties, kodi_id = 1)
|
26
50
|
request = KodiRequest.new(kodi_id, GET_ALBUM_DETAILS, { 'albumid' => album_id, 'properties' => properties })
|
27
51
|
json = invoke_api(request)
|
52
|
+
album_details = json['result'].nil? ? nil : json['result']['albumdetails']
|
53
|
+
json['result'] = Types::Audio::AudioDetailsAlbum.create(album_details)
|
28
54
|
KodiResponse.new(json)
|
29
55
|
end
|
30
56
|
|
@@ -33,14 +59,276 @@ module KodiClient
|
|
33
59
|
sort = Types::List::ListSort.new, include_singles = false, all_roles = false, kodi_id = 1)
|
34
60
|
request = KodiRequest.new(kodi_id, GET_ALBUMS,
|
35
61
|
{ 'properties' => properties,
|
36
|
-
'limits' =>
|
37
|
-
'sort' =>
|
38
|
-
'order' => sort.order,
|
39
|
-
'useartistsortname' => sort.use_artist_sort_name },
|
62
|
+
'limits' => limits.to_h,
|
63
|
+
'sort' => sort.to_h,
|
40
64
|
'includesingles' => include_singles, 'allroles' => all_roles })
|
41
65
|
json = invoke_api(request)
|
66
|
+
json['result'] = Types::Audio::GetAlbumsReturned.create(json['result'])
|
67
|
+
KodiResponse.new(json)
|
68
|
+
end
|
69
|
+
|
70
|
+
def get_artist_details(artist_id, properties = Types::Audio::AudioFieldsArtist.all_properties, kodi_id = 1)
|
71
|
+
request = KodiRequest.new(kodi_id, GET_ARTIST_DETAILS, { 'artistid' => artist_id, 'properties' => properties })
|
72
|
+
json = invoke_api(request)
|
73
|
+
artist_details = json['result'].nil? ? nil : json['result']['artistdetails']
|
74
|
+
json['result'] = Types::Audio::AudioDetailsArtist.create(artist_details)
|
75
|
+
KodiResponse.new(json)
|
76
|
+
end
|
77
|
+
|
78
|
+
def get_artists(album_artists_only = nil, properties = Types::Audio::AudioFieldsArtist.all_properties,
|
79
|
+
limits = Types::List::ListLimits.new(0, 50),
|
80
|
+
sort = Types::List::ListSort.new, all_roles = false, kodi_id = 1)
|
81
|
+
params = { 'albumartistsonly' => album_artists_only, 'properties' => properties,
|
82
|
+
'limits' => limits.to_h, 'sort' => sort.to_h, 'allroles' => all_roles }
|
83
|
+
params['albumartistsonly'] = album_artists_only unless album_artists_only.nil?
|
84
|
+
request = KodiRequest.new(kodi_id, GET_ARTISTS, params)
|
85
|
+
json = invoke_api(request)
|
86
|
+
json['result'] = Types::Audio::GetArtistsReturned.create(json['result'])
|
87
|
+
KodiResponse.new(json)
|
88
|
+
end
|
89
|
+
|
90
|
+
def get_available_art_for_artist(artist_id, art_type = '', kodi_id = 1)
|
91
|
+
get_available_art({ 'artistid' => artist_id }, art_type, kodi_id)
|
92
|
+
end
|
93
|
+
|
94
|
+
def get_available_art_for_album(artist_id, art_type = '', kodi_id = 1)
|
95
|
+
get_available_art({ 'albumid' => artist_id }, art_type, kodi_id)
|
96
|
+
end
|
97
|
+
|
98
|
+
def get_available_art(id, art_type = '', kodi_id = 1)
|
99
|
+
request = KodiRequest.new(kodi_id, GET_AVAILABLE_ART, { 'item' => id, 'arttype' => art_type })
|
100
|
+
json = invoke_api(request)
|
101
|
+
available_arts = json['result'].nil? ? nil : json['result']['availableart']
|
102
|
+
json['result'] = Types::Audio::AvailableArt.create_list(available_arts)
|
103
|
+
KodiResponse.new(json)
|
104
|
+
end
|
105
|
+
|
106
|
+
def get_available_art_types_for_artist(artist_id, kodi_id = 1)
|
107
|
+
get_available_art_types({ 'artistid' => artist_id }, kodi_id)
|
108
|
+
end
|
109
|
+
|
110
|
+
def get_available_art_types_for_album(album_id, kodi_id = 1)
|
111
|
+
get_available_art_types({ 'albumid' => album_id }, kodi_id)
|
112
|
+
end
|
113
|
+
|
114
|
+
def get_available_art_types(id, kodi_id = 1)
|
115
|
+
request = KodiRequest.new(kodi_id, GET_AVAILABLE_ART_TYPES, { 'item' => id })
|
116
|
+
json = invoke_api(request)
|
117
|
+
available_arts = json['result'].nil? ? [] : json['result']['availablearttypes']
|
118
|
+
json['result'] = available_arts
|
119
|
+
KodiResponse.new(json)
|
120
|
+
end
|
121
|
+
|
122
|
+
def get_genres(properties = Types::Library::LibraryFieldsGenre.all_properties,
|
123
|
+
limits = Types::List::ListLimits.new(0, 50),
|
124
|
+
sort = Types::List::ListSort.new, kodi_id = 1)
|
125
|
+
request = KodiRequest.new(kodi_id, GET_GENRES, { 'properties' => properties,
|
126
|
+
'limits' => limits.to_h,
|
127
|
+
'sort' => sort.to_h })
|
128
|
+
json = invoke_api(request)
|
129
|
+
json['result'] = Types::Audio::GetGenresReturned.create(json['result'])
|
130
|
+
KodiResponse.new(json)
|
131
|
+
end
|
132
|
+
|
133
|
+
def get_properties(properties = Types::Audio::PropertyName.all_properties, kodi_id = 1)
|
134
|
+
request = KodiRequest.new(kodi_id, GET_PROPERTIES, { 'properties' => properties, })
|
135
|
+
json = invoke_api(request)
|
136
|
+
json['result'] = Types::Audio::PropertyValue.create(json['result'])
|
137
|
+
KodiResponse.new(json)
|
138
|
+
end
|
139
|
+
|
140
|
+
def get_recently_added_albums(properties = Types::Audio::AudioFieldsAlbum.all_properties,
|
141
|
+
limits = Types::List::ListLimits.new(0, 50),
|
142
|
+
sort = Types::List::ListSort.new, kodi_id = 1)
|
143
|
+
request = KodiRequest.new(kodi_id, GET_RECENTLY_ADDED_ALBUMS,
|
144
|
+
{ 'properties' => properties,
|
145
|
+
'limits' => limits.to_h,
|
146
|
+
'sort' => sort.to_h })
|
147
|
+
json = invoke_api(request)
|
148
|
+
json['result'] = Types::Audio::GetAlbumsReturned.create(json['result'])
|
149
|
+
KodiResponse.new(json)
|
150
|
+
end
|
151
|
+
|
152
|
+
def get_recently_added_songs(album_limit = 100, properties = Types::Audio::AudioFieldsSong.all_properties,
|
153
|
+
limits = Types::List::ListLimits.new(0, 50),
|
154
|
+
sort = Types::List::ListSort.new, kodi_id = 1)
|
155
|
+
request = KodiRequest.new(kodi_id, GET_RECENTLY_ADDED_SONGS,
|
156
|
+
{ 'albumlimit' => album_limit,
|
157
|
+
'properties' => properties,
|
158
|
+
'limits' => limits.to_h,
|
159
|
+
'sort' => sort.to_h })
|
160
|
+
json = invoke_api(request)
|
161
|
+
json['result'] = Types::Audio::GetSongsReturned.create(json['result'])
|
162
|
+
KodiResponse.new(json)
|
163
|
+
end
|
164
|
+
|
165
|
+
def get_recently_played_albums(properties = Types::Audio::AudioFieldsAlbum.all_properties,
|
166
|
+
limits = Types::List::ListLimits.new(0, 50),
|
167
|
+
sort = Types::List::ListSort.new, kodi_id = 1)
|
168
|
+
request = KodiRequest.new(kodi_id, GET_RECENTLY_PLAYED_ALBUMS,
|
169
|
+
{ 'properties' => properties,
|
170
|
+
'limits' => limits.to_h,
|
171
|
+
'sort' => sort.to_h })
|
172
|
+
json = invoke_api(request)
|
173
|
+
json['result'] = Types::Audio::GetAlbumsReturned.create(json['result'])
|
174
|
+
KodiResponse.new(json)
|
175
|
+
end
|
176
|
+
|
177
|
+
def get_recently_played_songs(album_limit = 100, properties = Types::Audio::AudioFieldsSong.all_properties,
|
178
|
+
limits = Types::List::ListLimits.new(0, 50),
|
179
|
+
sort = Types::List::ListSort.new, kodi_id = 1)
|
180
|
+
request = KodiRequest.new(kodi_id, GET_RECENTLY_PLAYED_SONGS,
|
181
|
+
{ 'albumlimit' => album_limit,
|
182
|
+
'properties' => properties,
|
183
|
+
'limits' => limits.to_h,
|
184
|
+
'sort' => sort.to_h })
|
185
|
+
json = invoke_api(request)
|
186
|
+
json['result'] = Types::Audio::GetSongsReturned.create(json['result'])
|
187
|
+
KodiResponse.new(json)
|
188
|
+
end
|
189
|
+
|
190
|
+
def get_roles(properties = Types::Audio::AudioFieldsRole.all_properties,
|
191
|
+
limits = Types::List::ListLimits.new(0, 50),
|
192
|
+
sort = Types::List::ListSort.new, kodi_id = 1)
|
193
|
+
request = KodiRequest.new(kodi_id, GET_ROLES, { 'properties' => properties,
|
194
|
+
'limits' => limits.to_h,
|
195
|
+
'sort' => sort.to_h })
|
196
|
+
json = invoke_api(request)
|
197
|
+
json['result'] = Types::Audio::GetRolesReturned.create(json['result'])
|
198
|
+
KodiResponse.new(json)
|
199
|
+
end
|
200
|
+
|
201
|
+
def get_song_details(song_id, properties = Types::Audio::AudioFieldsSong.all_properties, kodi_id = 1)
|
202
|
+
request = KodiRequest.new(kodi_id, GET_SONG_DETAILS, { 'songid' => song_id, 'properties' => properties })
|
203
|
+
json = invoke_api(request)
|
204
|
+
song_details = json['result'].nil? ? nil : json['result']['songdetails']
|
205
|
+
json['result'] = Types::Audio::AudioDetailsSong.create(song_details)
|
206
|
+
KodiResponse.new(json)
|
207
|
+
end
|
208
|
+
|
209
|
+
def get_sources(properties = Types::Library::LibraryFieldsSource.all_properties,
|
210
|
+
limits = Types::List::ListLimits.new(0, 50),
|
211
|
+
sort = Types::List::ListSort.new, kodi_id = 1)
|
212
|
+
request = KodiRequest.new(kodi_id, GET_SOURCES,
|
213
|
+
{ 'properties' => properties,
|
214
|
+
'limits' => limits.to_h,
|
215
|
+
'sort' => sort.to_h })
|
216
|
+
json = invoke_api(request)
|
217
|
+
json['result'] = Types::Audio::GetSourcesReturned.create(json['result'])
|
218
|
+
KodiResponse.new(json)
|
219
|
+
end
|
220
|
+
|
221
|
+
def get_songs(properties = Types::Audio::AudioFieldsSong.all_properties,
|
222
|
+
limits = Types::List::ListLimits.new(0, 50),
|
223
|
+
sort = Types::List::ListSort.new, include_singles = true, all_roles = true,
|
224
|
+
singles_only = false, kodi_id = 1)
|
225
|
+
request = KodiRequest.new(kodi_id, GET_SONGS,
|
226
|
+
{ 'properties' => properties,
|
227
|
+
'limits' => limits.to_h,
|
228
|
+
'sort' => sort.to_h, 'includesingles' => include_singles, 'allroles' => all_roles,
|
229
|
+
'singlesonly' => singles_only })
|
230
|
+
json = invoke_api(request)
|
231
|
+
json['result'] = Types::Audio::GetSongsReturned.create(json['result'])
|
232
|
+
KodiResponse.new(json)
|
233
|
+
end
|
234
|
+
|
235
|
+
def set_album_details(album_id, title = nil, artist = nil, description = nil, genre = nil, theme = nil,
|
236
|
+
mood = nil, style = nil, type = nil, album_label = nil, rating = nil, year = nil,
|
237
|
+
user_rating = nil, votes = nil, musicbrainz_album_id = nil,
|
238
|
+
musicbrainz_release_group_id = nil, sort_artist = nil, display_artist = nil,
|
239
|
+
musicbrainz_album_artist_id = nil, art = nil, is_box_set = nil, release_date = nil,
|
240
|
+
original_date = nil, kodi_id = 1)
|
241
|
+
params = { 'albumid' => album_id }
|
242
|
+
params['title'] = title unless title.nil?
|
243
|
+
params['artist'] = artist unless artist.nil?
|
244
|
+
params['description'] = description unless description.nil?
|
245
|
+
params['genre'] = genre unless genre.nil?
|
246
|
+
params['theme'] = theme unless theme.nil?
|
247
|
+
params['mood'] = mood unless mood.nil?
|
248
|
+
params['style'] = style unless style.nil?
|
249
|
+
params['type'] = type unless type.nil?
|
250
|
+
params['albumlabel'] = album_label unless album_label.nil?
|
251
|
+
params['rating'] = rating unless rating.nil?
|
252
|
+
params['year'] = year unless year.nil?
|
253
|
+
params['userrating'] = user_rating unless user_rating.nil?
|
254
|
+
params['votes'] = votes unless votes.nil?
|
255
|
+
params['musicbrainzalbumid'] = musicbrainz_album_id unless musicbrainz_album_id.nil?
|
256
|
+
params['musicbrainzreleasegroupid'] = musicbrainz_release_group_id unless musicbrainz_release_group_id.nil?
|
257
|
+
params['sortartist'] = sort_artist unless sort_artist.nil?
|
258
|
+
params['displayartist'] = display_artist unless display_artist.nil?
|
259
|
+
params['musicbrainzalbumartistid'] = musicbrainz_album_artist_id unless musicbrainz_album_artist_id.nil?
|
260
|
+
params['art'] = art.to_h unless art.nil?
|
261
|
+
params['isboxset'] = is_box_set unless is_box_set.nil?
|
262
|
+
params['releasedate'] = release_date unless release_date.nil?
|
263
|
+
params['originaldate'] = original_date unless original_date.nil?
|
264
|
+
|
265
|
+
request = KodiRequest.new(kodi_id, SET_ALBUM_DETAILS, params)
|
266
|
+
json = invoke_api(request)
|
267
|
+
KodiResponse.new(json)
|
268
|
+
end
|
269
|
+
|
270
|
+
def set_artist_details(artist_id, artist = nil, instrument = nil, style = nil, mood = nil, born = nil,
|
271
|
+
formed = nil, description = nil, genre = nil, died = nil, disbanded = nil,
|
272
|
+
years_active = nil, musicbrainz_artist_id = nil, sort_name = nil, type = nil,
|
273
|
+
gender = nil, disambiguation = nil, art = nil, kodi_id = 1)
|
274
|
+
params = { 'artistid' => artist_id }
|
275
|
+
params['artist'] = artist unless artist.nil?
|
276
|
+
params['instrument'] = instrument unless instrument.nil?
|
277
|
+
params['style'] = style unless style.nil?
|
278
|
+
params['mood'] = mood unless mood.nil?
|
279
|
+
params['born'] = born unless born.nil?
|
280
|
+
params['formed'] = formed unless formed.nil?
|
281
|
+
params['description'] = description unless description.nil?
|
282
|
+
params['genre'] = genre unless genre.nil?
|
283
|
+
params['died'] = died unless died.nil?
|
284
|
+
params['disbanded'] = disbanded unless disbanded.nil?
|
285
|
+
params['yearsactive'] = years_active unless years_active.nil?
|
286
|
+
params['musicbrainzartistid'] = musicbrainz_artist_id unless musicbrainz_artist_id.nil?
|
287
|
+
params['sortname'] = sort_name unless sort_name.nil?
|
288
|
+
params['type'] = type unless type.nil?
|
289
|
+
params['gender'] = gender unless gender.nil?
|
290
|
+
params['disambiguation'] = disambiguation unless disambiguation.nil?
|
291
|
+
params['art'] = art.to_h unless art.nil?
|
292
|
+
request = KodiRequest.new(kodi_id, SET_ARTIST_DETAILS, params)
|
293
|
+
json = invoke_api(request)
|
42
294
|
KodiResponse.new(json)
|
43
295
|
end
|
296
|
+
|
297
|
+
def set_song_details(song_id, title = nil, artist = nil, genre = nil, year = nil, rating = nil, track = nil,
|
298
|
+
disc = nil, duration = nil, comment = nil, musicbrainz_track_id = nil,
|
299
|
+
musicbrainz_artist_id = nil, play_count = nil, last_played = nil, user_rating = nil,
|
300
|
+
votes = nil, display_artist = nil, sort_artist = nil, mood = nil, art = nil,
|
301
|
+
release_date = nil, original_date = nil, bpm = nil, kodi_id = 1)
|
302
|
+
params = { 'songid' => song_id }
|
303
|
+
params['title'] = title unless title.nil?
|
304
|
+
params['artist'] = artist unless artist.nil?
|
305
|
+
params['genre'] = genre unless genre.nil?
|
306
|
+
params['year'] = year unless year.nil?
|
307
|
+
params['rating'] = rating unless rating.nil?
|
308
|
+
params['track'] = track unless track.nil?
|
309
|
+
params['disc'] = disc unless disc.nil?
|
310
|
+
params['duration'] = duration unless duration.nil?
|
311
|
+
params['comment'] = comment unless comment.nil?
|
312
|
+
params['musicbrainztrackid'] = musicbrainz_track_id unless musicbrainz_track_id.nil?
|
313
|
+
params['musicbrainzartistid'] = musicbrainz_artist_id unless musicbrainz_artist_id.nil?
|
314
|
+
params['playcount'] = play_count unless play_count.nil?
|
315
|
+
params['lastplayed'] = last_played unless last_played.nil?
|
316
|
+
params['userrating'] = user_rating unless user_rating.nil?
|
317
|
+
params['votes'] = votes unless votes.nil?
|
318
|
+
params['displayartist'] = display_artist unless display_artist.nil?
|
319
|
+
params['sortartist'] = sort_artist unless sort_artist.nil?
|
320
|
+
params['mood'] = mood unless mood.nil?
|
321
|
+
params['art'] = art.to_h unless art.nil?
|
322
|
+
params['releasedate'] = release_date unless release_date.nil?
|
323
|
+
params['originaldate'] = original_date unless original_date.nil?
|
324
|
+
params['bpm'] = bpm unless bpm.nil?
|
325
|
+
|
326
|
+
request = KodiRequest.new(kodi_id, SET_SONG_DETAILS, params)
|
327
|
+
json = invoke_api(request)
|
328
|
+
KodiResponse.new(json)
|
329
|
+
end
|
330
|
+
|
331
|
+
private :get_available_art, :get_available_art_types
|
44
332
|
end
|
45
333
|
end
|
46
334
|
end
|
@@ -20,10 +20,8 @@ module KodiClient
|
|
20
20
|
'directory' => directory,
|
21
21
|
'media' => media,
|
22
22
|
'properties' => properties,
|
23
|
-
'sort' =>
|
24
|
-
|
25
|
-
'useartistsortname' => sort.use_artist_sort_name },
|
26
|
-
'limits' => { 'start' => limits.list_start, 'end' => limits.list_end }
|
23
|
+
'sort' => sort.to_h,
|
24
|
+
'limits' => limits.to_h
|
27
25
|
})
|
28
26
|
json = invoke_api(request)
|
29
27
|
result = KodiClient::Types::Files::GetDirectoryReturned.create(json['result'])
|
@@ -51,10 +49,8 @@ module KodiClient
|
|
51
49
|
request = KodiRequest.new(kodi_id, GET_SOURCES,
|
52
50
|
{
|
53
51
|
'media' => media,
|
54
|
-
'sort' =>
|
55
|
-
|
56
|
-
'useartistsortname' => sort.use_artist_sort_name },
|
57
|
-
'limits' => { 'start' => limits.list_start, 'end' => limits.list_end }
|
52
|
+
'sort' => sort.to_h,
|
53
|
+
'limits' => limits.to_h
|
58
54
|
})
|
59
55
|
json = invoke_api(request)
|
60
56
|
result = KodiClient::Types::Files::GetSourcesReturned.create(json['result'])
|
@@ -18,14 +18,12 @@ module KodiClient
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def get_profiles(properties = Types::Profiles::FieldsProfile.all_properties,
|
21
|
-
|
21
|
+
limits = Types::List::ListLimits.new(0, 50),
|
22
22
|
sort = Types::List::ListSort.new, kodi_id = 1)
|
23
23
|
request = KodiRequest.new(kodi_id, GET_PROFILES,
|
24
24
|
{ 'properties' => properties,
|
25
|
-
'limits' =>
|
26
|
-
'sort' =>
|
27
|
-
'order' => sort.order,
|
28
|
-
'useartistsortname' => sort.use_artist_sort_name } })
|
25
|
+
'limits' => limits.to_h,
|
26
|
+
'sort' => sort.to_h })
|
29
27
|
json = invoke_api(request)
|
30
28
|
result = Types::Profiles::GetProfilesReturned.create(json['result'])
|
31
29
|
json['result'] = result
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
|
7
|
+
# Audio.Artist.Roles https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Artist.Roles
|
8
|
+
class AudioArtistRole
|
9
|
+
include Extensions::Comparable
|
10
|
+
extend Extensions::Creatable
|
11
|
+
|
12
|
+
attr_reader :role, :role_id
|
13
|
+
|
14
|
+
def initialize(role, role_id)
|
15
|
+
@role = role
|
16
|
+
@role_id = role_id
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -4,7 +4,7 @@ module KodiClient
|
|
4
4
|
module Types
|
5
5
|
module Audio
|
6
6
|
# Audio.Details.Album https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Details.Album
|
7
|
-
class
|
7
|
+
class AudioDetailsAlbum
|
8
8
|
include AudioDetailsMedia
|
9
9
|
include Extensions::Comparable
|
10
10
|
extend Extensions::Creatable
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# Audio.Details.Artist https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Details.Artist
|
7
|
+
class AudioDetailsArtist
|
8
|
+
include AudioDetailsBase
|
9
|
+
include Extensions::Comparable
|
10
|
+
extend Extensions::Creatable
|
11
|
+
|
12
|
+
attr_reader :artist, :artist_id, :born, :compilation_artist, :description, :died, :disambiguation, :disbanded,
|
13
|
+
:formed, :gender, :instrument, :is_album_artist, :mood, :musicbrainz_artist_id, :roles, :song_genres,
|
14
|
+
:sort_name, :source_id, :style, :type, :years_active
|
15
|
+
|
16
|
+
fields_to_map %w[artist artist_id born compilation_artist description died disambiguation disbanded
|
17
|
+
formed gender instrument is_album_artist mood musicbrainz_artist_id roles song_genres
|
18
|
+
sort_name source_id style type years_active art date_added genre fan_art thumbnail
|
19
|
+
label]
|
20
|
+
|
21
|
+
type_mapping ['songgenres', Genre, true], ['art', Types::Media::MediaArtwork],
|
22
|
+
['roles', AudioArtistRole, true]
|
23
|
+
|
24
|
+
def initialize(artist, artist_id, born, compilation_artist, description, died, disambiguation, disbanded,
|
25
|
+
formed, gender, instrument, is_album_artist, mood, musicbrainz_artist_id, roles, song_genres,
|
26
|
+
sort_name, source_id, style, type, years_active, art, date_added, genre, fan_art, thumbnail,
|
27
|
+
label)
|
28
|
+
@artist = artist
|
29
|
+
@artist_id = artist_id
|
30
|
+
@born = born
|
31
|
+
@compilation_artist = compilation_artist
|
32
|
+
@description = description
|
33
|
+
@died = died
|
34
|
+
@disambiguation = disambiguation
|
35
|
+
@disbanded = disbanded
|
36
|
+
@formed = formed
|
37
|
+
@gender = gender
|
38
|
+
@instrument = instrument
|
39
|
+
@is_album_artist = is_album_artist
|
40
|
+
@mood = mood
|
41
|
+
@musicbrainz_artist_id = musicbrainz_artist_id
|
42
|
+
@roles = roles
|
43
|
+
@song_genres = song_genres
|
44
|
+
@sort_name = sort_name
|
45
|
+
@source_id = source_id
|
46
|
+
@style = style
|
47
|
+
@type = type
|
48
|
+
@years_active = years_active
|
49
|
+
audio_details_base(art, date_added, genre, fan_art, thumbnail, label)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -16,9 +16,10 @@ module KodiClient
|
|
16
16
|
|
17
17
|
def audio_details_media_by_hash(hash)
|
18
18
|
audio_details_media(*Extensions::Creatable.hash_to_arr(hash, %w[artist artist_id display_artist
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
musicbrainz_album_artist_id original_date
|
20
|
+
rating release_date sort_artist title
|
21
|
+
user_rating votes year art date_added
|
22
|
+
genre fan_art thumbnail label],
|
22
23
|
audio_details_base_mappings))
|
23
24
|
end
|
24
25
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# Audio.Details.Role https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Details.Role
|
7
|
+
class AudioDetailsRole
|
8
|
+
include Items::ItemDetailsBase
|
9
|
+
include Extensions::Comparable
|
10
|
+
extend Extensions::Creatable
|
11
|
+
|
12
|
+
attr_reader :role_id, :title
|
13
|
+
|
14
|
+
fields_to_map %w[role_id title label]
|
15
|
+
|
16
|
+
def initialize(role_id, title, label)
|
17
|
+
@role_id = role_id
|
18
|
+
@title = title
|
19
|
+
item_details_base(label)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# Audio.Details.Song https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Details.Song
|
7
|
+
class AudioDetailsSong
|
8
|
+
include AudioDetailsMedia
|
9
|
+
include Extensions::Comparable
|
10
|
+
extend Extensions::Creatable
|
11
|
+
extend AudioDetailsMedia
|
12
|
+
|
13
|
+
attr_reader :album, :album_artist, :album_artist_id, :album_id, :album_release_type, :bitrate, :bpm, :channels,
|
14
|
+
:comment, :contributors, :disc, :disc_title, :display_composer, :display_conductor,
|
15
|
+
:display_lyricist, :display_orchestra, :duration, :file, :genre_id, :last_played, :lyrics, :mood,
|
16
|
+
:musicbrainz_artist_id, :musicbrainz_track_id, :play_count, :sample_rate, :song_id, :source_id,
|
17
|
+
:track
|
18
|
+
|
19
|
+
fields_to_map %w[album album_artist album_artist_id album_id album_release_type bitrate bpm channels
|
20
|
+
comment contributors disc disc_title display_composer display_conductor display_lyricist
|
21
|
+
display_orchestra duration file genre_id last_played lyrics mood musicbrainz_artist_id
|
22
|
+
musicbrainz_track_id play_count sample_rate song_id source_id track
|
23
|
+
artist artist_id display_artist musicbrainz_album_artist_id original_date
|
24
|
+
rating release_date sort_artist title user_rating votes year
|
25
|
+
art date_added genre fan_art thumbnail label]
|
26
|
+
|
27
|
+
def self.lazy_type_mapping
|
28
|
+
mapping = { 'contributors' => Extensions::Creatable::CreateMap.new(Types::Audio::AudioContributor, true) }
|
29
|
+
mapping.merge(audio_details_media_mappings)
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize(album, album_artist, album_artist_id, album_id, album_release_type, bitrate, bpm, channels,
|
33
|
+
comment, contributors, disc, disc_title, display_composer, display_conductor, display_lyricist,
|
34
|
+
display_orchestra, duration, file, genre_id, last_played, lyrics, mood, musicbrainz_artist_id,
|
35
|
+
musicbrainz_track_id, play_count, sample_rate, song_id, source_id, track,
|
36
|
+
artist, artist_id, display_artist, musicbrainz_album_artist_id, original_date,
|
37
|
+
rating, release_date, sort_artist, title, user_rating, votes, year,
|
38
|
+
art, date_added, genre, fan_art, thumbnail, label)
|
39
|
+
@album = album
|
40
|
+
@album_artist = album_artist
|
41
|
+
@album_artist_id = album_artist_id
|
42
|
+
@album_id = album_id
|
43
|
+
@album_release_type = album_release_type
|
44
|
+
@bitrate = bitrate
|
45
|
+
@bpm = bpm
|
46
|
+
@channels = channels
|
47
|
+
@comment = comment
|
48
|
+
@contributors = contributors
|
49
|
+
@disc = disc
|
50
|
+
@disc_title = disc_title
|
51
|
+
@display_composer = display_composer
|
52
|
+
@display_conductor = display_conductor
|
53
|
+
@display_lyricist = display_lyricist
|
54
|
+
@display_orchestra = display_orchestra
|
55
|
+
@duration = duration
|
56
|
+
@file = file
|
57
|
+
@genre_id = genre_id
|
58
|
+
@last_played = last_played
|
59
|
+
@lyrics = lyrics
|
60
|
+
@mood = mood
|
61
|
+
@musicbrainz_artist_id = musicbrainz_artist_id
|
62
|
+
@musicbrainz_track_id = musicbrainz_track_id
|
63
|
+
@play_count = play_count
|
64
|
+
@sample_rate = sample_rate
|
65
|
+
@song_id = song_id
|
66
|
+
@source_id = source_id
|
67
|
+
@track = track
|
68
|
+
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
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# Audio.Fields.Artist https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Fields.Artist
|
7
|
+
module AudioFieldsArtist
|
8
|
+
extend Extensions::Iterable
|
9
|
+
|
10
|
+
INSTRUMENT = 'instrument'
|
11
|
+
STYLE = 'style'
|
12
|
+
MOOD = 'mood'
|
13
|
+
BORN = 'born'
|
14
|
+
FORMED = 'formed'
|
15
|
+
DESCRIPTION = 'description'
|
16
|
+
GENRE = 'genre'
|
17
|
+
DIED = 'died'
|
18
|
+
DISBANDED = 'disbanded'
|
19
|
+
YEARS_ACTIVE = 'yearsactive'
|
20
|
+
MUSICBRAINZ_ARTIST_ID = 'musicbrainzartistid'
|
21
|
+
FAN_ART = 'fanart'
|
22
|
+
THUMBNAIL = 'thumbnail'
|
23
|
+
COMPILATION_ARTIST = 'compilationartist'
|
24
|
+
DATE_ADDED = 'dateadded'
|
25
|
+
ROLES = 'roles'
|
26
|
+
SONG_GENRES = 'songgenres'
|
27
|
+
IS_ALBUM_ARTIST = 'isalbumartist'
|
28
|
+
SORT_NAME = 'sortname'
|
29
|
+
TYPE = 'type'
|
30
|
+
GENDER = 'gender'
|
31
|
+
DISAMBIGUATION = 'disambiguation'
|
32
|
+
ART = 'art'
|
33
|
+
SOURCE_ID = 'sourceid'
|
34
|
+
DATE_MODIFIED = 'datemodified'
|
35
|
+
DATE_NEW = 'datenew'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# Audio.Fields.Role https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Fields.Role
|
7
|
+
module AudioFieldsRole
|
8
|
+
extend Extensions::Iterable
|
9
|
+
|
10
|
+
TITLE = 'title'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# Audio.Fields.Song https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Fields.Song
|
7
|
+
module AudioFieldsSong
|
8
|
+
extend Extensions::Iterable
|
9
|
+
|
10
|
+
TITLE = 'title'
|
11
|
+
ARTIST = 'artist'
|
12
|
+
ALBUM_ARTIST = 'albumartist'
|
13
|
+
GENRE = 'genre'
|
14
|
+
YEAR = 'year'
|
15
|
+
RATING = 'rating'
|
16
|
+
ALBUM = 'album'
|
17
|
+
TRACK = 'track'
|
18
|
+
DURATION = 'duration'
|
19
|
+
COMMENT = 'comment'
|
20
|
+
LYRICS = 'lyrics'
|
21
|
+
MUSICBRAINZ_TRACK_ID = 'musicbrainztrackid'
|
22
|
+
MUSICBRAINZ_ARTIST_ID = 'musicbrainzartistid'
|
23
|
+
MUSICBRAINZ_ALBUM_ID = 'musicbrainzalbumid'
|
24
|
+
MUSICBRAINZ_ALBUM_ARTIST_ID = 'musicbrainzalbumartistid'
|
25
|
+
PLAY_COUNT = 'playcount'
|
26
|
+
FAN_ART = 'fanart'
|
27
|
+
THUMBNAIL = 'thumbnail'
|
28
|
+
FILE = 'file'
|
29
|
+
ALBUM_ID = 'albumid'
|
30
|
+
LAST_PLAYED = 'lastplayed'
|
31
|
+
DISC = 'disc'
|
32
|
+
GENRE_ID = 'genreid'
|
33
|
+
ARTIST_ID = 'artistid'
|
34
|
+
DISPLAY_ARTIST = 'displayartist'
|
35
|
+
ALBUM_ARTIST_ID = 'albumartistid'
|
36
|
+
ALBUM_RELEASE_TYPE = 'albumreleasetype'
|
37
|
+
DATE_ADDED = 'dateadded'
|
38
|
+
VOTES = 'votes'
|
39
|
+
USER_RATING = 'userrating'
|
40
|
+
MOOD = 'mood'
|
41
|
+
CONTRIBUTORS = 'contributors'
|
42
|
+
DISPLAY_COMPOSER = 'displaycomposer'
|
43
|
+
DISPLAY_CONDUCTOR = 'displayconductor'
|
44
|
+
DISPLAY_ORCHESTRA = 'displayorchestra'
|
45
|
+
DISPLAY_LYRICIST = 'displaylyricist'
|
46
|
+
SORT_ARTIST = 'sortartist'
|
47
|
+
ART = 'art'
|
48
|
+
SOURCE_ID = 'sourceid'
|
49
|
+
DISC_TITLE = 'disctitle'
|
50
|
+
RELEASE_DATE = 'releasedate'
|
51
|
+
ORIGINAL_DATE = 'originaldate'
|
52
|
+
BPM = 'bpm'
|
53
|
+
SAMPLE_RATE = 'samplerate'
|
54
|
+
BITRATE = 'bitrate'
|
55
|
+
CHANNELS = 'channels'
|
56
|
+
DATE_MODIFIED = 'datemodified'
|
57
|
+
DATE_NEW = 'datenew'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# AudioLibrary.GetAvailableArt https://kodi.wiki/view/JSON-RPC_API/v12#AudioLibrary.GetAvailableArt
|
7
|
+
class AvailableArt
|
8
|
+
include Extensions::Comparable
|
9
|
+
extend Extensions::Creatable
|
10
|
+
|
11
|
+
attr_reader :art_type, :preview_url, :url
|
12
|
+
|
13
|
+
def initialize(art_type, preview_url, url)
|
14
|
+
@art_type = art_type
|
15
|
+
@preview_url = preview_url
|
16
|
+
@url = url
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -10,7 +10,7 @@ module KodiClient
|
|
10
10
|
|
11
11
|
attr_reader :albums, :limits
|
12
12
|
|
13
|
-
type_mapping ['albums',
|
13
|
+
type_mapping ['albums', AudioDetailsAlbum, true], ['limits', List::ListLimitsReturned]
|
14
14
|
|
15
15
|
def initialize(albums, limits)
|
16
16
|
@albums = albums
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# return type for AudioLibrary.GetAlbums
|
7
|
+
class GetArtistsReturned
|
8
|
+
include Extensions::Comparable
|
9
|
+
extend Extensions::Creatable
|
10
|
+
|
11
|
+
attr_reader :artists, :limits
|
12
|
+
|
13
|
+
type_mapping ['artists', AudioDetailsArtist, true], ['limits', List::ListLimitsReturned]
|
14
|
+
|
15
|
+
def initialize(artists, limits)
|
16
|
+
@artists = artists
|
17
|
+
@limits = limits
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# return type for AudioLibrary.GetGenres
|
7
|
+
class GetGenresReturned
|
8
|
+
include Extensions::Comparable
|
9
|
+
extend Extensions::Creatable
|
10
|
+
|
11
|
+
attr_reader :genres, :limits
|
12
|
+
|
13
|
+
type_mapping ['genres', Library::LibraryDetailsGenre, true], ['limits', List::ListLimitsReturned]
|
14
|
+
|
15
|
+
def initialize(genres, limits)
|
16
|
+
@genres = genres
|
17
|
+
@limits = limits
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# return type for AudioLibrary.GetRoles
|
7
|
+
class GetRolesReturned
|
8
|
+
include Extensions::Comparable
|
9
|
+
extend Extensions::Creatable
|
10
|
+
|
11
|
+
attr_reader :roles, :limits
|
12
|
+
|
13
|
+
type_mapping ['roles', AudioDetailsRole, true], ['limits', List::ListLimitsReturned]
|
14
|
+
|
15
|
+
def initialize(roles, limits)
|
16
|
+
@roles = roles
|
17
|
+
@limits = limits
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# return type for AudioLibrary.GetSongs
|
7
|
+
class GetSongsReturned
|
8
|
+
include Extensions::Comparable
|
9
|
+
extend Extensions::Creatable
|
10
|
+
|
11
|
+
attr_reader :songs, :limits
|
12
|
+
|
13
|
+
type_mapping ['songs', Audio::AudioDetailsSong, true], ['limits', List::ListLimitsReturned]
|
14
|
+
|
15
|
+
def initialize(songs, limits)
|
16
|
+
@songs = songs
|
17
|
+
@limits = limits
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# return type for AudioLibrary.GetSources
|
7
|
+
class GetSourcesReturned
|
8
|
+
include Extensions::Comparable
|
9
|
+
extend Extensions::Creatable
|
10
|
+
|
11
|
+
attr_reader :sources, :limits
|
12
|
+
|
13
|
+
type_mapping ['sources', Library::AudioDetailsSource, true], ['limits', List::ListLimitsReturned]
|
14
|
+
|
15
|
+
def initialize(sources, limits)
|
16
|
+
@sources = sources
|
17
|
+
@limits = limits
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# Audio.Property.Name https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Property.Name
|
7
|
+
module PropertyName
|
8
|
+
extend Extensions::Iterable
|
9
|
+
|
10
|
+
MISSING_ARTIST_ID = 'missingartistid'
|
11
|
+
LIBRARY_LAST_UPDATED ='librarylastupdated'
|
12
|
+
LIBRARY_LAST_CLEANED = 'librarylastcleaned'
|
13
|
+
ARTIST_LINKS_UPDATED = 'artistlinksupdated'
|
14
|
+
SONGS_LAST_ADDED = 'songslastadded'
|
15
|
+
ALBUMS_LAST_ADDED = 'albumslastadded'
|
16
|
+
ARTISTS_LAST_ADDED = 'artistslastadded'
|
17
|
+
GENRES_LAST_ADDED = 'genreslastadded'
|
18
|
+
SONGS_MODIFIED = 'songsmodified'
|
19
|
+
ALBUMS_MODIFIED = 'albumsmodified'
|
20
|
+
ARTISTS_MODIFIED = 'artistsmodified'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Audio
|
6
|
+
# Audio.Property.Value https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Property.Value
|
7
|
+
class PropertyValue
|
8
|
+
include Extensions::Comparable
|
9
|
+
extend Extensions::Creatable
|
10
|
+
|
11
|
+
attr_reader :albums_last_added, :albums_modified, :artist_links_updated, :artists_last_added,
|
12
|
+
:artists_modified, :genres_last_added, :library_last_cleaned, :library_last_updated,
|
13
|
+
:missing_artist_id, :songs_last_added, :songs_modified
|
14
|
+
|
15
|
+
def initialize(albums_last_added, albums_modified, artist_links_updated, artists_last_added, artists_modified,
|
16
|
+
genres_last_added, library_last_cleaned, library_last_updated, missing_artist_id,
|
17
|
+
songs_last_added, songs_modified)
|
18
|
+
@albums_last_added = albums_last_added
|
19
|
+
@albums_modified = albums_modified
|
20
|
+
@artist_links_updated = artist_links_updated
|
21
|
+
@artists_last_added = artists_last_added
|
22
|
+
@artists_modified = artists_modified
|
23
|
+
@genres_last_added = genres_last_added
|
24
|
+
@library_last_cleaned = library_last_cleaned
|
25
|
+
@library_last_updated = library_last_updated
|
26
|
+
@missing_artist_id = missing_artist_id
|
27
|
+
@songs_last_added = songs_last_added
|
28
|
+
@songs_modified = songs_modified
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Library
|
6
|
+
# Library.Details.Genre https://kodi.wiki/view/JSON-RPC_API/v12#Library.Details.Genre
|
7
|
+
class LibraryDetailsGenre
|
8
|
+
include Items::ItemDetailsBase
|
9
|
+
include Extensions::Comparable
|
10
|
+
extend Extensions::Creatable
|
11
|
+
|
12
|
+
attr_reader :title, :thumbnail, :source_id
|
13
|
+
|
14
|
+
fields_to_map %w[genre_id source_id thumbnail title label]
|
15
|
+
|
16
|
+
def initialize(genre_id, source_id, thumbnail, title, label)
|
17
|
+
@genre_id = genre_id
|
18
|
+
@title = title
|
19
|
+
@thumbnail = thumbnail
|
20
|
+
@source_id = source_id
|
21
|
+
item_details_base(label)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Library
|
6
|
+
# Library.Details.Source https://kodi.wiki/view/JSON-RPC_API/v12#Library.Details.Source
|
7
|
+
class AudioDetailsSource
|
8
|
+
include Items::ItemDetailsBase
|
9
|
+
include Extensions::Comparable
|
10
|
+
extend Extensions::Creatable
|
11
|
+
|
12
|
+
attr_reader :file, :paths, :source_id
|
13
|
+
|
14
|
+
fields_to_map %w[file paths source_id label]
|
15
|
+
|
16
|
+
def initialize(file, paths, source_id, label)
|
17
|
+
@file = file
|
18
|
+
@paths = paths
|
19
|
+
@source_id = source_id
|
20
|
+
item_details_base(label)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Library
|
6
|
+
# Library.Fields.Genre https://kodi.wiki/view/JSON-RPC_API/v12#Library.Fields.Genre
|
7
|
+
module LibraryFieldsGenre
|
8
|
+
extend Extensions::Iterable
|
9
|
+
|
10
|
+
TITLE = 'title'
|
11
|
+
THUMBNAIL = 'thumbnail'
|
12
|
+
SOURCE_ID = 'sourceid'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Library
|
6
|
+
# Library.Fields.Source https://kodi.wiki/view/JSON-RPC_API/v12#Library.Fields.Source
|
7
|
+
module LibraryFieldsSource
|
8
|
+
extend Extensions::Iterable
|
9
|
+
|
10
|
+
FILE = 'file'
|
11
|
+
PATHS = 'paths'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
@@ -16,6 +16,12 @@ module KodiClient
|
|
16
16
|
@order = sort_order
|
17
17
|
@use_artist_sort_name = use_artist_sort_name
|
18
18
|
end
|
19
|
+
|
20
|
+
def to_h
|
21
|
+
{ 'ignorearticle' => @ignore_article, 'method' => @method,
|
22
|
+
'order' => @order,
|
23
|
+
'useartistsortname' => @use_artist_sort_name }
|
24
|
+
end
|
19
25
|
end
|
20
26
|
end
|
21
27
|
end
|
data/lib/kodi_client.rb
CHANGED
@@ -70,14 +70,34 @@ require 'kodi_client/types/player/player_position_time_type'
|
|
70
70
|
require 'kodi_client/types/player/seek_jump_type'
|
71
71
|
require 'kodi_client/types/player/seek_returned_type'
|
72
72
|
|
73
|
+
require 'kodi_client/types/library/library_fields_genre_type'
|
74
|
+
require 'kodi_client/types/library/library_details_genre_type'
|
75
|
+
require 'kodi_client/types/library/library_fields_source_type'
|
76
|
+
require 'kodi_client/types/library/library_details_source_type'
|
77
|
+
|
73
78
|
require 'kodi_client/types/audio/audio_contributor_type'
|
74
79
|
require 'kodi_client/types/audio/audio_album_release_type_type'
|
75
80
|
require 'kodi_client/types/audio/audio_details_base_type'
|
76
81
|
require 'kodi_client/types/audio/audio_details_media_type'
|
77
82
|
require 'kodi_client/types/audio/audio_fields_album_type'
|
78
83
|
require 'kodi_client/types/audio/genre_type'
|
79
|
-
require 'kodi_client/types/audio/
|
84
|
+
require 'kodi_client/types/audio/audio_details_album_type'
|
80
85
|
require 'kodi_client/types/audio/get_albums_returned_type'
|
86
|
+
require 'kodi_client/types/audio/audio_artist_role_type'
|
87
|
+
require 'kodi_client/types/audio/audio_fields_artist_type'
|
88
|
+
require 'kodi_client/types/audio/audio_details_artist_type'
|
89
|
+
require 'kodi_client/types/audio/get_artists_returned_type'
|
90
|
+
require 'kodi_client/types/audio/available_art_type'
|
91
|
+
require 'kodi_client/types/audio/get_genres_returned_type'
|
92
|
+
require 'kodi_client/types/audio/property_name_type'
|
93
|
+
require 'kodi_client/types/audio/property_value_type'
|
94
|
+
require 'kodi_client/types/audio/audio_fields_song_type'
|
95
|
+
require 'kodi_client/types/audio/audio_details_song_type'
|
96
|
+
require 'kodi_client/types/audio/get_songs_returned_type'
|
97
|
+
require 'kodi_client/types/audio/audio_fields_role_type'
|
98
|
+
require 'kodi_client/types/audio/audio_details_role_type'
|
99
|
+
require 'kodi_client/types/audio/get_roles_returned_type'
|
100
|
+
require 'kodi_client/types/audio/get_sources_return_type'
|
81
101
|
|
82
102
|
require 'kodi_client/types/video/video_details_base_type'
|
83
103
|
require 'kodi_client/types/video/video_cast_type'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kodi_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Feier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -25,9 +25,9 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 5.0.4
|
27
27
|
description: A client for the Kodi JSON API v12, currently implemented methods are
|
28
|
-
Addons, Application, Favourites, Files, GUI, Input, Player, Profiles
|
29
|
-
(more will be added with the time). For more information how to use it
|
30
|
-
activate Remote Control in Kodi, please check the github page https://github.com/cfe86/RubyKodiClient
|
28
|
+
Addons, Application, AudioLibrary Favourites, Files, GUI, Input, Player, Profiles
|
29
|
+
and System (more will be added with the time). For more information how to use it
|
30
|
+
and how to activate Remote Control in Kodi, please check the github page https://github.com/cfe86/RubyKodiClient
|
31
31
|
email:
|
32
32
|
- christian.feier@gmail.com
|
33
33
|
executables: []
|
@@ -73,13 +73,28 @@ files:
|
|
73
73
|
- lib/kodi_client/types/application/property_value_type.rb
|
74
74
|
- lib/kodi_client/types/application/version_type.rb
|
75
75
|
- lib/kodi_client/types/audio/audio_album_release_type_type.rb
|
76
|
+
- lib/kodi_client/types/audio/audio_artist_role_type.rb
|
76
77
|
- lib/kodi_client/types/audio/audio_contributor_type.rb
|
78
|
+
- lib/kodi_client/types/audio/audio_details_album_type.rb
|
79
|
+
- lib/kodi_client/types/audio/audio_details_artist_type.rb
|
77
80
|
- lib/kodi_client/types/audio/audio_details_base_type.rb
|
78
81
|
- lib/kodi_client/types/audio/audio_details_media_type.rb
|
82
|
+
- lib/kodi_client/types/audio/audio_details_role_type.rb
|
83
|
+
- lib/kodi_client/types/audio/audio_details_song_type.rb
|
79
84
|
- lib/kodi_client/types/audio/audio_fields_album_type.rb
|
80
|
-
- lib/kodi_client/types/audio/
|
85
|
+
- lib/kodi_client/types/audio/audio_fields_artist_type.rb
|
86
|
+
- lib/kodi_client/types/audio/audio_fields_role_type.rb
|
87
|
+
- lib/kodi_client/types/audio/audio_fields_song_type.rb
|
88
|
+
- lib/kodi_client/types/audio/available_art_type.rb
|
81
89
|
- lib/kodi_client/types/audio/genre_type.rb
|
82
90
|
- lib/kodi_client/types/audio/get_albums_returned_type.rb
|
91
|
+
- lib/kodi_client/types/audio/get_artists_returned_type.rb
|
92
|
+
- lib/kodi_client/types/audio/get_genres_returned_type.rb
|
93
|
+
- lib/kodi_client/types/audio/get_roles_returned_type.rb
|
94
|
+
- lib/kodi_client/types/audio/get_songs_returned_type.rb
|
95
|
+
- lib/kodi_client/types/audio/get_sources_return_type.rb
|
96
|
+
- lib/kodi_client/types/audio/property_name_type.rb
|
97
|
+
- lib/kodi_client/types/audio/property_value_type.rb
|
83
98
|
- lib/kodi_client/types/favourites/details_favourite_type.rb
|
84
99
|
- lib/kodi_client/types/favourites/fields_favourite_type.rb
|
85
100
|
- lib/kodi_client/types/favourites/get_favourite_returned_type.rb
|
@@ -104,6 +119,10 @@ files:
|
|
104
119
|
- lib/kodi_client/types/gui/stereoscopy_mode_type.rb
|
105
120
|
- lib/kodi_client/types/input/input_action_type.rb
|
106
121
|
- lib/kodi_client/types/items/item_details_base_type.rb
|
122
|
+
- lib/kodi_client/types/library/library_details_genre_type.rb
|
123
|
+
- lib/kodi_client/types/library/library_details_source_type.rb
|
124
|
+
- lib/kodi_client/types/library/library_fields_genre_type.rb
|
125
|
+
- lib/kodi_client/types/library/library_fields_source_type.rb
|
107
126
|
- lib/kodi_client/types/list/list_field_files_type.rb
|
108
127
|
- lib/kodi_client/types/list/list_fields_all_type.rb
|
109
128
|
- lib/kodi_client/types/list/list_item_all_type.rb
|