kodi_client 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +56 -0
- data/.rubocop.yml +14 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +21 -0
- data/README.md +85 -0
- data/Rakefile +12 -0
- data/kodi_client.gemspec +33 -0
- data/lib/kodi_client/Chainable.rb +47 -0
- data/lib/kodi_client/global_types/addon_types.rb +182 -0
- data/lib/kodi_client/global_types/application_types.rb +58 -0
- data/lib/kodi_client/global_types/audio_types.rb +77 -0
- data/lib/kodi_client/global_types/global_types.rb +104 -0
- data/lib/kodi_client/global_types/gui_types.rb +185 -0
- data/lib/kodi_client/global_types/item_types.rb +18 -0
- data/lib/kodi_client/global_types/list_types.rb +246 -0
- data/lib/kodi_client/global_types/media_types.rb +50 -0
- data/lib/kodi_client/global_types/player_type.rb +300 -0
- data/lib/kodi_client/global_types/pvr_type.rb +17 -0
- data/lib/kodi_client/global_types/video_types.rb +118 -0
- data/lib/kodi_client/kodi_module.rb +86 -0
- data/lib/kodi_client/method/addons.rb +72 -0
- data/lib/kodi_client/method/application.rb +60 -0
- data/lib/kodi_client/method/gui.rb +62 -0
- data/lib/kodi_client/method/player.rb +220 -0
- data/lib/kodi_client/options.rb +27 -0
- data/lib/kodi_client/util/comparable.rb +17 -0
- data/lib/kodi_client/util/iterable.rb +11 -0
- data/lib/kodi_client.rb +37 -0
- metadata +77 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 80cc6b2d42829c10df356d2b3e8c2bf46dae2303db1596c7a8b8e1b6d7962379
|
4
|
+
data.tar.gz: 26d8be4a79379e65da672294cb612ff89600964828dad4f612a23a1a0d0c2e68
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 39697217776c9224ee079b989a046a34cbde9310e8444109edcd550e19020dc0610c74cc1e3f750dde4eb95ccc3f946da302bd14dda5d6a1782935c0dc704dd2
|
7
|
+
data.tar.gz: f9eb383b7b973d6f1f9d55d6fad5aff9b704f79ff95b2882814cb85a8834d70872c8f7e805f015eb0a999c7cce4cc49a7c4206ba480039c71700111258052d9f
|
data/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
# Ignore Byebug command history file.
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
Gemfile.lock
|
49
|
+
# .ruby-version
|
50
|
+
# .ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
56
|
+
# .rubocop-https?--*
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Metrics/ParameterLists:
|
2
|
+
Enabled: false
|
3
|
+
Layout/EmptyLinesAroundClassBody:
|
4
|
+
Enabled: false
|
5
|
+
Metrics/ClassLength:
|
6
|
+
Enabled: false
|
7
|
+
Metrics/AbcSize:
|
8
|
+
Enabled: false
|
9
|
+
Metrics/CyclomaticComplexity:
|
10
|
+
Enabled: false
|
11
|
+
Metrics/MethodLength:
|
12
|
+
Enabled: false
|
13
|
+
Metrics/PerceivedComplexity:
|
14
|
+
Enabled: false
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Chris
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# RubyKodiClient
|
2
|
+
|
3
|
+
RubyKodiClient is a work-in-progress client for [Kodi JSON API v12](https://kodi.wiki/view/JSON-RPC_API/v12) written in ruby.
|
4
|
+
|
5
|
+
Currently implemented are the following Methods:
|
6
|
+
* Addons
|
7
|
+
* Application
|
8
|
+
* GUI
|
9
|
+
* Player
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
from [rubygems](https://rubygems.org/gems/kodi_client) using
|
13
|
+
```shell
|
14
|
+
gem install kodi-client
|
15
|
+
```
|
16
|
+
or from the sources using
|
17
|
+
```shell
|
18
|
+
gem build kodi-client.gemspec
|
19
|
+
```
|
20
|
+
and then execute
|
21
|
+
```shell
|
22
|
+
gem build kodi-client-0.4.0.gemspec
|
23
|
+
```
|
24
|
+
|
25
|
+
## Enable Kodi Remote Control
|
26
|
+
In order to use JKodi Wrapper, Kodi remote control must be enabled. To do so perform the following steps:
|
27
|
+
|
28
|
+
1.) Go to Settings
|
29
|
+
![Settings](https://github.com/cf86/JKodiWrapper/blob/master/screenshots/Settings.png)
|
30
|
+
|
31
|
+
2.) Open the Services Menu
|
32
|
+
![Service](https://github.com/cf86/JKodiWrapper/blob/master/screenshots/Service.png)
|
33
|
+
|
34
|
+
3.) Select the Control Tab
|
35
|
+
![Control](https://github.com/cf86/JKodiWrapper/blob/master/screenshots/Control.png)
|
36
|
+
|
37
|
+
4.) Enable Remote control
|
38
|
+
![Remote Access](https://github.com/cf86/JKodiWrapper/blob/master/screenshots/RemoteAccess.png)
|
39
|
+
|
40
|
+
## Usage
|
41
|
+
|
42
|
+
To create a client you need at least the ip and port of the kodi server
|
43
|
+
```ruby
|
44
|
+
client = KodiClient.connect('127.0.0.1', 8080)
|
45
|
+
```
|
46
|
+
optional you can also provide authentication and if required, TLS
|
47
|
+
```ruby
|
48
|
+
client = KodiClient.connect('127.0.0.1', 8080).auth('kodi', 'password').use_tls
|
49
|
+
```
|
50
|
+
once a client is created, all methods are available, e.g.
|
51
|
+
```ruby
|
52
|
+
client = KodiClient.connect('127.0.0.1', 8080).auth('kodi', 'password').use_tls
|
53
|
+
application = client.application
|
54
|
+
gui = client.gui
|
55
|
+
```
|
56
|
+
with the method aquired, all calls can be executed, for example to quit kodi
|
57
|
+
```ruby
|
58
|
+
client = KodiClient.connect('127.0.0.1', 8080).auth('kodi', 'password').use_tls
|
59
|
+
application = client.application
|
60
|
+
application.quit
|
61
|
+
```
|
62
|
+
or to play a movie
|
63
|
+
```ruby
|
64
|
+
client = KodiClient.connect('127.0.0.1', 8080).auth('kodi', 'password').use_tls
|
65
|
+
player = client.player
|
66
|
+
# the file can be a local path on the server, or e.g. an upnp file url
|
67
|
+
player.player_open('path/to/file')
|
68
|
+
```
|
69
|
+
some calls just return a simple `OK` result, some also return some data, the full response is always returned
|
70
|
+
in a `KodiResponse`, which contains any `error` and any `result` as specified in the documentation.
|
71
|
+
```ruby
|
72
|
+
client = KodiClient.connect('127.0.0.1', 8080).auth('kodi', 'password').use_tls
|
73
|
+
player = client.player
|
74
|
+
# the file can be a local path on the server, or e.g. an upnp file url
|
75
|
+
player.player_open('path/to/file')
|
76
|
+
# movie started, now we can seek (assuming it is player 1) to 50% of the movie
|
77
|
+
response = player.seek(1, 50.0)
|
78
|
+
# seek returns percentage, time and total time
|
79
|
+
response.result.percentage # => 50.0
|
80
|
+
response.result.time # => { 'hours' => 1, 'minutes' => 30, 'seconds' => 0}, 'milliseconds' => 0 }
|
81
|
+
```
|
82
|
+
|
83
|
+
## License
|
84
|
+
|
85
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/kodi_client.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'kodi_client'
|
5
|
+
spec.version = '0.4.0'
|
6
|
+
spec.authors = ['Christian Feier']
|
7
|
+
spec.email = ['christian.feier@gmail.com']
|
8
|
+
|
9
|
+
spec.summary = 'A work-in-progress client for Kodi JSON API v2.'
|
10
|
+
spec.description = 'A client for the Kodi JSON API v12, currently implemented methods are addons, application, gui and player (more will be added with the time). For more information how to use it and how to activate Remote Control in Kodi, please check the github page https://github.com/cfe86/RubyKodiClient'
|
11
|
+
spec.homepage = 'https://github.com/cfe86/RubyKodiClient'
|
12
|
+
spec.license = 'MIT'
|
13
|
+
spec.required_ruby_version = '>= 2.5.0'
|
14
|
+
|
15
|
+
spec.metadata['homepage_uri'] = 'https://github.com/cfe86/RubyKodiClient'
|
16
|
+
spec.metadata['source_code_uri'] = 'https://github.com/cfe86/RubyKodiClient'
|
17
|
+
spec.metadata['changelog_uri'] = 'https://github.com/cfe86/RubyKodiClient'
|
18
|
+
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
23
|
+
end
|
24
|
+
spec.bindir = 'exe'
|
25
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ['lib']
|
27
|
+
|
28
|
+
# Uncomment to register a new dependency of your gem
|
29
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
30
|
+
|
31
|
+
# For more information and examples about making a new gem, checkout our
|
32
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
33
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'kodi_client/options'
|
4
|
+
|
5
|
+
module KodiClient
|
6
|
+
# Offers methods like connect, auth and tls to be chained together
|
7
|
+
module Chainable
|
8
|
+
|
9
|
+
attr_accessor :options, :client
|
10
|
+
|
11
|
+
def connect(ip, port)
|
12
|
+
merge_options(->(options) { options.with_connection(ip, port) })
|
13
|
+
end
|
14
|
+
|
15
|
+
def auth(username, password)
|
16
|
+
merge_options(->(options) { options.with_auth(username, password) })
|
17
|
+
end
|
18
|
+
|
19
|
+
def use_tls(enabled: true)
|
20
|
+
merge_options(->(options) { options.with_tls(enabled) })
|
21
|
+
end
|
22
|
+
|
23
|
+
def merge_options(set_command)
|
24
|
+
client = def_client
|
25
|
+
options = def_options
|
26
|
+
set_command.call(options)
|
27
|
+
client.apply_options(options)
|
28
|
+
client
|
29
|
+
end
|
30
|
+
|
31
|
+
def def_client
|
32
|
+
if @client.nil?
|
33
|
+
@client = KodiClient::Client.new
|
34
|
+
@client.client = @client
|
35
|
+
end
|
36
|
+
@client
|
37
|
+
end
|
38
|
+
|
39
|
+
def def_options
|
40
|
+
if @options.nil?
|
41
|
+
@options ||= KodiClient::Options.new
|
42
|
+
@client.options = @options
|
43
|
+
end
|
44
|
+
@options
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,182 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'kodi_client/global_types/item_types'
|
4
|
+
require 'kodi_client/util/comparable'
|
5
|
+
require 'kodi_client/util/iterable'
|
6
|
+
|
7
|
+
module KodiClient
|
8
|
+
module Types
|
9
|
+
module Addons
|
10
|
+
|
11
|
+
# Addon Types https://kodi.wiki/view/JSON-RPC_API/v12#Addon.Types
|
12
|
+
module AddonTypes
|
13
|
+
include Iterable
|
14
|
+
|
15
|
+
UNKNOWN = 'unknown'
|
16
|
+
KODI_ADSP = 'kodi.adsp'
|
17
|
+
KODI_AUDIODECODER = 'kodi.audiodecoder'
|
18
|
+
KODI_CONTEXT_ITEM = 'kodi.context.item'
|
19
|
+
KODI_GAME_CONTROLLER = 'kodi.game.controller'
|
20
|
+
KODI_INPUTSTREAM = 'kodi.inputstream'
|
21
|
+
KODI_PERIPHERAL = 'kodi.peripheral'
|
22
|
+
KODI_RESOURCE_IMAGES = 'kodi.resource.images'
|
23
|
+
KODI_RESOURCE_LANGUAGE = 'kodi.resource.language'
|
24
|
+
KODI_RESOURCE_UISOUNDS = 'kodi.resource.uisounds'
|
25
|
+
XBMC_ADDON_AUDIO = 'xbmc.addon.audio'
|
26
|
+
XBMC_ADDON_EXECUTABLE = 'xbmc.addon.executable'
|
27
|
+
XBMC_ADDON_IMAGE = 'xbmc.addon.image'
|
28
|
+
XBMC_ADDON_REPOSITORY = 'xbmc.addon.repository'
|
29
|
+
XBMC_ADDON_VIDEO = 'xbmc.addon.video'
|
30
|
+
XBMC_AUDIOENCODER = 'xbmc.audioencoder'
|
31
|
+
XBMC_GUI_SKIN = 'xbmc.gui.skin'
|
32
|
+
XBMC_METADATA_SCRAPER_ALBUMS = 'xbmc.metadata.scraper.albums'
|
33
|
+
XBMC_METADATA_SCRAPER_ARTISTS = 'xbmc.metadata.scraper.artists'
|
34
|
+
XBMC_METADATA_SCRAPER_LIBRARY = 'xbmc.metadata.scraper.library'
|
35
|
+
XBMC_METADATA_SCRAPER_MOVIES = 'xbmc.metadata.scraper.movies'
|
36
|
+
XBMC_METADATA_SCRAPER_MUSICVIDEOS = 'xbmc.metadata.scraper.musicvideos'
|
37
|
+
XBMC_METADATA_SCRAPER_TVSHOWS = 'xbmc.metadata.scraper.episodes'
|
38
|
+
XBMC_PLAYER_MUSICVIZ = 'xbmc.player.musicviz'
|
39
|
+
XBMC_PVRCLIENT = 'xbmc.pvrclient'
|
40
|
+
XBMC_PYTHON_LIBRARY = 'xbmc.python.library'
|
41
|
+
XBMC_PYTHON_LYRICS = 'xbmc.python.lyrics'
|
42
|
+
XBMC_PYTHON_MODULE = 'xbmc.python.module'
|
43
|
+
XBMC_PYTHON_PLUGINSOURCE = 'xbmc.python.pluginsource'
|
44
|
+
XBMC_PYTHON_SCRIPT = 'xbmc.python.script'
|
45
|
+
XBMC_PYTHON_WEATHER = 'xbmc.python.weather'
|
46
|
+
XBMC_SERVICE = 'xbmc.service'
|
47
|
+
XBMC_SUBTITLE_MODULE = 'xbmc.subtitle.module'
|
48
|
+
XBMC_UI_SCREENSAVER = 'xbmc.ui.screensaver'
|
49
|
+
XBMC_WEBINTERFACE = 'xbmc.webinterface'
|
50
|
+
end
|
51
|
+
|
52
|
+
# Addon.Content https://kodi.wiki/view/JSON-RPC_API/v12#Addon.Content
|
53
|
+
module AddonContent
|
54
|
+
include Iterable
|
55
|
+
UNKNOWN = 'unknown'
|
56
|
+
AUDIO = 'audio'
|
57
|
+
EXECUTABLE = 'executable'
|
58
|
+
IMAGE = 'image'
|
59
|
+
VIDEO = 'video'
|
60
|
+
end
|
61
|
+
|
62
|
+
# Addon.Fields https://kodi.wiki/view/JSON-RPC_API/v12#Addon.Content
|
63
|
+
module AddonFields
|
64
|
+
extend Iterable
|
65
|
+
|
66
|
+
AUTHOR = 'author'
|
67
|
+
BROKEN = 'broken'
|
68
|
+
DEPENDENCIES = 'dependencies'
|
69
|
+
DESCRIPTION = 'description'
|
70
|
+
DISCLAIMER = 'disclaimer'
|
71
|
+
ENABLED = 'enabled'
|
72
|
+
EXTRAINFO = 'extrainfo'
|
73
|
+
FANART = 'fanart'
|
74
|
+
INSTALLED = 'installed'
|
75
|
+
NAME = 'name'
|
76
|
+
PATH = 'path'
|
77
|
+
RATING = 'rating'
|
78
|
+
SUMMARY = 'summary'
|
79
|
+
THUMBNAIL = 'thumbnail'
|
80
|
+
VERSION = 'version'
|
81
|
+
end
|
82
|
+
|
83
|
+
# represents addon dependency
|
84
|
+
class AddonDependency
|
85
|
+
include Comparable
|
86
|
+
|
87
|
+
attr_reader :addonid, :optional, :version
|
88
|
+
|
89
|
+
def initialize(hash)
|
90
|
+
@addonid = hash['addonid']
|
91
|
+
@optional = hash['optional']
|
92
|
+
@version = hash['version']
|
93
|
+
end
|
94
|
+
|
95
|
+
def ==(other)
|
96
|
+
compare(self, other)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# represents addon extra info
|
101
|
+
class AddonExtraInfo
|
102
|
+
include Comparable
|
103
|
+
|
104
|
+
attr_reader :key, :value
|
105
|
+
|
106
|
+
def initialize(hash)
|
107
|
+
@key = hash['key']
|
108
|
+
@value = hash['value']
|
109
|
+
end
|
110
|
+
|
111
|
+
def ==(other)
|
112
|
+
compare(self, other)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# represents addon details
|
117
|
+
class AddonDetails
|
118
|
+
include Comparable
|
119
|
+
include Items::ItemDetailsBase
|
120
|
+
|
121
|
+
attr_reader :addon_id, :author, :broken, :dependencies, :description, :disclaimer, :enabled, :extra_info,
|
122
|
+
:fan_art, :installed, :name, :path, :rating, :summary, :thumbnail, :type, :version
|
123
|
+
|
124
|
+
def initialize(hash)
|
125
|
+
@addon_id = hash['addonid']
|
126
|
+
@author = hash['author']
|
127
|
+
@broken = hash['broken']
|
128
|
+
@dependencies = hash['dependencies'].nil? ? nil : hash['dependencies'].map { |it| AddonDependency.new(it) }
|
129
|
+
@description = hash['description']
|
130
|
+
@disclaimer = hash['disclaimer']
|
131
|
+
@enabled = hash['enabled']
|
132
|
+
@extra_info = hash['extrainfo'].nil? ? nil : hash['extrainfo'].map { |it| AddonExtraInfo.new(it) }
|
133
|
+
@fan_art = hash['fanart']
|
134
|
+
@installed = hash['installed']
|
135
|
+
@name = hash['name']
|
136
|
+
@path = hash['path']
|
137
|
+
@rating = hash['rating']
|
138
|
+
@summary = hash['summary']
|
139
|
+
@thumbnail = hash['thumbnail']
|
140
|
+
@type = hash['type']
|
141
|
+
@version = hash['version']
|
142
|
+
item_details_base(hash)
|
143
|
+
end
|
144
|
+
|
145
|
+
def ==(other)
|
146
|
+
compare(self, other)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# getAddons return
|
151
|
+
class Addons
|
152
|
+
include Comparable
|
153
|
+
|
154
|
+
attr_reader :addons, :limits
|
155
|
+
|
156
|
+
def initialize(hash)
|
157
|
+
@addons = hash['addons'].map { |it| AddonDetails.new(it) }
|
158
|
+
@limits = List::ListLimitsReturned.new(hash['limits'])
|
159
|
+
end
|
160
|
+
|
161
|
+
def ==(other)
|
162
|
+
compare(self, other)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# getAddon return
|
167
|
+
class Addon
|
168
|
+
include Comparable
|
169
|
+
|
170
|
+
attr_reader :addon
|
171
|
+
|
172
|
+
def initialize(hash)
|
173
|
+
@addon = AddonDetails.new(hash['addon'])
|
174
|
+
end
|
175
|
+
|
176
|
+
def ==(other)
|
177
|
+
compare(self, other)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'kodi_client/util/comparable'
|
4
|
+
require 'kodi_client/util/iterable'
|
5
|
+
|
6
|
+
module KodiClient
|
7
|
+
module Types
|
8
|
+
module Application
|
9
|
+
|
10
|
+
# Application.Property.Name https://kodi.wiki/view/JSON-RPC_API/v12#Application.Property.Name
|
11
|
+
module PropertyName
|
12
|
+
extend Iterable
|
13
|
+
|
14
|
+
VOLUME = 'volume'
|
15
|
+
MUTED = 'muted'
|
16
|
+
NAME = 'name'
|
17
|
+
VERSION = 'version'
|
18
|
+
SORT_TOKENS = 'sorttokens'
|
19
|
+
LANGUAGE = 'language'
|
20
|
+
end
|
21
|
+
|
22
|
+
# Application.Property.Value https://kodi.wiki/view/JSON-RPC_API/v12#Application.Property.Value
|
23
|
+
class PropertyValue
|
24
|
+
include Comparable
|
25
|
+
|
26
|
+
attr_reader :name, :version, :muted, :volume
|
27
|
+
|
28
|
+
def initialize(hash)
|
29
|
+
@name = hash['name']
|
30
|
+
@version = hash['version'].nil? ? nil : Version.new(hash['version'])
|
31
|
+
@muted = hash['muted']
|
32
|
+
@volume = hash['volume']
|
33
|
+
end
|
34
|
+
|
35
|
+
def ==(other)
|
36
|
+
compare(self, other)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# represent application properties version
|
41
|
+
class Version
|
42
|
+
include Comparable
|
43
|
+
attr_reader :major, :minor, :revision, :tag
|
44
|
+
|
45
|
+
def initialize(hash)
|
46
|
+
@major = hash['major']
|
47
|
+
@minor = hash['minor']
|
48
|
+
@revision = hash['revision']
|
49
|
+
@tag = hash['tag']
|
50
|
+
end
|
51
|
+
|
52
|
+
def ==(other)
|
53
|
+
compare(self, other)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'kodi_client/global_types/media_types'
|
4
|
+
require 'kodi_client/global_types/player_type'
|
5
|
+
require 'kodi_client/util/comparable'
|
6
|
+
require 'kodi_client/util/iterable'
|
7
|
+
|
8
|
+
module KodiClient
|
9
|
+
module Types
|
10
|
+
module Audio
|
11
|
+
|
12
|
+
# Audio.Contributor https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Contributors
|
13
|
+
class AudioContributor
|
14
|
+
include Comparable
|
15
|
+
|
16
|
+
attr_reader :artist_id, :name, :role, :role_id
|
17
|
+
|
18
|
+
def initialize(hash)
|
19
|
+
@artist_id = hash['artistid']
|
20
|
+
@name = hash['name']
|
21
|
+
@role = hash['role']
|
22
|
+
@role_id = hash['roleid']
|
23
|
+
end
|
24
|
+
|
25
|
+
def ==(other)
|
26
|
+
compare(self, other)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Audio.Album.ReleaseType https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Album.ReleaseType
|
31
|
+
module AudioAlbumReleaseType
|
32
|
+
extend Iterable
|
33
|
+
|
34
|
+
ALBUM = 'album'
|
35
|
+
SINGLE = 'single'
|
36
|
+
end
|
37
|
+
|
38
|
+
# Audio.Details.Base https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Details.Base
|
39
|
+
module AudioDetailsBase
|
40
|
+
include Media::MediaDetailsBase
|
41
|
+
|
42
|
+
attr_reader :art, :date_added, :genre
|
43
|
+
|
44
|
+
def audio_details_base(hash)
|
45
|
+
@art = Types::Media::MediaArtwork.new(hash['art'])
|
46
|
+
@date_added = hash['date_added']
|
47
|
+
@genre = hash['genre']
|
48
|
+
media_details_base(hash)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Audio.Details.Media https://kodi.wiki/view/JSON-RPC_API/v12#Audio.Details.Media
|
53
|
+
module AudioDetailsMedia
|
54
|
+
include AudioDetailsBase
|
55
|
+
|
56
|
+
attr_reader :artist, :artist_id, :display_artist, :musicbrainz_albumartist_id, :original_date, :rating,
|
57
|
+
:release_date, :sort_artist, :title, :user_rating, :votes, :year
|
58
|
+
|
59
|
+
def audio_details_media(hash)
|
60
|
+
@artist = hash['artist']
|
61
|
+
@artist_id = hash['artistid']
|
62
|
+
@display_artist = hash['displayartist']
|
63
|
+
@musicbrainz_albumartist_id = hash['musicbrainzalbumartistid']
|
64
|
+
@original_date = hash['originaldate']
|
65
|
+
@rating = hash['rating']
|
66
|
+
@release_date = hash['releasedate']
|
67
|
+
@sort_artist = hash['sortartist']
|
68
|
+
@title = hash['title']
|
69
|
+
@user_rating = hash['userrating']
|
70
|
+
@votes = hash['votes']
|
71
|
+
@year = hash['year']
|
72
|
+
audio_details_base(hash)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|