kodi_client 0.5.6 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/kodi_client.gemspec +3 -3
- data/lib/kodi_client/Chainable.rb +4 -1
- data/lib/kodi_client/global_types/addon_types.rb +50 -52
- data/lib/kodi_client/global_types/application_types.rb +21 -23
- data/lib/kodi_client/global_types/audio_types.rb +179 -29
- data/lib/kodi_client/global_types/favourites_types.rb +14 -17
- data/lib/kodi_client/global_types/files_types.rb +68 -0
- data/lib/kodi_client/global_types/global_types.rb +18 -24
- data/lib/kodi_client/global_types/gui_types.rb +15 -16
- data/lib/kodi_client/global_types/item_types.rb +10 -2
- data/lib/kodi_client/global_types/list_types.rb +326 -98
- data/lib/kodi_client/global_types/media_types.rb +21 -13
- data/lib/kodi_client/global_types/player_type.rb +110 -110
- data/lib/kodi_client/global_types/profiles_types.rb +14 -14
- data/lib/kodi_client/global_types/system_types.rb +7 -9
- data/lib/kodi_client/global_types/video_types.rb +80 -43
- data/lib/kodi_client/method/addons.rb +7 -19
- data/lib/kodi_client/method/application.rb +1 -1
- data/lib/kodi_client/method/audio_library.rb +49 -0
- 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 +2 -2
- 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 +106 -0
- data/lib/kodi_client.rb +10 -10
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55af2b109bf693f6b075bb970df32dd482a1121926fe49be441b8a2d66c261f3
|
4
|
+
data.tar.gz: a452bd1c62c4e08dcac98f5a1a6ad87ac7ae9cf7c3f38932fc2c470ab0d065ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c93a1b6fe7ec129f2e3bf900f8e45431d8e8393111cb01c935d1c682204ec205cbae26d701d20bfac28db976566d942fe0d9ca178afb43720ea22bb6101191c
|
7
|
+
data.tar.gz: b190ebfb0aa383686cc76503cc8b234f3730cc7bd230e36c0cc4ed226db400566ebd90db14ffeafcb481284d1ac39bc35ea2471a742c27799aa67e6d7824a871
|
data/README.md
CHANGED
data/kodi_client.gemspec
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'kodi_client'
|
5
|
-
spec.version = '0.
|
5
|
+
spec.version = '0.6.2'
|
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
|
11
|
-
'
|
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
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'
|
14
14
|
spec.homepage = 'https://github.com/cfe86/RubyKodiClient'
|
@@ -9,6 +9,7 @@ module KodiClient
|
|
9
9
|
attr_accessor :options, :client
|
10
10
|
|
11
11
|
def connect(ip, port)
|
12
|
+
@client = KodiClient::Client.new
|
12
13
|
merge_options(->(options) { options.with_connection(ip, port) })
|
13
14
|
end
|
14
15
|
|
@@ -24,7 +25,7 @@ module KodiClient
|
|
24
25
|
client = def_client
|
25
26
|
options = def_options
|
26
27
|
set_command.call(options)
|
27
|
-
client.
|
28
|
+
client.apply_options_to_methods(options)
|
28
29
|
client
|
29
30
|
end
|
30
31
|
|
@@ -43,5 +44,7 @@ module KodiClient
|
|
43
44
|
end
|
44
45
|
@options
|
45
46
|
end
|
47
|
+
|
48
|
+
private :def_client, :def_options, :merge_options
|
46
49
|
end
|
47
50
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'kodi_client/global_types/item_types'
|
4
|
+
require 'kodi_client/global_types/list_types'
|
4
5
|
require 'kodi_client/util/comparable'
|
5
6
|
require 'kodi_client/util/iterable'
|
7
|
+
require 'kodi_client/util/creatable'
|
6
8
|
|
7
9
|
module KodiClient
|
8
10
|
module Types
|
@@ -10,7 +12,7 @@ module KodiClient
|
|
10
12
|
|
11
13
|
# Addon Types https://kodi.wiki/view/JSON-RPC_API/v12#Addon.Types
|
12
14
|
module AddonTypes
|
13
|
-
|
15
|
+
extend Iterable
|
14
16
|
|
15
17
|
UNKNOWN = 'unknown'
|
16
18
|
KODI_ADSP = 'kodi.adsp'
|
@@ -51,7 +53,8 @@ module KodiClient
|
|
51
53
|
|
52
54
|
# Addon.Content https://kodi.wiki/view/JSON-RPC_API/v12#Addon.Content
|
53
55
|
module AddonContent
|
54
|
-
|
56
|
+
extend Iterable
|
57
|
+
|
55
58
|
UNKNOWN = 'unknown'
|
56
59
|
AUDIO = 'audio'
|
57
60
|
EXECUTABLE = 'executable'
|
@@ -83,33 +86,27 @@ module KodiClient
|
|
83
86
|
# represents addon dependency
|
84
87
|
class AddonDependency
|
85
88
|
include Comparable
|
89
|
+
extend Creatable
|
86
90
|
|
87
|
-
attr_reader :
|
91
|
+
attr_reader :addon_id, :optional, :version
|
88
92
|
|
89
|
-
def initialize(
|
90
|
-
@
|
91
|
-
@optional =
|
92
|
-
@version =
|
93
|
-
end
|
94
|
-
|
95
|
-
def ==(other)
|
96
|
-
compare(self, other)
|
93
|
+
def initialize(addon_id, optional, version)
|
94
|
+
@addon_id = addon_id
|
95
|
+
@optional = optional
|
96
|
+
@version = version
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
100
|
# represents addon extra info
|
101
101
|
class AddonExtraInfo
|
102
102
|
include Comparable
|
103
|
+
extend Creatable
|
103
104
|
|
104
105
|
attr_reader :key, :value
|
105
106
|
|
106
|
-
def initialize(
|
107
|
-
@key =
|
108
|
-
@value =
|
109
|
-
end
|
110
|
-
|
111
|
-
def ==(other)
|
112
|
-
compare(self, other)
|
107
|
+
def initialize(key, value)
|
108
|
+
@key = key
|
109
|
+
@value = value
|
113
110
|
end
|
114
111
|
end
|
115
112
|
|
@@ -117,64 +114,65 @@ module KodiClient
|
|
117
114
|
class AddonDetails
|
118
115
|
include Comparable
|
119
116
|
include Items::ItemDetailsBase
|
117
|
+
extend Creatable
|
120
118
|
|
121
119
|
attr_reader :addon_id, :author, :broken, :dependencies, :description, :disclaimer, :enabled, :extra_info,
|
122
120
|
:fan_art, :installed, :name, :path, :rating, :summary, :thumbnail, :type, :version
|
123
121
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
@
|
132
|
-
@
|
133
|
-
@
|
134
|
-
@
|
135
|
-
@
|
136
|
-
@
|
137
|
-
@
|
138
|
-
@
|
139
|
-
@
|
140
|
-
@
|
141
|
-
@
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
122
|
+
fields_to_map %w[addon_id author broken dependencies description disclaimer enabled extra_info fan_art
|
123
|
+
installed name path rating summary thumbnail type version label]
|
124
|
+
|
125
|
+
type_mapping ['dependencies', AddonDependency, true], ['extrainfo', AddonExtraInfo, true]
|
126
|
+
|
127
|
+
def initialize(addon_id, author, broken, dependencies, description, disclaimer, enabled, extra_info,
|
128
|
+
fan_art, installed, name, path, rating, summary, thumbnail, type, version, label)
|
129
|
+
@addon_id = addon_id
|
130
|
+
@author = author
|
131
|
+
@broken = broken
|
132
|
+
@dependencies = dependencies
|
133
|
+
@description = description
|
134
|
+
@disclaimer = disclaimer
|
135
|
+
@enabled = enabled
|
136
|
+
@extra_info = extra_info
|
137
|
+
@fan_art = fan_art
|
138
|
+
@installed = installed
|
139
|
+
@name = name
|
140
|
+
@path = path
|
141
|
+
@rating = rating
|
142
|
+
@summary = summary
|
143
|
+
@thumbnail = thumbnail
|
144
|
+
@type = type
|
145
|
+
@version = version
|
146
|
+
item_details_base(label)
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
150
|
# getAddons return
|
151
151
|
class Addons
|
152
152
|
include Comparable
|
153
|
+
extend Creatable
|
153
154
|
|
154
155
|
attr_reader :addons, :limits
|
155
156
|
|
156
|
-
|
157
|
-
@addons = hash['addons'].map { |it| AddonDetails.new(it) }
|
158
|
-
@limits = List::ListLimitsReturned.new(hash['limits'])
|
159
|
-
end
|
157
|
+
type_mapping ['addons', AddonDetails, true], ['limits', List::ListLimitsReturned]
|
160
158
|
|
161
|
-
def
|
162
|
-
|
159
|
+
def initialize(addons, limits)
|
160
|
+
@addons = addons
|
161
|
+
@limits = limits
|
163
162
|
end
|
164
163
|
end
|
165
164
|
|
166
165
|
# getAddon return
|
167
166
|
class Addon
|
168
167
|
include Comparable
|
168
|
+
extend Creatable
|
169
169
|
|
170
170
|
attr_reader :addon
|
171
171
|
|
172
|
-
|
173
|
-
@addon = AddonDetails.new(hash['addon'])
|
174
|
-
end
|
172
|
+
type_mapping ['addon', AddonDetails]
|
175
173
|
|
176
|
-
def
|
177
|
-
|
174
|
+
def initialize(addon)
|
175
|
+
@addon = addon
|
178
176
|
end
|
179
177
|
end
|
180
178
|
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
|
@@ -19,38 +20,35 @@ module KodiClient
|
|
19
20
|
LANGUAGE = 'language'
|
20
21
|
end
|
21
22
|
|
22
|
-
#
|
23
|
-
class
|
23
|
+
# represent application properties version
|
24
|
+
class Version
|
24
25
|
include Comparable
|
26
|
+
extend Creatable
|
25
27
|
|
26
|
-
attr_reader :
|
27
|
-
|
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']
|
33
|
-
end
|
28
|
+
attr_reader :major, :minor, :revision, :tag
|
34
29
|
|
35
|
-
def
|
36
|
-
|
30
|
+
def initialize(major, minor, revision, tag)
|
31
|
+
@major = major
|
32
|
+
@minor = minor
|
33
|
+
@revision = revision
|
34
|
+
@tag = tag
|
37
35
|
end
|
38
36
|
end
|
39
37
|
|
40
|
-
#
|
41
|
-
class
|
38
|
+
# Application.Property.Value https://kodi.wiki/view/JSON-RPC_API/v12#Application.Property.Value
|
39
|
+
class PropertyValue
|
42
40
|
include Comparable
|
43
|
-
|
41
|
+
extend Creatable
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
@revision = hash['revision']
|
49
|
-
@tag = hash['tag']
|
50
|
-
end
|
43
|
+
attr_reader :name, :version, :muted, :volume
|
44
|
+
|
45
|
+
type_mapping ['version', Version]
|
51
46
|
|
52
|
-
def
|
53
|
-
|
47
|
+
def initialize(name, version, muted, volume)
|
48
|
+
@name = name
|
49
|
+
@version = version
|
50
|
+
@muted = muted
|
51
|
+
@volume = volume
|
54
52
|
end
|
55
53
|
end
|
56
54
|
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'kodi_client/global_types/media_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
|
@@ -11,18 +12,15 @@ module KodiClient
|
|
11
12
|
# Audio.Contributor https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Contributors
|
12
13
|
class AudioContributor
|
13
14
|
include Comparable
|
15
|
+
extend Creatable
|
14
16
|
|
15
17
|
attr_reader :artist_id, :name, :role, :role_id
|
16
18
|
|
17
|
-
def initialize(
|
18
|
-
@artist_id =
|
19
|
-
@name =
|
20
|
-
@role =
|
21
|
-
@role_id =
|
22
|
-
end
|
23
|
-
|
24
|
-
def ==(other)
|
25
|
-
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
|
26
24
|
end
|
27
25
|
end
|
28
26
|
|
@@ -40,11 +38,21 @@ module KodiClient
|
|
40
38
|
|
41
39
|
attr_reader :art, :date_added, :genre
|
42
40
|
|
43
|
-
def
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
41
|
+
def audio_details_base_mappings
|
42
|
+
mappings = { 'art' => Creatable::CreateMap.new(Types::Media::MediaArtwork) }
|
43
|
+
mappings.merge(media_details_base_mappings)
|
44
|
+
end
|
45
|
+
|
46
|
+
def audio_details_base_by_hash(hash)
|
47
|
+
audio_details_base(*Creatable.hash_to_arr(hash, %w[art date_added genre fan_art thumbnail label]),
|
48
|
+
audio_details_base_mappings)
|
49
|
+
end
|
50
|
+
|
51
|
+
def audio_details_base(art, date_added, genre, fan_art, thumbnail, label)
|
52
|
+
@art = art
|
53
|
+
@date_added = date_added
|
54
|
+
@genre = genre
|
55
|
+
media_details_base(fan_art, thumbnail, label)
|
48
56
|
end
|
49
57
|
end
|
50
58
|
|
@@ -52,23 +60,165 @@ module KodiClient
|
|
52
60
|
module AudioDetailsMedia
|
53
61
|
include AudioDetailsBase
|
54
62
|
|
55
|
-
attr_reader :artist, :artist_id, :display_artist, :
|
63
|
+
attr_reader :artist, :artist_id, :display_artist, :musicbrainz_album_artist_id, :original_date, :rating,
|
56
64
|
:release_date, :sort_artist, :title, :user_rating, :votes, :year
|
57
65
|
|
58
|
-
def
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
66
|
+
def audio_details_media_mappings
|
67
|
+
audio_details_base_mappings
|
68
|
+
end
|
69
|
+
|
70
|
+
def audio_details_media_by_hash(hash)
|
71
|
+
audio_details_media(*Creatable.hash_to_arr(hash, %w[artist artist_id display_artist
|
72
|
+
musicbrainz_album_artist_id original_date rating
|
73
|
+
release_date sort_artist title user_rating votes year art
|
74
|
+
date_added genre fan_art thumbnail label],
|
75
|
+
audio_details_base_mappings))
|
76
|
+
end
|
77
|
+
|
78
|
+
def audio_details_media(artist, artist_id, display_artist, musicbrainz_album_artist_id, original_date,
|
79
|
+
rating, release_date, sort_artist, title, user_rating, votes, year,
|
80
|
+
art, date_added, genre, fan_art, thumbnail, label)
|
81
|
+
@artist = artist
|
82
|
+
@artist_id = artist_id
|
83
|
+
@display_artist = display_artist
|
84
|
+
@musicbrainz_album_artist_id = musicbrainz_album_artist_id
|
85
|
+
@original_date = original_date
|
86
|
+
@rating = rating
|
87
|
+
@release_date = release_date
|
88
|
+
@sort_artist = sort_artist
|
89
|
+
@title = title
|
90
|
+
@user_rating = user_rating
|
91
|
+
@votes = votes
|
92
|
+
@year = year
|
93
|
+
audio_details_base(art, date_added, genre, fan_art, thumbnail, label)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Audio.Fields.Album https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Fields.Album
|
98
|
+
module AudioFieldsAlbum
|
99
|
+
extend Iterable
|
100
|
+
|
101
|
+
#album id
|
102
|
+
ALBUM_DURATION = 'albumduration'
|
103
|
+
ALBUM_LABEL = 'albumlabel'
|
104
|
+
ALBUM_STATUS = 'albumstatus'
|
105
|
+
ART = 'art'
|
106
|
+
ARTIST = 'artist'
|
107
|
+
ARTIST_ID = 'artistid'
|
108
|
+
COMPILATION = 'compilation'
|
109
|
+
DATE_ADDED = 'dateadded'
|
110
|
+
DATE_MODIFIED = 'datemodified'
|
111
|
+
DATE_NEW = 'datenew'
|
112
|
+
DESCRIPTION = 'description'
|
113
|
+
DISPLAY_ARTIST = 'displayartist'
|
114
|
+
FAN_ART = 'fanart'
|
115
|
+
GENRE = 'genre'
|
116
|
+
IS_BOX_SET = 'isboxset'
|
117
|
+
LAST_PLAYED = 'lastplayed'
|
118
|
+
MOOD = 'mood'
|
119
|
+
MUSICBRAINZ_ALBUM_ARTIST_ID = 'musicbrainzalbumartistid'
|
120
|
+
MUSICBRAINZ_ALBUM_ID = 'musicbrainzalbumid'
|
121
|
+
MUSICBRAINZ_RELEASE_GROUP_ID = 'musicbrainzreleasegroupid'
|
122
|
+
ORIGINAL_DATE = 'originaldate'
|
123
|
+
PLAY_COUNT = 'playcount'
|
124
|
+
RATING = 'rating'
|
125
|
+
RELEASE_DATE = 'releasedate'
|
126
|
+
RELEASE_TYPE = 'releasetype'
|
127
|
+
SONG_GENRES = 'songgenres'
|
128
|
+
SORT_ARTIST = 'sortartist'
|
129
|
+
SOURCE_ID = 'sourceid'
|
130
|
+
STYLE = 'style'
|
131
|
+
THEME = 'theme'
|
132
|
+
THUMBNAIL = 'thumbnail'
|
133
|
+
TITLE = 'title'
|
134
|
+
TOTAL_DISCS = 'totaldiscs'
|
135
|
+
TYPE = 'type'
|
136
|
+
USER_RATING = 'userrating'
|
137
|
+
VOTES = 'votes'
|
138
|
+
YEAR = 'year'
|
139
|
+
end
|
140
|
+
|
141
|
+
# Audio.Details.Genres https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Details.Genres
|
142
|
+
class Genre
|
143
|
+
include Comparable
|
144
|
+
extend Creatable
|
145
|
+
|
146
|
+
attr_reader :genre_id, :title
|
147
|
+
|
148
|
+
def initialize(genre_id, title)
|
149
|
+
@genre_id = genre_id
|
150
|
+
@title = title
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# Audio.Details.Album https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Details.Album
|
155
|
+
class DetailsAlbum
|
156
|
+
include AudioDetailsMedia
|
157
|
+
include Comparable
|
158
|
+
extend Creatable
|
159
|
+
|
160
|
+
attr_reader :album_duration, :album_id, :album_label, :album_status, :compilation, :date_modified, :date_new,
|
161
|
+
:description, :is_box_set, :last_played, :mood, :musicbrainz_album_id, :musicbrainz_release_group_id,
|
162
|
+
:play_count, :release_type, :song_genres, :source_id, :style, :theme, :total_discs, :type
|
163
|
+
|
164
|
+
fields_to_map %w[album_duration album_id album_label album_status art artist artist_id compilation date_added
|
165
|
+
date_modified date_new description display_artist fan_art genre is_box_set label last_played
|
166
|
+
mood musicbrainz_album_artist_id musicbrainz_album_id musicbrainz_release_group_id
|
167
|
+
original_date play_count rating release_date release_type song_genres sort_artist source_id
|
168
|
+
style theme thumbnail title total_discs type user_rating votes year]
|
169
|
+
|
170
|
+
type_mapping ['songgenres', Genre, true], ['art', Types::Media::MediaArtwork]
|
171
|
+
|
172
|
+
def initialize(album_duration, album_id, album_label, album_status, art, artist, artist_id, compilation,
|
173
|
+
date_added, date_modified, date_new, description, display_artist, fan_art, genre, is_box_set,
|
174
|
+
label, last_played, mood, musicbrainz_album_artist_id, musicbrainz_album_id,
|
175
|
+
musicbrainz_release_group_id, original_date, play_count, rating, release_date, release_type,
|
176
|
+
song_genres, sort_artist, source_id, style, theme, thumbnail, title, total_discs, type,
|
177
|
+
user_rating, votes, year)
|
178
|
+
@album_duration = album_duration
|
179
|
+
@album_id = album_id
|
180
|
+
@album_label = album_label
|
181
|
+
@album_status = album_status
|
182
|
+
@compilation = compilation
|
183
|
+
@date_modified = date_modified
|
184
|
+
@date_new = date_new
|
185
|
+
@description = description
|
186
|
+
@is_box_set = is_box_set
|
187
|
+
@last_played = last_played
|
188
|
+
@mood = mood
|
189
|
+
@musicbrainz_album_id = musicbrainz_album_id
|
190
|
+
@musicbrainz_release_group_id = musicbrainz_release_group_id
|
191
|
+
@play_count = play_count
|
192
|
+
@release_type = release_type
|
193
|
+
@song_genres = song_genres
|
194
|
+
@source_id = source_id
|
195
|
+
@style = style
|
196
|
+
@theme = theme
|
197
|
+
@total_discs = total_discs
|
198
|
+
@type = type
|
199
|
+
audio_details_media(artist, artist_id, display_artist, musicbrainz_album_artist_id, original_date,
|
200
|
+
rating, release_date, sort_artist, title, user_rating, votes, year,
|
201
|
+
art, date_added, genre, fan_art, thumbnail, label)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# return type for AudioLibrary.GetAlbums
|
206
|
+
class GetAlbumsReturned
|
207
|
+
include Comparable
|
208
|
+
extend Creatable
|
209
|
+
|
210
|
+
attr_reader :albums, :limits
|
211
|
+
|
212
|
+
def self.lazy_type_mapping
|
213
|
+
{
|
214
|
+
'albums' => Creatable::CreateMap.new(DetailsAlbum, true),
|
215
|
+
'limits' => Creatable::CreateMap.new(List::ListLimitsReturned)
|
216
|
+
}
|
217
|
+
end
|
218
|
+
|
219
|
+
def initialize(albums, limits)
|
220
|
+
@albums = albums
|
221
|
+
@limits = limits
|
72
222
|
end
|
73
223
|
end
|
74
224
|
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
|
@@ -32,36 +33,32 @@ module KodiClient
|
|
32
33
|
# Favourite.Details.Favourite https://kodi.wiki/view/JSON-RPC_API/v12#Favourite.Details.Favourite
|
33
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
|
-
|
59
|
-
@favourites = hash['favourites'].map { |it| DetailsFavourite.new(it) }
|
60
|
-
@limits = Types::List::ListLimitsReturned.new(hash['limits'])
|
61
|
-
end
|
57
|
+
type_mapping ['favourites', DetailsFavourite, true], ['limits', Types::List::ListLimitsReturned]
|
62
58
|
|
63
|
-
def
|
64
|
-
|
59
|
+
def initialize(favourites, limits)
|
60
|
+
@favourites = favourites
|
61
|
+
@limits = limits
|
65
62
|
end
|
66
63
|
end
|
67
64
|
end
|
@@ -0,0 +1,68 @@
|
|
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
|
+
type_mapping ['files', List::ListItemFile, true], ['limits', List::ListLimitsReturned]
|
31
|
+
|
32
|
+
def initialize(files, limits)
|
33
|
+
@files = files
|
34
|
+
@limits = limits
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# return value for GetSources
|
39
|
+
class GetSourcesReturned
|
40
|
+
include Comparable
|
41
|
+
extend Creatable
|
42
|
+
|
43
|
+
attr_reader :sources, :limits
|
44
|
+
|
45
|
+
type_mapping ['sources', List::FileLabel, true], ['limits', List::ListLimitsReturned]
|
46
|
+
|
47
|
+
def initialize(sources, limits)
|
48
|
+
@sources = sources
|
49
|
+
@limits = limits
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# return value for GetPrepareDownload
|
54
|
+
class PrepareDownloadReturned
|
55
|
+
include Comparable
|
56
|
+
extend Creatable
|
57
|
+
|
58
|
+
attr_reader :details, :mode, :protocol
|
59
|
+
|
60
|
+
def initialize(details, mode, protocol)
|
61
|
+
@details = details
|
62
|
+
@mode = mode
|
63
|
+
@protocol = protocol
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|