kodi_client 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/README.md +1 -0
  4. data/kodi_client.gemspec +2 -2
  5. data/lib/kodi_client/extensions/chainable.rb +71 -0
  6. data/lib/kodi_client/extensions/comparable.rb +29 -0
  7. data/lib/kodi_client/extensions/creatable.rb +137 -0
  8. data/lib/kodi_client/extensions/iterable.rb +14 -0
  9. data/lib/kodi_client/kodi_error.rb +14 -0
  10. data/lib/kodi_client/kodi_method.rb +34 -0
  11. data/lib/kodi_client/{options.rb → kodi_options.rb} +1 -1
  12. data/lib/kodi_client/kodi_request.rb +16 -0
  13. data/lib/kodi_client/kodi_response.rb +21 -0
  14. data/lib/kodi_client/{method → methods}/addons.rb +6 -10
  15. data/lib/kodi_client/{method → methods}/application.rb +2 -5
  16. data/lib/kodi_client/methods/audio_library.rb +334 -0
  17. data/lib/kodi_client/{method → methods}/favourites.rb +2 -5
  18. data/lib/kodi_client/{method → methods}/files.rb +6 -14
  19. data/lib/kodi_client/{method → methods}/gui.rb +2 -5
  20. data/lib/kodi_client/{method → methods}/input.rb +2 -6
  21. data/lib/kodi_client/{method → methods}/player.rb +2 -7
  22. data/lib/kodi_client/{method → methods}/profiles.rb +5 -10
  23. data/lib/kodi_client/{method → methods}/system.rb +2 -6
  24. data/lib/kodi_client/types/addons/addon_content_type.rb +18 -0
  25. data/lib/kodi_client/types/addons/addon_dependency_type.rb +21 -0
  26. data/lib/kodi_client/types/addons/addon_details_type.rb +44 -0
  27. data/lib/kodi_client/types/addons/addon_extra_info_type.rb +20 -0
  28. data/lib/kodi_client/types/addons/addon_fields_type.rb +28 -0
  29. data/lib/kodi_client/types/addons/addon_types_type.rb +48 -0
  30. data/lib/kodi_client/types/addons/get_addon_returned_type.rb +21 -0
  31. data/lib/kodi_client/types/addons/get_addons_returned_type.rb +22 -0
  32. data/lib/kodi_client/types/application/property_name_type.rb +19 -0
  33. data/lib/kodi_client/types/application/property_value_type.rb +24 -0
  34. data/lib/kodi_client/types/application/version_type.rb +22 -0
  35. data/lib/kodi_client/types/audio/audio_album_release_type_type.rb +15 -0
  36. data/lib/kodi_client/types/audio/audio_artist_role_type.rb +21 -0
  37. data/lib/kodi_client/types/audio/audio_contributor_type.rb +22 -0
  38. data/lib/kodi_client/types/audio/audio_details_album_type.rb +58 -0
  39. data/lib/kodi_client/types/audio/audio_details_artist_type.rb +54 -0
  40. data/lib/kodi_client/types/audio/audio_details_base_type.rb +31 -0
  41. data/lib/kodi_client/types/audio/audio_details_media_type.rb +46 -0
  42. data/lib/kodi_client/types/audio/audio_details_role_type.rb +25 -0
  43. data/lib/kodi_client/types/audio/audio_details_song_type.rb +76 -0
  44. data/lib/kodi_client/types/audio/audio_fields_album_type.rb +50 -0
  45. data/lib/kodi_client/types/audio/audio_fields_artist_type.rb +39 -0
  46. data/lib/kodi_client/types/audio/audio_fields_role_type.rb +15 -0
  47. data/lib/kodi_client/types/audio/audio_fields_song_type.rb +61 -0
  48. data/lib/kodi_client/types/audio/available_art_type.rb +21 -0
  49. data/lib/kodi_client/types/audio/genre_type.rb +20 -0
  50. data/lib/kodi_client/types/audio/get_albums_returned_type.rb +22 -0
  51. data/lib/kodi_client/types/audio/get_artists_returned_type.rb +23 -0
  52. data/lib/kodi_client/types/audio/get_genres_returned_type.rb +24 -0
  53. data/lib/kodi_client/types/audio/get_roles_returned_type.rb +25 -0
  54. data/lib/kodi_client/types/audio/get_songs_returned_type.rb +25 -0
  55. data/lib/kodi_client/types/audio/get_sources_return_type.rb +25 -0
  56. data/lib/kodi_client/types/audio/property_name_type.rb +25 -0
  57. data/lib/kodi_client/types/audio/property_value_type.rb +33 -0
  58. data/lib/kodi_client/types/favourites/details_favourite_type.rb +24 -0
  59. data/lib/kodi_client/types/favourites/fields_favourite_type.rb +17 -0
  60. data/lib/kodi_client/types/favourites/get_favourite_returned_type.rb +22 -0
  61. data/lib/kodi_client/types/favourites/type_type.rb +18 -0
  62. data/lib/kodi_client/types/files/file_label_type.rb +20 -0
  63. data/lib/kodi_client/types/files/get_directory_returned_type.rb +22 -0
  64. data/lib/kodi_client/types/files/get_sources_returned_type.rb +22 -0
  65. data/lib/kodi_client/types/files/media_type.rb +18 -0
  66. data/lib/kodi_client/types/files/prepare_download_returned_type.rb +21 -0
  67. data/lib/kodi_client/types/global/direction_type.rb +17 -0
  68. data/lib/kodi_client/types/global/global_time_type.rb +22 -0
  69. data/lib/kodi_client/types/global/id_label_type.rb +20 -0
  70. data/lib/kodi_client/types/global/id_name_type.rb +20 -0
  71. data/lib/kodi_client/types/global/increment_decrement_type.rb +15 -0
  72. data/lib/kodi_client/types/global/next_prev_type.rb +17 -0
  73. data/lib/kodi_client/types/global/password_encryption_type.rb +16 -0
  74. data/lib/kodi_client/types/global/rotate_type.rb +15 -0
  75. data/lib/kodi_client/types/global/toggle_type.rb +16 -0
  76. data/lib/kodi_client/types/gui/gui_window_type.rb +124 -0
  77. data/lib/kodi_client/types/gui/property_name_type.rb +18 -0
  78. data/lib/kodi_client/types/gui/property_value_type.rb +26 -0
  79. data/lib/kodi_client/types/gui/stereoscopy_mode_type.rb +31 -0
  80. data/lib/kodi_client/types/input/input_action_type.rb +212 -0
  81. data/lib/kodi_client/{global_types/item_types.rb → types/items/item_details_base_type.rb} +1 -3
  82. data/lib/kodi_client/types/library/library_details_genre_type.rb +27 -0
  83. data/lib/kodi_client/types/library/library_details_source_type.rb +26 -0
  84. data/lib/kodi_client/types/library/library_fields_genre_type.rb +17 -0
  85. data/lib/kodi_client/types/library/library_fields_source_type.rb +17 -0
  86. data/lib/kodi_client/types/list/list_field_files_type.rb +83 -0
  87. data/lib/kodi_client/types/list/list_fields_all_type.rb +96 -0
  88. data/lib/kodi_client/types/list/list_item_all_type.rb +73 -0
  89. data/lib/kodi_client/types/list/list_item_base_type.rb +138 -0
  90. data/lib/kodi_client/types/list/list_item_file_type.rb +68 -0
  91. data/lib/kodi_client/types/list/list_limits_returned_type.rb +23 -0
  92. data/lib/kodi_client/types/list/list_limits_type.rb +23 -0
  93. data/lib/kodi_client/types/list/list_sort_method_type.rb +54 -0
  94. data/lib/kodi_client/types/list/list_sort_type.rb +28 -0
  95. data/lib/kodi_client/types/list/sort_order_type.rb +15 -0
  96. data/lib/kodi_client/types/media/media_artwork_type.rb +26 -0
  97. data/lib/kodi_client/types/media/media_details_base_type.rb +28 -0
  98. data/lib/kodi_client/types/media/media_type_type.rb +16 -0
  99. data/lib/kodi_client/types/player/audio_stream_type.rb +29 -0
  100. data/lib/kodi_client/types/player/player_position_time_type.rb +22 -0
  101. data/lib/kodi_client/types/player/player_repeat_type.rb +17 -0
  102. data/lib/kodi_client/types/player/player_speed_type.rb +26 -0
  103. data/lib/kodi_client/types/player/player_type.rb +24 -0
  104. data/lib/kodi_client/types/player/player_type_type.rb +16 -0
  105. data/lib/kodi_client/types/player/player_view_mode_type.rb +23 -0
  106. data/lib/kodi_client/types/player/player_visibility_type.rb +16 -0
  107. data/lib/kodi_client/types/player/property_name_type.rb +38 -0
  108. data/lib/kodi_client/types/player/property_value_type.rb +60 -0
  109. data/lib/kodi_client/types/player/seek_jump_type.rb +17 -0
  110. data/lib/kodi_client/types/player/seek_returned_type.rb +23 -0
  111. data/lib/kodi_client/types/player/subtitle_type.rb +24 -0
  112. data/lib/kodi_client/types/player/video_stream_type.rb +26 -0
  113. data/lib/kodi_client/types/player/view_mode_type.rb +22 -0
  114. data/lib/kodi_client/types/player/zoom_type.rb +15 -0
  115. data/lib/kodi_client/types/profiles/details_profile_type.rb +24 -0
  116. data/lib/kodi_client/types/profiles/fields_profile_type.rb +15 -0
  117. data/lib/kodi_client/types/profiles/get_profiles_returned_type.rb +22 -0
  118. data/lib/kodi_client/types/profiles/profile_password_type.rb +20 -0
  119. data/lib/kodi_client/{global_types/pvr_type.rb → types/pvr/channel_type_type.rb} +2 -6
  120. data/lib/kodi_client/types/system/property_name_type.rb +17 -0
  121. data/lib/kodi_client/{global_types/system_types.rb → types/system/property_value_type.rb} +2 -17
  122. data/lib/kodi_client/types/video/stream_details_type.rb +24 -0
  123. data/lib/kodi_client/types/video/video_cast_type.rb +22 -0
  124. data/lib/kodi_client/types/video/video_details_base_type.rb +29 -0
  125. data/lib/kodi_client/types/video/video_details_file_type.rb +37 -0
  126. data/lib/kodi_client/types/video/video_details_item_type.rb +32 -0
  127. data/lib/kodi_client/types/video/video_details_media_type.rb +28 -0
  128. data/lib/kodi_client/types/video/video_resume_type.rb +20 -0
  129. data/lib/kodi_client.rb +156 -24
  130. metadata +129 -37
  131. data/lib/kodi_client/Chainable.rb +0 -49
  132. data/lib/kodi_client/global_types/addon_types.rb +0 -180
  133. data/lib/kodi_client/global_types/application_types.rb +0 -56
  134. data/lib/kodi_client/global_types/audio_types.rb +0 -226
  135. data/lib/kodi_client/global_types/favourites_types.rb +0 -66
  136. data/lib/kodi_client/global_types/files_types.rb +0 -68
  137. data/lib/kodi_client/global_types/global_types.rb +0 -106
  138. data/lib/kodi_client/global_types/gui_types.rb +0 -184
  139. data/lib/kodi_client/global_types/input_types.rb +0 -216
  140. data/lib/kodi_client/global_types/list_types.rb +0 -548
  141. data/lib/kodi_client/global_types/media_types.rb +0 -58
  142. data/lib/kodi_client/global_types/player_type.rb +0 -300
  143. data/lib/kodi_client/global_types/profiles_types.rb +0 -70
  144. data/lib/kodi_client/global_types/video_types.rb +0 -155
  145. data/lib/kodi_client/kodi_module.rb +0 -87
  146. data/lib/kodi_client/method/audio_library.rb +0 -49
  147. data/lib/kodi_client/util/comparable.rb +0 -20
  148. data/lib/kodi_client/util/creatable.rb +0 -106
  149. data/lib/kodi_client/util/iterable.rb +0 -11
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Player
6
+ # player speed enum, -32 to 32
7
+ module PlayerSpeed
8
+ extend Extensions::Iterable
9
+
10
+ MINUS_32 = -32
11
+ MINUS_16 = -16
12
+ MINUS_8 = -8
13
+ MINUS_4 = -4
14
+ MINUS_2 = -2
15
+ MINUS_1 = -1
16
+ NEUTRAL = 0
17
+ PLUS_1 = 1
18
+ PLUS_2 = 2
19
+ PLUS_4 = 4
20
+ PLUS_8 = 8
21
+ PLUS_16 = 16
22
+ PLUS_32 = 32
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Player
6
+ # player item
7
+ class Player
8
+ include Extensions::Comparable
9
+ extend Extensions::Creatable
10
+
11
+ attr_reader :player_id, :player_type, :type, :name, :plays_audio, :plays_video
12
+
13
+ def initialize(player_id, player_type, type, name, plays_audio, plays_video)
14
+ @player_id = player_id
15
+ @player_type = player_type
16
+ @type = type
17
+ @name = name
18
+ @plays_audio = plays_audio
19
+ @plays_video = plays_video
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Player
6
+ # Player.Type https://kodi.wiki/view/JSON-RPC_API/v12#Player.Type
7
+ module PlayerType
8
+ extend Extensions::Iterable
9
+
10
+ VIDEO = 'video'
11
+ AUDIO = 'audio'
12
+ PICTURE = 'picture'
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Player
6
+ # return value for Player.GetViewMode
7
+ class PlayerViewMode
8
+ include Extensions::Comparable
9
+ extend Extensions::Creatable
10
+
11
+ attr_reader :nonlinear_stretch, :pixel_ratio, :vertical_shift, :view_mode, :zoom
12
+
13
+ def initialize(nonlinear_stretch, pixel_ratio, vertical_shift, view_mode, zoom)
14
+ @nonlinear_stretch = nonlinear_stretch
15
+ @pixel_ratio = pixel_ratio
16
+ @vertical_shift = vertical_shift
17
+ @view_mode = view_mode
18
+ @zoom = zoom
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Player
6
+ # player types
7
+ module PlayerVisibility
8
+ extend Extensions::Iterable
9
+
10
+ INTERNAL = 'internal'
11
+ EXTERNAL = 'external'
12
+ REMOTE = 'remote'
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Player
6
+ # Player.Property.Name https://kodi.wiki/view/JSON-RPC_API/v12#Player.Property.Name
7
+ module PropertyName
8
+ extend Extensions::Iterable
9
+
10
+ AUDIO_STREAMS = 'audiostreams'
11
+ CAN_CHANGE_SPEED = 'canchangespeed'
12
+ CAN_MOVE = 'canmove'
13
+ CAN_REPEAT = 'canrepeat'
14
+ CAN_ROTATE = 'canrotate'
15
+ CAN_SEEK = 'canseek'
16
+ CAN_SHUFFLE = 'canshuffle'
17
+ CAN_ZOOM = 'canzoom'
18
+ CURRENT_AUDIO_STREAM = 'currentaudiostream'
19
+ CURRENT_SUBTITLE = 'currentsubtitle'
20
+ CURRENT_VIDEO_STREAM = 'currentvideostream'
21
+ LIVE = 'live'
22
+ PARTY_MODE = 'partymode'
23
+ PERCENTAGE = 'percentage'
24
+ PLAYLIST_ID = 'playlistid'
25
+ POSITION = 'position'
26
+ REPEAT = 'repeat'
27
+ SHUFFLED = 'shuffled'
28
+ SPEED = 'speed'
29
+ SUBTITLE_ENABLED = 'subtitleenabled'
30
+ SUBTITLES = 'subtitles'
31
+ TIME = 'time'
32
+ TOTAL_TIME = 'totaltime'
33
+ TYPE = 'type'
34
+ VIDEO_STREAMS = 'videostreams'
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Player
6
+ # Player.Property.Value https://kodi.wiki/view/JSON-RPC_API/v12#Player.Property.Name
7
+ class PropertyValue
8
+ include Extensions::Comparable
9
+ extend Extensions::Creatable
10
+
11
+ attr_reader :audio_streams, :cache_percentage, :can_change_speed, :can_move, :can_repeat, :can_rotate,
12
+ :can_seek, :can_shuffle, :can_zoom, :current_audio_stream, :current_subtitle, :current_video_stream,
13
+ :live, :party_mode, :percentage, :playlist_id, :position, :repeat, :shuffled, :speed,
14
+ :subtitle_enabled, :subtitles, :time, :total_time, :type, :video_streams
15
+
16
+ type_mapping ['audiostreams', AudioStream, true], ['currentaudiostream', AudioStream],
17
+ ['currentsubtitle', Subtitle], ['currentvideostream', VideoStream],
18
+ ['subtitles', Subtitle, true], ['time', Global::GlobalTime],
19
+ ['totaltime', Global::GlobalTime], ['videostreams', VideoStream, true]
20
+
21
+ def initialize(audio_streams, cache_percentage, can_change_speed, can_move, can_repeat, can_rotate, can_seek,
22
+ can_shuffle, can_zoom, current_audio_stream, current_subtitle, current_video_stream, live,
23
+ party_mode, percentage, playlist_id, position, repeat, shuffled, speed,
24
+ subtitle_enabled, subtitles, time, total_time, type, video_streams)
25
+ type = type.nil? ? PlayerType::VIDEO : type
26
+ playlist_id = playlist_id.nil? ? -1 : playlist_id
27
+ position = position.nil? ? -1 : position
28
+ repeat = repeat.nil? ? PlayerRepeat::OFF : repeat
29
+
30
+ @audio_streams = audio_streams
31
+ @cache_percentage = cache_percentage
32
+ @can_change_speed = can_change_speed
33
+ @can_move = can_move
34
+ @can_repeat = can_repeat
35
+ @can_rotate = can_rotate
36
+ @can_seek = can_seek
37
+ @can_shuffle = can_shuffle
38
+ @can_zoom = can_zoom
39
+ @current_audio_stream = current_audio_stream
40
+ @current_subtitle = current_subtitle
41
+ @current_video_stream = current_video_stream
42
+ @live = live
43
+ @party_mode = party_mode
44
+ @percentage = percentage
45
+ @playlist_id = playlist_id
46
+ @position = position
47
+ @repeat = repeat
48
+ @shuffled = shuffled
49
+ @speed = speed
50
+ @subtitle_enabled = subtitle_enabled
51
+ @subtitles = subtitles
52
+ @time = time
53
+ @total_time = total_time
54
+ @type = type
55
+ @video_streams = video_streams
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Player
6
+ # defines the jump size for seek
7
+ module SeekJump
8
+ include Extensions::Iterable
9
+
10
+ SMALL_FORWARD = 'smallforward'
11
+ SMALL_BACKWARD = 'smallbackward'
12
+ BIG_FORWARD = 'bigforward'
13
+ BIG_BACKWARD = 'bigbackward'
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Player
6
+ # return value of Player.Seek
7
+ class SeekReturned
8
+ include Extensions::Comparable
9
+ extend Extensions::Creatable
10
+
11
+ attr_reader :percentage, :time, :total_time
12
+
13
+ type_mapping ['time', Global::GlobalTime], ['totaltime', Global::GlobalTime]
14
+
15
+ def initialize(percentage, time, total_time)
16
+ @percentage = percentage
17
+ @time = time
18
+ @total_time = total_time
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Player
6
+ # Player Subtitle https://kodi.wiki/view/JSON-RPC_API/v12#Player.Subtitle
7
+ class Subtitle
8
+ include Extensions::Comparable
9
+ extend Extensions::Creatable
10
+
11
+ attr_reader :index, :is_default, :is_forced, :is_impaired, :language, :name
12
+
13
+ def initialize(index, is_default, is_forced, is_impaired, language, name)
14
+ @index = index
15
+ @is_default = is_default
16
+ @is_forced = is_forced
17
+ @is_impaired = is_impaired
18
+ @language = language
19
+ @name = name
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Player
6
+ # Player.Video.Stream https://kodi.wiki/view/JSON-RPC_API/v12#Player.Video.Stream
7
+ class VideoStream
8
+ include Extensions::Comparable
9
+ extend Extensions::Creatable
10
+
11
+ attr_reader :codec, :height, :index, :language, :name, :width, :duration, :aspect
12
+
13
+ def initialize(codec, height, index, language, name, width, duration, aspect)
14
+ @codec = codec
15
+ @height = height
16
+ @index = index
17
+ @language = language
18
+ @name = name
19
+ @width = width
20
+ @duration = duration
21
+ @aspect = aspect
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Player
6
+ # Player.ViewMode https://kodi.wiki/view/JSON-RPC_API/v12#Player.ViewMode
7
+ module ViewMode
8
+ extend Extensions::Iterable
9
+
10
+ NORMAL = 'normal'
11
+ ZOOM = 'zoom'
12
+ STRETCH_4X3 = 'strech4x3'
13
+ WIDE_ZOOM = 'widezoom'
14
+ STRETCH_16X9 = 'stretch16x9'
15
+ ORIGINAL = 'original'
16
+ STRETCH_16X9_NONLIN = 'stretch16x9nonline'
17
+ ZOOM_120_WIDTH = 'zoom120width'
18
+ ZOOM_110_WIDTH = 'zoom110width'
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Player
6
+ # enum for in/out zoom
7
+ module Zoom
8
+ extend Extensions::Iterable
9
+
10
+ IN = 'in'
11
+ OUT = 'out'
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Profiles
6
+ # Profiles.Details.Profile https://kodi.wiki/view/JSON-RPC_API/v12#Profiles.Details.Profile
7
+ class DetailsProfile
8
+ include Extensions::Comparable
9
+ include Items::ItemDetailsBase
10
+ extend Extensions::Creatable
11
+
12
+ attr_reader :lock_mode, :thumbnail
13
+
14
+ fields_to_map %w[lock_mode thumbnail label]
15
+
16
+ def initialize(lock_mode, thumbnail, label)
17
+ @lock_mode = lock_mode
18
+ @thumbnail = thumbnail
19
+ item_details_base(label)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Profiles
6
+ # Profiles.Fields.Profile https://kodi.wiki/view/JSON-RPC_API/v12#Profiles.Fields.Profile
7
+ module FieldsProfile
8
+ extend Extensions::Iterable
9
+
10
+ LOCK_MODE = 'lockmode'
11
+ THUMBNAIL = 'thumbnail'
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Profiles
6
+ # return type for Profiles.GetProfiles
7
+ class GetProfilesReturned
8
+ include Extensions::Comparable
9
+ extend Extensions::Creatable
10
+
11
+ attr_reader :limits, :profiles
12
+
13
+ type_mapping ['limits', List::ListLimitsReturned], ['profiles', DetailsProfile, true]
14
+
15
+ def initialize(limits, profiles)
16
+ @limits = limits
17
+ @profiles = profiles
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Profiles
6
+ # Profiles.Password https://kodi.wiki/view/JSON-RPC_API/v12#Profiles.Password
7
+ class ProfilePassword
8
+ include Extensions::Comparable
9
+ extend Extensions::Creatable
10
+
11
+ attr_reader :value, :encryption
12
+
13
+ def initialize(value, encryption = Types::Global::PasswordEncryption::MD5)
14
+ @value = value
15
+ @encryption = encryption
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,19 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'kodi_client/util/iterable'
4
-
5
3
  module KodiClient
6
4
  module Types
7
5
  module PVR
8
-
9
6
  # PVR.Channel.Type https://kodi.wiki/view/JSON-RPC_API/v12#PVR.Channel.Type
10
7
  module ChannelType
11
- extend Iterable
12
-
8
+ extend Extensions::Iterable
9
+
13
10
  TV = 'TV'
14
11
  RADIO = 'Radio'
15
12
  end
16
13
  end
17
14
  end
18
15
  end
19
-
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module System
6
+ # System.Property.Name https://kodi.wiki/view/JSON-RPC_API/v12#System.Property.Name
7
+ module PropertyName
8
+ extend Extensions::Iterable
9
+
10
+ CAN_SHUTDOWN = 'canshutdown'
11
+ CAN_SUSPEND = 'cansuspend'
12
+ CAN_HIBERNATE = 'canhibernate'
13
+ CAN_REBOOT = 'canreboot'
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,27 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'kodi_client/util/iterable'
4
- require 'kodi_client/util/comparable'
5
- require 'kodi_client/util/creatable'
6
-
7
3
  module KodiClient
8
4
  module Types
9
5
  module System
10
-
11
- # System.Property.Name https://kodi.wiki/view/JSON-RPC_API/v12#System.Property.Name
12
- module PropertyName
13
- extend Iterable
14
-
15
- CAN_SHUTDOWN = 'canshutdown'
16
- CAN_SUSPEND = 'cansuspend'
17
- CAN_HIBERNATE = 'canhibernate'
18
- CAN_REBOOT = 'canreboot'
19
- end
20
-
21
6
  # System.Property.Value https://kodi.wiki/view/JSON-RPC_API/v12#System.Property.Value
22
7
  class PropertyValue
23
- include Comparable
24
- extend Creatable
8
+ include Extensions::Comparable
9
+ extend Extensions::Creatable
25
10
 
26
11
  attr_reader :can_hibernate, :can_reboot, :can_shutdown, :can_suspend
27
12
 
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Video
6
+ # Video.Streams https://kodi.wiki/view/JSON-RPC_API/v12#Video.Streams
7
+ class StreamDetails
8
+ include Extensions::Comparable
9
+ extend Extensions::Creatable
10
+
11
+ attr_reader :audio, :subtitle, :video
12
+
13
+ type_mapping ['audio', Player::AudioStream, true], ['subtitle', Player::Subtitle, true],
14
+ ['video', Player::VideoStream, true]
15
+
16
+ def initialize(audio, subtitle, video)
17
+ @audio = audio
18
+ @subtitle = subtitle
19
+ @video = video
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Video
6
+ # Video.Cast https://kodi.wiki/view/JSON-RPC_API/v12#Video.Cast
7
+ class VideoCast
8
+ include Extensions::Comparable
9
+ extend Extensions::Creatable
10
+
11
+ attr_reader :name, :order, :role, :thumbnail
12
+
13
+ def initialize(name, order, role, thumbnail)
14
+ @name = name
15
+ @order = order
16
+ @role = role
17
+ @thumbnail = thumbnail
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Video
6
+ # Video.Details.Base https://kodi.wiki/view/JSON-RPC_API/v12#Video.Details.Base
7
+ module VideoDetailsBase
8
+ include Media::MediaDetailsBase
9
+
10
+ attr_reader :art, :play_count
11
+
12
+ def video_details_base_mappings
13
+ media_details_base_mappings
14
+ end
15
+
16
+ def video_details_base_by_hash(hash)
17
+ video_details_base(*Extensions::Creatable.hash_to_arr(hash, %w[art play_count fan_art thumbnail label],
18
+ video_details_base_mappings))
19
+ end
20
+
21
+ def video_details_base(art, play_count, fan_art, thumbnail, label)
22
+ @art = art
23
+ @play_count = play_count
24
+ media_details_base(fan_art, thumbnail, label)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Video
6
+ # Video.Details.File https://kodi.wiki/view/JSON-RPC_API/v12#Video.Details.File
7
+ module VideoDetailsFile
8
+ include VideoDetailsItem
9
+
10
+ attr_reader :director, :resume, :runtime, :stream_details
11
+
12
+ def video_details_file_mappings
13
+ mappings = {
14
+ 'resume' => Extensions::Creatable::CreateMap.new(VideoResume),
15
+ 'streamdetails' => Extensions::Creatable::CreateMap.new(StreamDetails)
16
+ }
17
+ mappings.merge(video_details_item_mappings)
18
+ end
19
+
20
+ def video_details_file_by_hash(hash)
21
+ video_details_file(*Extensions::Creatable.hash_to_arr(hash, %w[director resume runtime stream_details date_added
22
+ file last_played plot title art play_count fan_art
23
+ thumbnail label], video_details_file_mappings))
24
+ end
25
+
26
+ def video_details_file(director, resume, runtime, stream_details, date_added, file, last_played, plot, title,
27
+ art, play_count, fan_art, thumbnail, label)
28
+ @director = director
29
+ @resume = resume
30
+ @runtime = runtime
31
+ @stream_details = stream_details
32
+ video_details_item(date_added, file, last_played, plot, title, art, play_count, fan_art, thumbnail, label)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KodiClient
4
+ module Types
5
+ module Video
6
+ # Video.Details.Item https://kodi.wiki/view/JSON-RPC_API/v12#Video.Details.Item
7
+ module VideoDetailsItem
8
+ include VideoDetailsMedia
9
+
10
+ attr_reader :date_added, :file, :last_played, :plot
11
+
12
+ def video_details_item_mappings
13
+ video_details_media_mappings
14
+ end
15
+
16
+ def video_details_item_by_hash(hash)
17
+ video_details_item(*Extensions::Creatable.hash_to_arr(hash, %w[date_added file last_played plot title art
18
+ play_count fan_art thumbnail label],
19
+ video_details_item_mappings))
20
+ end
21
+
22
+ def video_details_item(date_added, file, last_played, plot, title, art, play_count, fan_art, thumbnail, label)
23
+ @date_added = date_added
24
+ @file = file
25
+ @last_played = last_played
26
+ @plot = plot
27
+ video_details_media(title, art, play_count, fan_art, thumbnail, label)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end