kodi_client 0.6.3 → 0.7.2
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/.rubocop.yml +2 -0
- data/README.md +1 -0
- data/kodi_client.gemspec +2 -2
- data/lib/kodi_client/extensions/chainable.rb +73 -0
- data/lib/kodi_client/extensions/comparable.rb +29 -0
- data/lib/kodi_client/extensions/creatable.rb +132 -0
- data/lib/kodi_client/extensions/iterable.rb +14 -0
- data/lib/kodi_client/kodi_error.rb +14 -0
- data/lib/kodi_client/kodi_method.rb +34 -0
- data/lib/kodi_client/{options.rb → kodi_options.rb} +1 -1
- data/lib/kodi_client/kodi_request.rb +16 -0
- data/lib/kodi_client/kodi_response.rb +21 -0
- data/lib/kodi_client/{method → methods}/addons.rb +6 -6
- data/lib/kodi_client/{method → methods}/application.rb +2 -2
- data/lib/kodi_client/methods/audio_library.rb +334 -0
- data/lib/kodi_client/{method → methods}/favourites.rb +2 -2
- data/lib/kodi_client/{method → methods}/files.rb +6 -10
- data/lib/kodi_client/{method → methods}/gui.rb +2 -2
- data/lib/kodi_client/{method → methods}/input.rb +2 -2
- data/lib/kodi_client/{method → methods}/player.rb +2 -2
- data/lib/kodi_client/{method → methods}/profiles.rb +5 -7
- data/lib/kodi_client/{method → methods}/system.rb +2 -2
- data/lib/kodi_client/methods/video_library.rb +18 -0
- data/lib/kodi_client/types/addons/addon_content_type.rb +18 -0
- data/lib/kodi_client/types/addons/addon_dependency_type.rb +21 -0
- data/lib/kodi_client/types/addons/addon_details_type.rb +44 -0
- data/lib/kodi_client/types/addons/addon_extra_info_type.rb +20 -0
- data/lib/kodi_client/types/addons/addon_fields_type.rb +28 -0
- data/lib/kodi_client/types/addons/addon_types_type.rb +48 -0
- data/lib/kodi_client/types/addons/get_addon_returned_type.rb +21 -0
- data/lib/kodi_client/types/addons/get_addons_returned_type.rb +22 -0
- data/lib/kodi_client/types/application/property_name_type.rb +19 -0
- data/lib/kodi_client/types/application/property_value_type.rb +24 -0
- data/lib/kodi_client/types/application/version_type.rb +22 -0
- data/lib/kodi_client/types/audio/audio_album_release_type_type.rb +15 -0
- data/lib/kodi_client/types/audio/audio_artist_role_type.rb +21 -0
- data/lib/kodi_client/types/audio/audio_contributor_type.rb +22 -0
- data/lib/kodi_client/types/audio/audio_details_album_type.rb +58 -0
- data/lib/kodi_client/types/audio/audio_details_artist_type.rb +53 -0
- data/lib/kodi_client/types/audio/audio_details_base_type.rb +30 -0
- data/lib/kodi_client/types/audio/audio_details_media_type.rb +50 -0
- data/lib/kodi_client/types/audio/audio_details_role_type.rb +25 -0
- data/lib/kodi_client/types/audio/audio_details_song_type.rb +72 -0
- data/lib/kodi_client/types/audio/audio_fields_album_type.rb +50 -0
- 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/genre_type.rb +20 -0
- data/lib/kodi_client/types/audio/get_albums_returned_type.rb +22 -0
- 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/favourites/details_favourite_type.rb +24 -0
- data/lib/kodi_client/types/favourites/fields_favourite_type.rb +17 -0
- data/lib/kodi_client/types/favourites/get_favourite_returned_type.rb +22 -0
- data/lib/kodi_client/types/favourites/type_type.rb +18 -0
- data/lib/kodi_client/types/files/file_label_type.rb +20 -0
- data/lib/kodi_client/types/files/get_directory_returned_type.rb +22 -0
- data/lib/kodi_client/types/files/get_sources_returned_type.rb +22 -0
- data/lib/kodi_client/types/files/media_type.rb +18 -0
- data/lib/kodi_client/types/files/prepare_download_returned_type.rb +21 -0
- data/lib/kodi_client/types/global/direction_type.rb +17 -0
- data/lib/kodi_client/types/global/global_time_type.rb +22 -0
- data/lib/kodi_client/types/global/id_label_type.rb +20 -0
- data/lib/kodi_client/types/global/id_name_type.rb +20 -0
- data/lib/kodi_client/types/global/increment_decrement_type.rb +15 -0
- data/lib/kodi_client/types/global/next_prev_type.rb +17 -0
- data/lib/kodi_client/types/global/password_encryption_type.rb +16 -0
- data/lib/kodi_client/types/global/rotate_type.rb +15 -0
- data/lib/kodi_client/types/global/toggle_type.rb +16 -0
- data/lib/kodi_client/types/gui/gui_window_type.rb +124 -0
- data/lib/kodi_client/types/gui/property_name_type.rb +18 -0
- data/lib/kodi_client/types/gui/property_value_type.rb +26 -0
- data/lib/kodi_client/types/gui/stereoscopy_mode_type.rb +31 -0
- data/lib/kodi_client/types/input/input_action_type.rb +212 -0
- data/lib/kodi_client/types/{item_types.rb → items/item_details_base_type.rb} +2 -4
- 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_field_files_type.rb +83 -0
- data/lib/kodi_client/types/list/list_fields_all_type.rb +96 -0
- data/lib/kodi_client/types/list/list_item_all_type.rb +70 -0
- data/lib/kodi_client/types/list/list_item_base_type.rb +141 -0
- data/lib/kodi_client/types/list/list_item_file_type.rb +66 -0
- data/lib/kodi_client/types/list/list_limits_returned_type.rb +23 -0
- data/lib/kodi_client/types/list/list_limits_type.rb +23 -0
- data/lib/kodi_client/types/list/list_sort_method_type.rb +54 -0
- data/lib/kodi_client/types/list/list_sort_type.rb +28 -0
- data/lib/kodi_client/types/list/sort_order_type.rb +15 -0
- data/lib/kodi_client/types/media/media_artwork_type.rb +26 -0
- data/lib/kodi_client/types/media/media_details_base_type.rb +29 -0
- data/lib/kodi_client/types/media/media_type_type.rb +16 -0
- data/lib/kodi_client/types/player/audio_stream_type.rb +29 -0
- data/lib/kodi_client/types/player/player_position_time_type.rb +22 -0
- data/lib/kodi_client/types/player/player_repeat_type.rb +17 -0
- data/lib/kodi_client/types/player/player_speed_type.rb +26 -0
- data/lib/kodi_client/types/player/player_type.rb +24 -0
- data/lib/kodi_client/types/player/player_type_type.rb +16 -0
- data/lib/kodi_client/types/player/player_view_mode_type.rb +23 -0
- data/lib/kodi_client/types/player/player_visibility_type.rb +16 -0
- data/lib/kodi_client/types/player/property_name_type.rb +38 -0
- data/lib/kodi_client/types/player/property_value_type.rb +60 -0
- data/lib/kodi_client/types/player/seek_jump_type.rb +17 -0
- data/lib/kodi_client/types/player/seek_returned_type.rb +23 -0
- data/lib/kodi_client/types/player/subtitle_type.rb +24 -0
- data/lib/kodi_client/types/player/video_stream_type.rb +26 -0
- data/lib/kodi_client/types/player/view_mode_type.rb +22 -0
- data/lib/kodi_client/types/player/zoom_type.rb +15 -0
- data/lib/kodi_client/types/profiles/details_profile_type.rb +24 -0
- data/lib/kodi_client/types/profiles/fields_profile_type.rb +15 -0
- data/lib/kodi_client/types/profiles/get_profiles_returned_type.rb +22 -0
- data/lib/kodi_client/types/profiles/profile_password_type.rb +20 -0
- data/lib/kodi_client/types/{pvr_type.rb → pvr/channel_type_type.rb} +2 -4
- data/lib/kodi_client/types/system/property_name_type.rb +17 -0
- data/lib/kodi_client/types/{system_types.rb → system/property_value_type.rb} +2 -13
- data/lib/kodi_client/types/video/stream_details_type.rb +24 -0
- data/lib/kodi_client/types/video/video_cast_type.rb +22 -0
- data/lib/kodi_client/types/video/video_content_type_type.rb +18 -0
- data/lib/kodi_client/types/video/video_details_base_type.rb +29 -0
- data/lib/kodi_client/types/video/video_details_file_type.rb +37 -0
- data/lib/kodi_client/types/video/video_details_item_type.rb +32 -0
- data/lib/kodi_client/types/video/video_details_media_type.rb +28 -0
- data/lib/kodi_client/types/video/video_resume_type.rb +20 -0
- data/lib/kodi_client.rb +160 -49
- metadata +132 -38
- data/lib/kodi_client/Chainable.rb +0 -48
- data/lib/kodi_client/kodi_module.rb +0 -80
- data/lib/kodi_client/method/audio_library.rb +0 -46
- data/lib/kodi_client/types/addon_types.rb +0 -177
- data/lib/kodi_client/types/application_types.rb +0 -52
- data/lib/kodi_client/types/audio_types.rb +0 -221
- data/lib/kodi_client/types/favourites_types.rb +0 -61
- data/lib/kodi_client/types/files_types.rb +0 -63
- data/lib/kodi_client/types/global_types.rb +0 -102
- data/lib/kodi_client/types/gui_types.rb +0 -179
- data/lib/kodi_client/types/input_types.rb +0 -214
- data/lib/kodi_client/types/list_types.rb +0 -542
- data/lib/kodi_client/types/media_types.rb +0 -53
- data/lib/kodi_client/types/player_type.rb +0 -294
- data/lib/kodi_client/types/profiles_types.rb +0 -65
- data/lib/kodi_client/types/video_types.rb +0 -150
- data/lib/kodi_client/util/comparable.rb +0 -20
- data/lib/kodi_client/util/creatable.rb +0 -106
- data/lib/kodi_client/util/iterable.rb +0 -11
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module KodiClient
|
|
4
|
+
module Methods
|
|
5
|
+
# contains all Kodi Application methods
|
|
6
|
+
class AudioLibrary < KodiMethod
|
|
7
|
+
|
|
8
|
+
CLEAN = 'AudioLibrary.Clean'
|
|
9
|
+
EXPORT = 'AudioLibrary.Export'
|
|
10
|
+
GET_ALBUM_DETAILS = 'AudioLibrary.GetAlbumDetails'
|
|
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'
|
|
30
|
+
|
|
31
|
+
def clean(show_dialogs = true, kodi_id = 1)
|
|
32
|
+
request = KodiRequest.new(kodi_id, CLEAN, { 'showdialogs' => show_dialogs })
|
|
33
|
+
json = invoke_api(request)
|
|
34
|
+
KodiResponse.new(json)
|
|
35
|
+
end
|
|
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
|
+
|
|
43
|
+
def export(path, kodi_id = 1)
|
|
44
|
+
request = KodiRequest.new(kodi_id, EXPORT, { 'options' => { 'path' => path } })
|
|
45
|
+
json = invoke_api(request)
|
|
46
|
+
KodiResponse.new(json)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def get_album_details(album_id, properties = Types::Audio::AudioFieldsAlbum.all_properties, kodi_id = 1)
|
|
50
|
+
request = KodiRequest.new(kodi_id, GET_ALBUM_DETAILS, { 'albumid' => album_id, 'properties' => properties })
|
|
51
|
+
json = invoke_api(request)
|
|
52
|
+
album_details = json['result'].nil? ? nil : json['result']['albumdetails']
|
|
53
|
+
json['result'] = Types::Audio::AudioDetailsAlbum.create(album_details)
|
|
54
|
+
KodiResponse.new(json)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def get_albums(properties = Types::Audio::AudioFieldsAlbum.all_properties,
|
|
58
|
+
limits = Types::List::ListLimits.new(0, 50),
|
|
59
|
+
sort = Types::List::ListSort.new, include_singles = false, all_roles = false, kodi_id = 1)
|
|
60
|
+
request = KodiRequest.new(kodi_id, GET_ALBUMS,
|
|
61
|
+
{ 'properties' => properties,
|
|
62
|
+
'limits' => limits.to_h,
|
|
63
|
+
'sort' => sort.to_h,
|
|
64
|
+
'includesingles' => include_singles, 'allroles' => all_roles })
|
|
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)
|
|
294
|
+
KodiResponse.new(json)
|
|
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
|
|
332
|
+
end
|
|
333
|
+
end
|
|
334
|
+
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module KodiClient
|
|
4
|
-
module
|
|
4
|
+
module Methods
|
|
5
5
|
# contains all Kodi Application methods
|
|
6
|
-
class Favourites <
|
|
6
|
+
class Favourites < KodiMethod
|
|
7
7
|
|
|
8
8
|
ADD_FAVOURITE = 'Favourites.AddFavourite'
|
|
9
9
|
GET_FAVOURITES = 'Favourites.GetFavourites'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module KodiClient
|
|
4
|
-
module
|
|
4
|
+
module Methods
|
|
5
5
|
# contains all Kodi Application methods
|
|
6
|
-
class Files <
|
|
6
|
+
class Files < KodiMethod
|
|
7
7
|
|
|
8
8
|
GET_DIRECTORY = 'Files.GetDirectory'
|
|
9
9
|
GET_FILE_DETAILS = 'Files.GetFileDetails'
|
|
@@ -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'])
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module KodiClient
|
|
4
|
-
module
|
|
4
|
+
module Methods
|
|
5
5
|
# contains all Kodi Application methods
|
|
6
|
-
class Profiles <
|
|
6
|
+
class Profiles < KodiMethod
|
|
7
7
|
|
|
8
8
|
GET_CURRENT_PROFILE = 'Profiles.GetCurrentProfile'
|
|
9
9
|
GET_PROFILES = 'Profiles.GetProfiles'
|
|
@@ -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
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module KodiClient
|
|
4
|
-
module
|
|
4
|
+
module Methods
|
|
5
5
|
# contains all Kodi System methods
|
|
6
|
-
class System <
|
|
6
|
+
class System < KodiMethod
|
|
7
7
|
|
|
8
8
|
EJECT_OPTICAL_DRIVE = 'System.EjectOpticalDrive'
|
|
9
9
|
GET_PROPERTIES = 'System.GetProperties'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module KodiClient
|
|
4
|
+
module Methods
|
|
5
|
+
# contains all Kodi System methods
|
|
6
|
+
class VideoLibrary < KodiMethod
|
|
7
|
+
|
|
8
|
+
CLEAN = 'clean'
|
|
9
|
+
|
|
10
|
+
def clean(show_dialogs = true, content = Types::Video::VideoContentType::VIDEO, directory = '', kodi_id = 1)
|
|
11
|
+
request = KodiRequest.new(kodi_id, CLEAN, { 'showdialogs' => show_dialogs, 'content' => content,
|
|
12
|
+
'directory' => directory })
|
|
13
|
+
json = invoke_api(request)
|
|
14
|
+
KodiResponse.new(json)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module KodiClient
|
|
4
|
+
module Types
|
|
5
|
+
module Addons
|
|
6
|
+
# Addon.Content https://kodi.wiki/view/JSON-RPC_API/v12#Addon.Content
|
|
7
|
+
module AddonContent
|
|
8
|
+
extend Extensions::Iterable
|
|
9
|
+
|
|
10
|
+
UNKNOWN = 'unknown'
|
|
11
|
+
AUDIO = 'audio'
|
|
12
|
+
EXECUTABLE = 'executable'
|
|
13
|
+
IMAGE = 'image'
|
|
14
|
+
VIDEO = 'video'
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module KodiClient
|
|
4
|
+
module Types
|
|
5
|
+
module Addons
|
|
6
|
+
# Addon.Details.dependencies https://kodi.wiki/view/JSON-RPC_API/v12#Addon.Details
|
|
7
|
+
class AddonDependency
|
|
8
|
+
include Extensions::Comparable
|
|
9
|
+
extend Extensions::Creatable
|
|
10
|
+
|
|
11
|
+
attr_reader :addon_id, :optional, :version
|
|
12
|
+
|
|
13
|
+
def initialize(addon_id, optional, version)
|
|
14
|
+
@addon_id = addon_id
|
|
15
|
+
@optional = optional
|
|
16
|
+
@version = version
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module KodiClient
|
|
4
|
+
module Types
|
|
5
|
+
module Addons
|
|
6
|
+
# represents addon details
|
|
7
|
+
class AddonDetails
|
|
8
|
+
include Extensions::Comparable
|
|
9
|
+
include Items::ItemDetailsBase
|
|
10
|
+
extend Extensions::Creatable
|
|
11
|
+
|
|
12
|
+
attr_reader :addon_id, :author, :broken, :dependencies, :description, :disclaimer, :enabled, :extra_info,
|
|
13
|
+
:fan_art, :installed, :name, :path, :rating, :summary, :thumbnail, :type, :version
|
|
14
|
+
|
|
15
|
+
fields_to_map %w[addon_id author broken dependencies description disclaimer enabled extra_info fan_art
|
|
16
|
+
installed name path rating summary thumbnail type version label]
|
|
17
|
+
|
|
18
|
+
type_mapping ['dependencies', AddonDependency, true], ['extrainfo', AddonExtraInfo, true]
|
|
19
|
+
|
|
20
|
+
def initialize(addon_id, author, broken, dependencies, description, disclaimer, enabled, extra_info,
|
|
21
|
+
fan_art, installed, name, path, rating, summary, thumbnail, type, version, label)
|
|
22
|
+
@addon_id = addon_id
|
|
23
|
+
@author = author
|
|
24
|
+
@broken = broken
|
|
25
|
+
@dependencies = dependencies
|
|
26
|
+
@description = description
|
|
27
|
+
@disclaimer = disclaimer
|
|
28
|
+
@enabled = enabled
|
|
29
|
+
@extra_info = extra_info
|
|
30
|
+
@fan_art = fan_art
|
|
31
|
+
@installed = installed
|
|
32
|
+
@name = name
|
|
33
|
+
@path = path
|
|
34
|
+
@rating = rating
|
|
35
|
+
@summary = summary
|
|
36
|
+
@thumbnail = thumbnail
|
|
37
|
+
@type = type
|
|
38
|
+
@version = version
|
|
39
|
+
item_details_base(label)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module KodiClient
|
|
4
|
+
module Types
|
|
5
|
+
module Addons
|
|
6
|
+
# Addon.Details.extrainfo https://kodi.wiki/view/JSON-RPC_API/v12#Addon.Details
|
|
7
|
+
class AddonExtraInfo
|
|
8
|
+
include Extensions::Comparable
|
|
9
|
+
extend Extensions::Creatable
|
|
10
|
+
|
|
11
|
+
attr_reader :key, :value
|
|
12
|
+
|
|
13
|
+
def initialize(key, value)
|
|
14
|
+
@key = key
|
|
15
|
+
@value = value
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module KodiClient
|
|
4
|
+
module Types
|
|
5
|
+
module Addons
|
|
6
|
+
# Addon.Fields https://kodi.wiki/view/JSON-RPC_API/v12#Addon.Content
|
|
7
|
+
module AddonFields
|
|
8
|
+
extend Extensions::Iterable
|
|
9
|
+
|
|
10
|
+
AUTHOR = 'author'
|
|
11
|
+
BROKEN = 'broken'
|
|
12
|
+
DEPENDENCIES = 'dependencies'
|
|
13
|
+
DESCRIPTION = 'description'
|
|
14
|
+
DISCLAIMER = 'disclaimer'
|
|
15
|
+
ENABLED = 'enabled'
|
|
16
|
+
EXTRAINFO = 'extrainfo'
|
|
17
|
+
FANART = 'fanart'
|
|
18
|
+
INSTALLED = 'installed'
|
|
19
|
+
NAME = 'name'
|
|
20
|
+
PATH = 'path'
|
|
21
|
+
RATING = 'rating'
|
|
22
|
+
SUMMARY = 'summary'
|
|
23
|
+
THUMBNAIL = 'thumbnail'
|
|
24
|
+
VERSION = 'version'
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|