项目作者: MetaphoricalSheep
项目描述 :
Kodi JSON-RPC API/v6 Wrapper in C#
高级语言: C#
项目地址: git://github.com/MetaphoricalSheep/KodiRPC.git
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>
<add key="KodiUsername" value="kodi"></add>
<add key="KodiPassword" value="kodi"></add>
<add key="KodiHost" value="http://localhost"></add>
<add key="KodiPort" value="80"></add>
</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
- JSONRPC
- JSONRPC.Ping
- VideoLibrary
- VideoLibrary.Clean
- VideoLibrary.Scan
- VideoLibrary.GetEpisodeDetails
- VideoLibrary.GetEpisodes
- VideoLibrary.GetMovieDetails
- VideoLibrary.GetMovies
- VideoLibrary.GetRecentlyAddedEpisodes
- VideoLibrary.GetRecentlyAddedMovies
- VideoLibrary.GetSeasons
- VideoLibrary.GetTvShowDetails
- VideoLibrary.GetTvShows
- Files
- Files.GetDirectory
- Files.PrepareDownload
Planned Methods (v1.1)
- Input
- Input.Back
- Input.ContextMenu
- Input.Down
- Input.ExecuteAction
- Input.Home
- Input.Info
- Input.Left
- Input.Right
- Input.Select
- Input.SendText
- Input.ShowCodec
- Input.ShowOSD
- Input.Up
- JSONRPC
- JSONRPC.GetConfiguration
- JSONRPC.Introspect
- JSONRPC.NotifyAll
- JSONRPC.Permission
- JSONRPC.SetConfiguration
- JSONRPC.Version
- VideoLibrary
- VideoLibrary.Export
- VideoLibrary.GetGenres
- VideoLibrary.GetMusicVideoDetails
- VideoLibrary.GetMusicVideos
- VideoLibrary.GetRecentlyAddedMusicVideos
- VideoLibrary.RemoveEpisode
- VideoLibrary.RemoveMovie
- VideoLibrary.RemoveMusicVideo
- VideoLibrary.RemoveTVShow
Unplanned Methods
- Addons
- Addons.ExecuteAddon
- Addons.GetAddonDetails
- Addons.GetAddons
- Addons.SetAddonEnabled
- Application
- Application.GetProperties
- Application.Quit
- Application.SetMute
- Application.SetVolume
- AudioLibrary
- AudioLibrary.Clean
- AudioLibrary.Export
- AudioLibrary.GetAlbumDetails
- AudioLibrary.GetAlbums
- AudioLibrary.GetArtistDetails
- AudioLibrary.GetArtists
- AudioLibrary.GetGenres
- AudioLibrary.GetRecentlyAddedAlbums
- AudioLibrary.GetRecentlyAddedSongs
- AudioLibrary.GetRecentlyPlayedAlbums
- AudioLibrary.GetRecentlyPlayedSongs
- AudioLibrary.GetSongDetails
- AudioLibrary.GetSongs
- AudioLibrary.Scan
- AudioLibrary.SetAlbumDetails
- AudioLibrary.SetArtistDetails
- AudioLibrary.SetSongDetails
- Files
- Files.GetFileDetails
- Files.GetSources
- Files.Download
- GUI
- GUI.ActivateWindow
- GUI.GetProperties
- GUI.SetFullscreen
- GUI.ShowNotification
- PVR
- PVR.GetChannelDetails
- PVR.GetChannelGroupDetails
- PVR.GetChannelGroups
- PVR.GetChannels
- PVR.GetProperties
- PVR.Record
- PVR.Scan
- Player
- Player.GetActivePlayers
- Player.GetItem
- Player.GetProperties
- Player.GoTo
- Player.Move
- Player.Open
- Player.PlayPause
- Player.Rotate
- Player.Seek
- Player.SetAudioStream
- Player.SetPartymode
- Player.SetRepeat
- Player.SetShuffle
- Player.SetSpeed
- Player.SetSubtitle
- Player.Stop
- Player.Zoom
- Playlist
- Playlist.Add
- Playlist.Clear
- Playlist.GetItems
- Playlist.GetPlaylists
- Playlist.GetProperties
- Playlist.Insert
- Playlist.Remove
- Playlist.Swap
- System
- System.EjectOpticalDrive
- System.GetProperties
- System.Hibernate
- System.Reboot
- System.Shutdown
- System.Suspend
- VideoLibrary
- VideoLibrary.GetMovieSetDetails
- VideoLibrary.GetMovieSets
- VideoLibrary.SetEpisodeDetails
- VideoLibrary.SetMovieDetails
- VideoLibrary.SetMusicVideoDetails
- VideoLibrary.SetTVShowDetails
- Kodi
- XBMC.GetInfoBooleans
- 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.