0.0
No release in over a year
A client for the Kodi JSON API v12, currently implemented methods are Addons, Application, AudioLibrary Favourites, Files, GUI, Input, Player, Profiles and System (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
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 5.0.4
 Project Readme

RubyKodiClient

RubyKodiClient is a work-in-progress client for Kodi JSON API v12 written in ruby.

Currently implemented are the following Methods:

  • Addons
  • Application
  • AudioLibrary
  • Favourites
  • Files
  • GUI
  • Input
  • Player
  • Profiles
  • System

Installation

from rubygems using

gem install kodi-client

or from the sources using

gem build kodi-client.gemspec

and then execute

gem build kodi-client-x.x.x.gemspec

Enable Kodi Remote Control

In order to use JKodi Wrapper, Kodi remote control must be enabled. To do so perform the following steps:

1.) Go to Settings Settings

2.) Open the Services Menu Service

3.) Select the Control Tab Control

4.) Enable Remote control Remote Access

Usage

To create a client you need at least the ip and port of the kodi server

client = KodiClient.connect('127.0.0.1', 8080)

optional you can also provide authentication and if required, TLS

client = KodiClient.connect('127.0.0.1', 8080).auth('kodi', 'password').use_tls

once a client is created, all methods are available, e.g.

client = KodiClient.connect('127.0.0.1', 8080).auth('kodi', 'password').use_tls
application = client.application
gui = client.gui

with the method aquired, all calls can be executed, for example to quit kodi

client = KodiClient.connect('127.0.0.1', 8080).auth('kodi', 'password').use_tls
application = client.application
application.quit

or to play a movie

client = KodiClient.connect('127.0.0.1', 8080).auth('kodi', 'password').use_tls
player = client.player
# the file can be a local path on the server, or e.g. an upnp file url
player.player_open('path/to/file')

some calls just return a simple OK result, some also return some data, the full response is always returned in a KodiResponse, which contains any error and any result as specified in the documentation.

client = KodiClient.connect('127.0.0.1', 8080).auth('kodi', 'password').use_tls
player = client.player
# the file can be a local path on the server, or e.g. an upnp file url
player.player_open('path/to/file')
# movie started, now we can seek (assuming it is player 1) to 50% of the movie
response = player.seek(1, 50.0)
# seek returns percentage, time and total time
response.result.percentage # => 50.0
response.result.time # => { 'hours' => 1, 'minutes' => 30, 'seconds' => 0}, 'milliseconds' => 0 }

License

The gem is available as open source under the terms of the MIT License.