kodi_client 0.6.3 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- 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,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Video
|
6
|
+
# Video.Details.Media https://kodi.wiki/view/JSON-RPC_API/v12#Video.Details.Media
|
7
|
+
module VideoDetailsMedia
|
8
|
+
include VideoDetailsBase
|
9
|
+
|
10
|
+
attr_reader :title
|
11
|
+
|
12
|
+
def video_details_media_mappings
|
13
|
+
video_details_base_mappings
|
14
|
+
end
|
15
|
+
|
16
|
+
def video_details_media_by_hash(hash)
|
17
|
+
video_details_media(*Extensions::Creatable.hash_to_arr(hash, %w[title art play_count fan_art thumbnail label]),
|
18
|
+
video_details_base_mappings)
|
19
|
+
end
|
20
|
+
|
21
|
+
def video_details_media(title, art, play_count, fan_art, thumbnail, label)
|
22
|
+
@title = title
|
23
|
+
video_details_base(art, play_count, fan_art, thumbnail, label)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KodiClient
|
4
|
+
module Types
|
5
|
+
module Video
|
6
|
+
# Video.Resume https://kodi.wiki/view/JSON-RPC_API/v12#Video.Resume
|
7
|
+
class VideoResume
|
8
|
+
include Extensions::Comparable
|
9
|
+
extend Extensions::Creatable
|
10
|
+
|
11
|
+
attr_reader :position, :total
|
12
|
+
|
13
|
+
def initialize(position, total)
|
14
|
+
@position = position
|
15
|
+
@total = total
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/kodi_client.rb
CHANGED
@@ -3,70 +3,181 @@
|
|
3
3
|
require 'http'
|
4
4
|
require 'json'
|
5
5
|
|
6
|
-
require 'kodi_client/
|
7
|
-
|
8
|
-
require 'kodi_client/
|
9
|
-
require 'kodi_client/
|
10
|
-
|
11
|
-
|
12
|
-
require 'kodi_client/
|
13
|
-
require 'kodi_client/
|
14
|
-
|
15
|
-
require 'kodi_client/
|
16
|
-
|
17
|
-
require 'kodi_client/
|
18
|
-
|
19
|
-
require 'kodi_client/
|
20
|
-
require 'kodi_client/
|
21
|
-
require 'kodi_client/
|
22
|
-
require 'kodi_client/
|
23
|
-
require 'kodi_client/
|
24
|
-
require 'kodi_client/
|
25
|
-
|
26
|
-
require 'kodi_client/types/
|
27
|
-
require 'kodi_client/types/
|
28
|
-
|
29
|
-
require 'kodi_client/types/
|
30
|
-
require 'kodi_client/types/
|
31
|
-
require 'kodi_client/types/
|
32
|
-
|
33
|
-
require 'kodi_client/types/
|
34
|
-
|
35
|
-
require 'kodi_client/types/
|
36
|
-
|
37
|
-
require 'kodi_client/types/
|
38
|
-
require 'kodi_client/types/
|
39
|
-
|
40
|
-
require 'kodi_client/types/
|
41
|
-
require 'kodi_client/types/
|
6
|
+
require 'kodi_client/extensions/chainable'
|
7
|
+
require 'kodi_client/extensions/comparable'
|
8
|
+
require 'kodi_client/extensions/creatable'
|
9
|
+
require 'kodi_client/extensions/iterable'
|
10
|
+
|
11
|
+
require 'kodi_client/kodi_error'
|
12
|
+
require 'kodi_client/kodi_request'
|
13
|
+
require 'kodi_client/kodi_response'
|
14
|
+
require 'kodi_client/kodi_method'
|
15
|
+
require 'kodi_client/kodi_options'
|
16
|
+
|
17
|
+
require 'kodi_client/types/items/item_details_base_type'
|
18
|
+
|
19
|
+
require 'kodi_client/types/global/toggle_type'
|
20
|
+
require 'kodi_client/types/global/rotate_type'
|
21
|
+
require 'kodi_client/types/global/direction_type'
|
22
|
+
require 'kodi_client/types/global/next_prev_type'
|
23
|
+
require 'kodi_client/types/global/increment_decrement_type'
|
24
|
+
require 'kodi_client/types/global/id_label_type'
|
25
|
+
require 'kodi_client/types/global/id_name_type'
|
26
|
+
require 'kodi_client/types/global/global_time_type'
|
27
|
+
require 'kodi_client/types/global/password_encryption_type'
|
28
|
+
|
29
|
+
require 'kodi_client/types/application/property_name_type'
|
30
|
+
require 'kodi_client/types/application/version_type'
|
31
|
+
require 'kodi_client/types/application/property_value_type'
|
32
|
+
|
33
|
+
require 'kodi_client/types/pvr/channel_type_type'
|
34
|
+
|
35
|
+
require 'kodi_client/types/input/input_action_type'
|
36
|
+
|
37
|
+
require 'kodi_client/types/system/property_name_type'
|
38
|
+
require 'kodi_client/types/system/property_value_type'
|
39
|
+
|
40
|
+
require 'kodi_client/types/media/media_type_type'
|
41
|
+
require 'kodi_client/types/media/media_details_base_type'
|
42
|
+
require 'kodi_client/types/media/media_artwork_type'
|
43
|
+
|
44
|
+
require 'kodi_client/types/list/list_limits_type'
|
45
|
+
require 'kodi_client/types/list/list_limits_returned_type'
|
46
|
+
require 'kodi_client/types/list/sort_order_type'
|
47
|
+
require 'kodi_client/types/list/list_sort_type'
|
48
|
+
require 'kodi_client/types/list/list_fields_all_type'
|
49
|
+
require 'kodi_client/types/list/list_field_files_type'
|
50
|
+
|
51
|
+
require 'kodi_client/types/favourites/type_type'
|
52
|
+
require 'kodi_client/types/favourites/fields_favourite_type'
|
53
|
+
require 'kodi_client/types/favourites/details_favourite_type'
|
54
|
+
require 'kodi_client/types/favourites/get_favourite_returned_type'
|
55
|
+
|
56
|
+
require 'kodi_client/types/player/zoom_type'
|
57
|
+
require 'kodi_client/types/player/view_mode_type'
|
58
|
+
require 'kodi_client/types/player/player_visibility_type'
|
59
|
+
require 'kodi_client/types/player/player_type_type'
|
60
|
+
require 'kodi_client/types/player/player_repeat_type'
|
61
|
+
require 'kodi_client/types/player/player_speed_type'
|
62
|
+
require 'kodi_client/types/player/player_type'
|
63
|
+
require 'kodi_client/types/player/subtitle_type'
|
64
|
+
require 'kodi_client/types/player/audio_stream_type'
|
65
|
+
require 'kodi_client/types/player/video_stream_type'
|
66
|
+
require 'kodi_client/types/player/property_name_type'
|
67
|
+
require 'kodi_client/types/player/property_value_type'
|
68
|
+
require 'kodi_client/types/player/player_view_mode_type'
|
69
|
+
require 'kodi_client/types/player/player_position_time_type'
|
70
|
+
require 'kodi_client/types/player/seek_jump_type'
|
71
|
+
require 'kodi_client/types/player/seek_returned_type'
|
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
|
+
|
78
|
+
require 'kodi_client/types/audio/audio_contributor_type'
|
79
|
+
require 'kodi_client/types/audio/audio_album_release_type_type'
|
80
|
+
require 'kodi_client/types/audio/audio_details_base_type'
|
81
|
+
require 'kodi_client/types/audio/audio_details_media_type'
|
82
|
+
require 'kodi_client/types/audio/audio_fields_album_type'
|
83
|
+
require 'kodi_client/types/audio/genre_type'
|
84
|
+
require 'kodi_client/types/audio/audio_details_album_type'
|
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'
|
101
|
+
|
102
|
+
require 'kodi_client/types/video/video_details_base_type'
|
103
|
+
require 'kodi_client/types/video/video_cast_type'
|
104
|
+
require 'kodi_client/types/video/video_details_media_type'
|
105
|
+
require 'kodi_client/types/video/video_details_item_type'
|
106
|
+
require 'kodi_client/types/video/video_details_file_type'
|
107
|
+
require 'kodi_client/types/video/video_resume_type'
|
108
|
+
require 'kodi_client/types/video/stream_details_type'
|
109
|
+
require 'kodi_client/types/video/video_content_type_type'
|
110
|
+
|
111
|
+
require 'kodi_client/types/list/list_item_base_type'
|
112
|
+
require 'kodi_client/types/list/list_item_all_type'
|
113
|
+
require 'kodi_client/types/list/list_item_file_type'
|
114
|
+
require 'kodi_client/types/list/list_sort_method_type'
|
115
|
+
|
116
|
+
require 'kodi_client/types/files/file_label_type'
|
117
|
+
require 'kodi_client/types/files/media_type'
|
118
|
+
require 'kodi_client/types/files/get_directory_returned_type'
|
119
|
+
require 'kodi_client/types/files/get_sources_returned_type'
|
120
|
+
require 'kodi_client/types/files/prepare_download_returned_type'
|
121
|
+
|
122
|
+
require 'kodi_client/types/profiles/fields_profile_type'
|
123
|
+
require 'kodi_client/types/profiles/details_profile_type'
|
124
|
+
require 'kodi_client/types/profiles/get_profiles_returned_type'
|
125
|
+
require 'kodi_client/types/profiles/profile_password_type'
|
126
|
+
|
127
|
+
require 'kodi_client/types/gui/gui_window_type'
|
128
|
+
require 'kodi_client/types/gui/property_name_type'
|
129
|
+
require 'kodi_client/types/gui/stereoscopy_mode_type'
|
130
|
+
require 'kodi_client/types/gui/property_value_type'
|
131
|
+
|
132
|
+
require 'kodi_client/types/addons/addon_dependency_type'
|
133
|
+
require 'kodi_client/types/addons/addon_fields_type'
|
134
|
+
require 'kodi_client/types/addons/addon_extra_info_type'
|
135
|
+
require 'kodi_client/types/addons/addon_content_type'
|
136
|
+
require 'kodi_client/types/addons/addon_types_type'
|
137
|
+
require 'kodi_client/types/addons/addon_details_type'
|
138
|
+
require 'kodi_client/types/addons/get_addon_returned_type'
|
139
|
+
require 'kodi_client/types/addons/get_addons_returned_type'
|
140
|
+
|
141
|
+
require 'kodi_client/methods/addons'
|
142
|
+
require 'kodi_client/methods/audio_library'
|
143
|
+
require 'kodi_client/methods/application'
|
144
|
+
require 'kodi_client/methods/favourites'
|
145
|
+
require 'kodi_client/methods/files'
|
146
|
+
require 'kodi_client/methods/gui'
|
147
|
+
require 'kodi_client/methods/input'
|
148
|
+
require 'kodi_client/methods/player'
|
149
|
+
require 'kodi_client/methods/profiles'
|
150
|
+
require 'kodi_client/methods/system'
|
151
|
+
require 'kodi_client/methods/video_library'
|
42
152
|
|
43
153
|
# client for Kodi rest api https://kodi.wiki/view/JSON-RPC_API/v12
|
44
154
|
module KodiClient
|
45
|
-
extend Chainable
|
155
|
+
extend Extensions::Chainable
|
46
156
|
|
47
157
|
# client that holds all methods such as application, gui etc.
|
48
158
|
class Client
|
49
|
-
include Chainable
|
159
|
+
include Extensions::Chainable
|
50
160
|
|
51
161
|
attr_reader :audio_library, :addons, :application, :favourites, :files, :gui, :input, :player, :profiles, :system
|
52
162
|
|
53
163
|
def initialize
|
54
|
-
@addons =
|
55
|
-
@audio_library =
|
56
|
-
@application =
|
57
|
-
@favourites =
|
58
|
-
@files =
|
59
|
-
@gui =
|
60
|
-
@input =
|
61
|
-
@player =
|
62
|
-
@profiles =
|
63
|
-
@system =
|
164
|
+
@addons = Methods::Addons.new
|
165
|
+
@audio_library = Methods::AudioLibrary.new
|
166
|
+
@application = Methods::Application.new
|
167
|
+
@favourites = Methods::Favourites.new
|
168
|
+
@files = Methods::Files.new
|
169
|
+
@gui = Methods::GUI.new
|
170
|
+
@input = Methods::Input.new
|
171
|
+
@player = Methods::Player.new
|
172
|
+
@profiles = Methods::Profiles.new
|
173
|
+
@system = Methods::System.new
|
174
|
+
@video_library = Methods::System.new
|
64
175
|
end
|
65
176
|
|
66
177
|
def apply_options_to_methods(options)
|
67
178
|
instance_variables.each do |it|
|
68
179
|
mod = instance_variable_get(it)
|
69
|
-
mod.apply_options(options) if mod.is_a?(
|
180
|
+
mod.apply_options(options) if mod.is_a?(KodiMethod)
|
70
181
|
end
|
71
182
|
end
|
72
183
|
end
|
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.2
|
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-28 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: []
|
@@ -42,38 +42,132 @@ files:
|
|
42
42
|
- Rakefile
|
43
43
|
- kodi_client.gemspec
|
44
44
|
- lib/kodi_client.rb
|
45
|
-
- lib/kodi_client/
|
46
|
-
- lib/kodi_client/
|
47
|
-
- lib/kodi_client/
|
48
|
-
- lib/kodi_client/
|
49
|
-
- lib/kodi_client/
|
50
|
-
- lib/kodi_client/
|
51
|
-
- lib/kodi_client/
|
52
|
-
- lib/kodi_client/
|
53
|
-
- lib/kodi_client/
|
54
|
-
- lib/kodi_client/
|
55
|
-
- lib/kodi_client/
|
56
|
-
- lib/kodi_client/
|
57
|
-
- lib/kodi_client/
|
58
|
-
- lib/kodi_client/
|
59
|
-
- lib/kodi_client/
|
60
|
-
- lib/kodi_client/
|
61
|
-
- lib/kodi_client/
|
62
|
-
- lib/kodi_client/
|
63
|
-
- lib/kodi_client/
|
64
|
-
- lib/kodi_client/
|
65
|
-
- lib/kodi_client/types/
|
66
|
-
- lib/kodi_client/types/
|
67
|
-
- lib/kodi_client/types/
|
68
|
-
- lib/kodi_client/types/
|
69
|
-
- lib/kodi_client/types/
|
70
|
-
- lib/kodi_client/types/
|
71
|
-
- lib/kodi_client/types/
|
72
|
-
- lib/kodi_client/types/
|
73
|
-
- lib/kodi_client/types/
|
74
|
-
- lib/kodi_client/
|
75
|
-
- lib/kodi_client/
|
76
|
-
- lib/kodi_client/
|
45
|
+
- lib/kodi_client/extensions/chainable.rb
|
46
|
+
- lib/kodi_client/extensions/comparable.rb
|
47
|
+
- lib/kodi_client/extensions/creatable.rb
|
48
|
+
- lib/kodi_client/extensions/iterable.rb
|
49
|
+
- lib/kodi_client/kodi_error.rb
|
50
|
+
- lib/kodi_client/kodi_method.rb
|
51
|
+
- lib/kodi_client/kodi_options.rb
|
52
|
+
- lib/kodi_client/kodi_request.rb
|
53
|
+
- lib/kodi_client/kodi_response.rb
|
54
|
+
- lib/kodi_client/methods/addons.rb
|
55
|
+
- lib/kodi_client/methods/application.rb
|
56
|
+
- lib/kodi_client/methods/audio_library.rb
|
57
|
+
- lib/kodi_client/methods/favourites.rb
|
58
|
+
- lib/kodi_client/methods/files.rb
|
59
|
+
- lib/kodi_client/methods/gui.rb
|
60
|
+
- lib/kodi_client/methods/input.rb
|
61
|
+
- lib/kodi_client/methods/player.rb
|
62
|
+
- lib/kodi_client/methods/profiles.rb
|
63
|
+
- lib/kodi_client/methods/system.rb
|
64
|
+
- lib/kodi_client/methods/video_library.rb
|
65
|
+
- lib/kodi_client/types/addons/addon_content_type.rb
|
66
|
+
- lib/kodi_client/types/addons/addon_dependency_type.rb
|
67
|
+
- lib/kodi_client/types/addons/addon_details_type.rb
|
68
|
+
- lib/kodi_client/types/addons/addon_extra_info_type.rb
|
69
|
+
- lib/kodi_client/types/addons/addon_fields_type.rb
|
70
|
+
- lib/kodi_client/types/addons/addon_types_type.rb
|
71
|
+
- lib/kodi_client/types/addons/get_addon_returned_type.rb
|
72
|
+
- lib/kodi_client/types/addons/get_addons_returned_type.rb
|
73
|
+
- lib/kodi_client/types/application/property_name_type.rb
|
74
|
+
- lib/kodi_client/types/application/property_value_type.rb
|
75
|
+
- lib/kodi_client/types/application/version_type.rb
|
76
|
+
- lib/kodi_client/types/audio/audio_album_release_type_type.rb
|
77
|
+
- lib/kodi_client/types/audio/audio_artist_role_type.rb
|
78
|
+
- lib/kodi_client/types/audio/audio_contributor_type.rb
|
79
|
+
- lib/kodi_client/types/audio/audio_details_album_type.rb
|
80
|
+
- lib/kodi_client/types/audio/audio_details_artist_type.rb
|
81
|
+
- lib/kodi_client/types/audio/audio_details_base_type.rb
|
82
|
+
- lib/kodi_client/types/audio/audio_details_media_type.rb
|
83
|
+
- lib/kodi_client/types/audio/audio_details_role_type.rb
|
84
|
+
- lib/kodi_client/types/audio/audio_details_song_type.rb
|
85
|
+
- lib/kodi_client/types/audio/audio_fields_album_type.rb
|
86
|
+
- lib/kodi_client/types/audio/audio_fields_artist_type.rb
|
87
|
+
- lib/kodi_client/types/audio/audio_fields_role_type.rb
|
88
|
+
- lib/kodi_client/types/audio/audio_fields_song_type.rb
|
89
|
+
- lib/kodi_client/types/audio/available_art_type.rb
|
90
|
+
- lib/kodi_client/types/audio/genre_type.rb
|
91
|
+
- lib/kodi_client/types/audio/get_albums_returned_type.rb
|
92
|
+
- lib/kodi_client/types/audio/get_artists_returned_type.rb
|
93
|
+
- lib/kodi_client/types/audio/get_genres_returned_type.rb
|
94
|
+
- lib/kodi_client/types/audio/get_roles_returned_type.rb
|
95
|
+
- lib/kodi_client/types/audio/get_songs_returned_type.rb
|
96
|
+
- lib/kodi_client/types/audio/get_sources_return_type.rb
|
97
|
+
- lib/kodi_client/types/audio/property_name_type.rb
|
98
|
+
- lib/kodi_client/types/audio/property_value_type.rb
|
99
|
+
- lib/kodi_client/types/favourites/details_favourite_type.rb
|
100
|
+
- lib/kodi_client/types/favourites/fields_favourite_type.rb
|
101
|
+
- lib/kodi_client/types/favourites/get_favourite_returned_type.rb
|
102
|
+
- lib/kodi_client/types/favourites/type_type.rb
|
103
|
+
- lib/kodi_client/types/files/file_label_type.rb
|
104
|
+
- lib/kodi_client/types/files/get_directory_returned_type.rb
|
105
|
+
- lib/kodi_client/types/files/get_sources_returned_type.rb
|
106
|
+
- lib/kodi_client/types/files/media_type.rb
|
107
|
+
- lib/kodi_client/types/files/prepare_download_returned_type.rb
|
108
|
+
- lib/kodi_client/types/global/direction_type.rb
|
109
|
+
- lib/kodi_client/types/global/global_time_type.rb
|
110
|
+
- lib/kodi_client/types/global/id_label_type.rb
|
111
|
+
- lib/kodi_client/types/global/id_name_type.rb
|
112
|
+
- lib/kodi_client/types/global/increment_decrement_type.rb
|
113
|
+
- lib/kodi_client/types/global/next_prev_type.rb
|
114
|
+
- lib/kodi_client/types/global/password_encryption_type.rb
|
115
|
+
- lib/kodi_client/types/global/rotate_type.rb
|
116
|
+
- lib/kodi_client/types/global/toggle_type.rb
|
117
|
+
- lib/kodi_client/types/gui/gui_window_type.rb
|
118
|
+
- lib/kodi_client/types/gui/property_name_type.rb
|
119
|
+
- lib/kodi_client/types/gui/property_value_type.rb
|
120
|
+
- lib/kodi_client/types/gui/stereoscopy_mode_type.rb
|
121
|
+
- lib/kodi_client/types/input/input_action_type.rb
|
122
|
+
- lib/kodi_client/types/items/item_details_base_type.rb
|
123
|
+
- lib/kodi_client/types/library/library_details_genre_type.rb
|
124
|
+
- lib/kodi_client/types/library/library_details_source_type.rb
|
125
|
+
- lib/kodi_client/types/library/library_fields_genre_type.rb
|
126
|
+
- lib/kodi_client/types/library/library_fields_source_type.rb
|
127
|
+
- lib/kodi_client/types/list/list_field_files_type.rb
|
128
|
+
- lib/kodi_client/types/list/list_fields_all_type.rb
|
129
|
+
- lib/kodi_client/types/list/list_item_all_type.rb
|
130
|
+
- lib/kodi_client/types/list/list_item_base_type.rb
|
131
|
+
- lib/kodi_client/types/list/list_item_file_type.rb
|
132
|
+
- lib/kodi_client/types/list/list_limits_returned_type.rb
|
133
|
+
- lib/kodi_client/types/list/list_limits_type.rb
|
134
|
+
- lib/kodi_client/types/list/list_sort_method_type.rb
|
135
|
+
- lib/kodi_client/types/list/list_sort_type.rb
|
136
|
+
- lib/kodi_client/types/list/sort_order_type.rb
|
137
|
+
- lib/kodi_client/types/media/media_artwork_type.rb
|
138
|
+
- lib/kodi_client/types/media/media_details_base_type.rb
|
139
|
+
- lib/kodi_client/types/media/media_type_type.rb
|
140
|
+
- lib/kodi_client/types/player/audio_stream_type.rb
|
141
|
+
- lib/kodi_client/types/player/player_position_time_type.rb
|
142
|
+
- lib/kodi_client/types/player/player_repeat_type.rb
|
143
|
+
- lib/kodi_client/types/player/player_speed_type.rb
|
144
|
+
- lib/kodi_client/types/player/player_type.rb
|
145
|
+
- lib/kodi_client/types/player/player_type_type.rb
|
146
|
+
- lib/kodi_client/types/player/player_view_mode_type.rb
|
147
|
+
- lib/kodi_client/types/player/player_visibility_type.rb
|
148
|
+
- lib/kodi_client/types/player/property_name_type.rb
|
149
|
+
- lib/kodi_client/types/player/property_value_type.rb
|
150
|
+
- lib/kodi_client/types/player/seek_jump_type.rb
|
151
|
+
- lib/kodi_client/types/player/seek_returned_type.rb
|
152
|
+
- lib/kodi_client/types/player/subtitle_type.rb
|
153
|
+
- lib/kodi_client/types/player/video_stream_type.rb
|
154
|
+
- lib/kodi_client/types/player/view_mode_type.rb
|
155
|
+
- lib/kodi_client/types/player/zoom_type.rb
|
156
|
+
- lib/kodi_client/types/profiles/details_profile_type.rb
|
157
|
+
- lib/kodi_client/types/profiles/fields_profile_type.rb
|
158
|
+
- lib/kodi_client/types/profiles/get_profiles_returned_type.rb
|
159
|
+
- lib/kodi_client/types/profiles/profile_password_type.rb
|
160
|
+
- lib/kodi_client/types/pvr/channel_type_type.rb
|
161
|
+
- lib/kodi_client/types/system/property_name_type.rb
|
162
|
+
- lib/kodi_client/types/system/property_value_type.rb
|
163
|
+
- lib/kodi_client/types/video/stream_details_type.rb
|
164
|
+
- lib/kodi_client/types/video/video_cast_type.rb
|
165
|
+
- lib/kodi_client/types/video/video_content_type_type.rb
|
166
|
+
- lib/kodi_client/types/video/video_details_base_type.rb
|
167
|
+
- lib/kodi_client/types/video/video_details_file_type.rb
|
168
|
+
- lib/kodi_client/types/video/video_details_item_type.rb
|
169
|
+
- lib/kodi_client/types/video/video_details_media_type.rb
|
170
|
+
- lib/kodi_client/types/video/video_resume_type.rb
|
77
171
|
homepage: https://github.com/cfe86/RubyKodiClient
|
78
172
|
licenses:
|
79
173
|
- MIT
|
@@ -96,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
190
|
- !ruby/object:Gem::Version
|
97
191
|
version: '0'
|
98
192
|
requirements: []
|
99
|
-
rubygems_version: 3.2.
|
193
|
+
rubygems_version: 3.2.15
|
100
194
|
signing_key:
|
101
195
|
specification_version: 4
|
102
196
|
summary: A work-in-progress client for Kodi JSON API v2.
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module KodiClient
|
4
|
-
# Offers methods like connect, auth and tls to be chained together
|
5
|
-
module Chainable
|
6
|
-
|
7
|
-
attr_accessor :options, :client
|
8
|
-
|
9
|
-
def connect(ip, port)
|
10
|
-
@client = KodiClient::Client.new
|
11
|
-
merge_options(->(options) { options.with_connection(ip, port) })
|
12
|
-
end
|
13
|
-
|
14
|
-
def auth(username, password)
|
15
|
-
merge_options(->(options) { options.with_auth(username, password) })
|
16
|
-
end
|
17
|
-
|
18
|
-
def use_tls(enabled: true)
|
19
|
-
merge_options(->(options) { options.with_tls(enabled) })
|
20
|
-
end
|
21
|
-
|
22
|
-
def merge_options(set_command)
|
23
|
-
client = def_client
|
24
|
-
options = def_options
|
25
|
-
set_command.call(options)
|
26
|
-
client.apply_options_to_methods(options)
|
27
|
-
client
|
28
|
-
end
|
29
|
-
|
30
|
-
def def_client
|
31
|
-
if @client.nil?
|
32
|
-
@client = KodiClient::Client.new
|
33
|
-
@client.client = @client
|
34
|
-
end
|
35
|
-
@client
|
36
|
-
end
|
37
|
-
|
38
|
-
def def_options
|
39
|
-
if @options.nil?
|
40
|
-
@options ||= KodiClient::Options.new
|
41
|
-
@client.options = @options
|
42
|
-
end
|
43
|
-
@options
|
44
|
-
end
|
45
|
-
|
46
|
-
private :def_client, :def_options, :merge_options
|
47
|
-
end
|
48
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module KodiClient
|
4
|
-
|
5
|
-
# the client that stores
|
6
|
-
class KodiModule
|
7
|
-
|
8
|
-
def apply_options(options)
|
9
|
-
@endpoint_url = "#{options.tls ? 'https://' : 'http://'}#{options.ip}:#{options.port}/jsonrpc"
|
10
|
-
@options = options
|
11
|
-
end
|
12
|
-
|
13
|
-
def invoke_api(request)
|
14
|
-
h = request.instance_variables.each_with_object({}) do |var, hash|
|
15
|
-
hash[var.to_s.delete('@')] = request.instance_variable_get(var)
|
16
|
-
end
|
17
|
-
|
18
|
-
@http_client ||= build_client
|
19
|
-
response = @http_client.post(@endpoint_url, json: h).to_s
|
20
|
-
JSON.parse(response)
|
21
|
-
end
|
22
|
-
|
23
|
-
def build_client
|
24
|
-
client = HTTP.headers(Content_Type: 'application/json')
|
25
|
-
if !@options.username.nil? && !@options.password.nil?
|
26
|
-
client = client.basic_auth({ user: @options.username, pass: @options.password })
|
27
|
-
end
|
28
|
-
|
29
|
-
client
|
30
|
-
end
|
31
|
-
|
32
|
-
private :build_client
|
33
|
-
end
|
34
|
-
|
35
|
-
# represents an error response
|
36
|
-
class KodiError
|
37
|
-
|
38
|
-
attr_reader :code, :message
|
39
|
-
|
40
|
-
def initialize(hash)
|
41
|
-
@code = hash['code']
|
42
|
-
@message = hash['message']
|
43
|
-
end
|
44
|
-
|
45
|
-
def ==(other)
|
46
|
-
@code == other.code && @message == other.message
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# represents a kodi requests
|
51
|
-
class KodiRequest
|
52
|
-
|
53
|
-
attr_accessor :id, :jsonrpc, :method, :params
|
54
|
-
|
55
|
-
def initialize(kodi_id, method, params = {}, jsonrpc = '2.0')
|
56
|
-
@id = kodi_id
|
57
|
-
@jsonrpc = jsonrpc
|
58
|
-
@method = method
|
59
|
-
@params = params
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# represents a kodi response
|
64
|
-
class KodiResponse
|
65
|
-
include Comparable
|
66
|
-
|
67
|
-
attr_reader :id, :jsonrpc, :result, :error
|
68
|
-
|
69
|
-
def initialize(hash)
|
70
|
-
@id = hash['id']
|
71
|
-
@jsonrpc = hash['jsonrpc']
|
72
|
-
@result = hash['result']
|
73
|
-
@error = KodiError.new(hash['error']) unless hash['error'].nil?
|
74
|
-
end
|
75
|
-
|
76
|
-
def error?
|
77
|
-
!@error.nil?
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module KodiClient
|
4
|
-
module Method
|
5
|
-
# contains all Kodi Application methods
|
6
|
-
class AudioLibrary < KodiModule
|
7
|
-
|
8
|
-
CLEAN = 'AudioLibrary.Clean'
|
9
|
-
EXPORT = 'AudioLibrary.Export'
|
10
|
-
GET_ALBUM_DETAILS = 'AudioLibrary.GetAlbumDetails'
|
11
|
-
GET_ALBUMS = 'AudioLibrary.GetAlbums'
|
12
|
-
|
13
|
-
def clean(show_dialogs = true, kodi_id = 1)
|
14
|
-
request = KodiRequest.new(kodi_id, CLEAN, { 'showdialogs' => show_dialogs })
|
15
|
-
json = invoke_api(request)
|
16
|
-
KodiResponse.new(json)
|
17
|
-
end
|
18
|
-
|
19
|
-
def export(path, kodi_id = 1)
|
20
|
-
request = KodiRequest.new(kodi_id, EXPORT, { 'options' => { 'path' => path } })
|
21
|
-
json = invoke_api(request)
|
22
|
-
KodiResponse.new(json)
|
23
|
-
end
|
24
|
-
|
25
|
-
def get_album_details(album_id, properties = Types::Audio::AudioFieldsAlbum.all_properties, kodi_id = 1)
|
26
|
-
request = KodiRequest.new(kodi_id, GET_ALBUM_DETAILS, { 'albumid' => album_id, 'properties' => properties })
|
27
|
-
json = invoke_api(request)
|
28
|
-
KodiResponse.new(json)
|
29
|
-
end
|
30
|
-
|
31
|
-
def get_albums(properties = Types::Audio::AudioFieldsAlbum.all_properties,
|
32
|
-
limits = Types::List::ListLimits.new(0, 50),
|
33
|
-
sort = Types::List::ListSort.new, include_singles = false, all_roles = false, kodi_id = 1)
|
34
|
-
request = KodiRequest.new(kodi_id, GET_ALBUMS,
|
35
|
-
{ 'properties' => properties,
|
36
|
-
'limits' => { 'start' => limits.list_start, 'end' => limits.list_end },
|
37
|
-
'sort' => { 'ignorearticle' => sort.ignore_article, 'method' => sort.method,
|
38
|
-
'order' => sort.order,
|
39
|
-
'useartistsortname' => sort.use_artist_sort_name },
|
40
|
-
'includesingles' => include_singles, 'allroles' => all_roles })
|
41
|
-
json = invoke_api(request)
|
42
|
-
KodiResponse.new(json)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|