Skip to content

MetaphoricalSheep/KodiRPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KodiRPC - A .NET/C# wrapper for the Kodi Api (v6)

The KodiRPC documentation can be viewed on (http://kodi.wiki/view/JSON-RPC_API/v6)

Getting Started

Installation

You can clone the KodiRPC repository in any path.

git clone https://github.com/MetaphoricalSheep/KodiRPC.git

Configuration

Specify your kodi connection settings in your *.config file

<appSettings>
  <add key="Debug" value="false"/>
  <add key="KodiUsername" value="kodi"/>
  <add key="KodiPassword" value="kodi"/>
  <add key="KodiHost" value="http://localhost"/>
  <add key="KodiPort" value="80"/>
</appSettings>

Setting the debug key to true will output the request info on every request that you make. Useful for debugging, terrible for production.

Usage

All the KodiRPC methods are exposed through the KodiService class. Instantiate an instance of the class to get started.

using KodiRPC.Services;
var service = new KodiService();

You can use the Ping() method to ping Kodi:

var ping = Service.Ping();
Console.WriteLine(ping.Result);

You can use the GetTvShows() method to get all tv shows:

var parameters = new GetTvShowsParams()
{
    Properties = TvShowProperties.All()
};

var shows = Service.GetTvShows(parameters);

Console.WriteLine("First Show Title: {0}", shows.Result.TvShows.First().Title)

The parameters variable is used to specify the payload for the method you are calling. You can set Filter, Limit, Properties and Sort depending on the method. Some methods, like the Details methods, require an id as well.

You can use the GetTvShowDetails() method to get detailed data about a specific show:

var parameters = new GetTvShowDetailsParams()
{
    TvShowId = 54,
    Properties = TvShowProperties.All()
};

var details = Service.GetTvShowDetails(parameters);

Console.WriteLine("Show Title: {0}", details.Result.TvShow.Title)

Methods

Implemented Methods

  1. JSONRPC
    1. JSONRPC.Ping
  2. VideoLibrary
    1. VideoLibrary.Clean
    2. VideoLibrary.Scan
    3. VideoLibrary.GetEpisodeDetails
    4. VideoLibrary.GetEpisodes
    5. VideoLibrary.GetMovieDetails
    6. VideoLibrary.GetMovies
    7. VideoLibrary.GetRecentlyAddedEpisodes
    8. VideoLibrary.GetRecentlyAddedMovies
    9. VideoLibrary.GetSeasons
    10. VideoLibrary.GetTvShowDetails
    11. VideoLibrary.GetTvShows
  3. Files
    1. Files.GetDirectory
    2. Files.PrepareDownload

Planned Methods (v1.1)

  1. Input
    1. Input.Back
    2. Input.ContextMenu
    3. Input.Down
    4. Input.ExecuteAction
    5. Input.Home
    6. Input.Info
    7. Input.Left
    8. Input.Right
    9. Input.Select
    10. Input.SendText
    11. Input.ShowCodec
    12. Input.ShowOSD
    13. Input.Up
  2. JSONRPC
    1. JSONRPC.GetConfiguration
    2. JSONRPC.Introspect
    3. JSONRPC.NotifyAll
    4. JSONRPC.Permission
    5. JSONRPC.SetConfiguration
    6. JSONRPC.Version
  3. VideoLibrary
    1. VideoLibrary.Export
    2. VideoLibrary.GetGenres
    3. VideoLibrary.GetMusicVideoDetails
    4. VideoLibrary.GetMusicVideos
    5. VideoLibrary.GetRecentlyAddedMusicVideos
    6. VideoLibrary.RemoveEpisode
    7. VideoLibrary.RemoveMovie
    8. VideoLibrary.RemoveMusicVideo
    9. VideoLibrary.RemoveTVShow

Unplanned Methods

  1. Addons
    1. Addons.ExecuteAddon
    2. Addons.GetAddonDetails
    3. Addons.GetAddons
    4. Addons.SetAddonEnabled
  2. Application
    1. Application.GetProperties
    2. Application.Quit
    3. Application.SetMute
    4. Application.SetVolume
  3. AudioLibrary
    1. AudioLibrary.Clean
    2. AudioLibrary.Export
    3. AudioLibrary.GetAlbumDetails
    4. AudioLibrary.GetAlbums
    5. AudioLibrary.GetArtistDetails
    6. AudioLibrary.GetArtists
    7. AudioLibrary.GetGenres
    8. AudioLibrary.GetRecentlyAddedAlbums
    9. AudioLibrary.GetRecentlyAddedSongs
    10. AudioLibrary.GetRecentlyPlayedAlbums
    11. AudioLibrary.GetRecentlyPlayedSongs
    12. AudioLibrary.GetSongDetails
    13. AudioLibrary.GetSongs
    14. AudioLibrary.Scan
    15. AudioLibrary.SetAlbumDetails
    16. AudioLibrary.SetArtistDetails
    17. AudioLibrary.SetSongDetails
  4. Files
    1. Files.GetFileDetails
    2. Files.GetSources
    3. Files.Download
  5. GUI
    1. GUI.ActivateWindow
    2. GUI.GetProperties
    3. GUI.SetFullscreen
    4. GUI.ShowNotification
  6. PVR
    1. PVR.GetChannelDetails
    2. PVR.GetChannelGroupDetails
    3. PVR.GetChannelGroups
    4. PVR.GetChannels
    5. PVR.GetProperties
    6. PVR.Record
    7. PVR.Scan
  7. Player
    1. Player.GetActivePlayers
    2. Player.GetItem
    3. Player.GetProperties
    4. Player.GoTo
    5. Player.Move
    6. Player.Open
    7. Player.PlayPause
    8. Player.Rotate
    9. Player.Seek
    10. Player.SetAudioStream
    11. Player.SetPartymode
    12. Player.SetRepeat
    13. Player.SetShuffle
    14. Player.SetSpeed
    15. Player.SetSubtitle
    16. Player.Stop
    17. Player.Zoom
  8. Playlist
    1. Playlist.Add
    2. Playlist.Clear
    3. Playlist.GetItems
    4. Playlist.GetPlaylists
    5. Playlist.GetProperties
    6. Playlist.Insert
    7. Playlist.Remove
    8. Playlist.Swap
  9. System
    1. System.EjectOpticalDrive
    2. System.GetProperties
    3. System.Hibernate
    4. System.Reboot
    5. System.Shutdown
    6. System.Suspend
  10. VideoLibrary
    1. VideoLibrary.GetMovieSetDetails
    2. VideoLibrary.GetMovieSets
    3. VideoLibrary.SetEpisodeDetails
    4. VideoLibrary.SetMovieDetails
    5. VideoLibrary.SetMusicVideoDetails
    6. VideoLibrary.SetTVShowDetails
  11. Kodi
    1. XBMC.GetInfoBooleans
    2. XBMC.GetInfoLabels

License

Copyright (C) 2016 Pieter-Uys Fourie

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.