Giter Site home page Giter Site logo

kodirpc's Introduction

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/.

kodirpc's People

Contributors

metaphoricalsheep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kodirpc's Issues

Provide description for methods and properties where provided by Introspect method

Example of description on ShowDialog for VideoLibrary.Scan:

"result": {
        "description": "JSON-RPC API of XBMC",
        "id": "http://xbmc.org/jsonrpc/ServiceDescription.json",
        "methods": {
            "VideoLibrary.Scan": {
                "description": "Scans the video sources for new library items",
                "params": [
                    {
                        "default": "",
                        "name": "directory",
                        "type": "string"
                    },
                    {
                        "default": true,
                        "description": "Whether or not to show the progress bar or any other GUI dialog",
                        "name": "showdialogs",
                        "type": "boolean"
                    }
                ],
                "returns": {
                    "type": "string"
                },
                "type": "method"
            }
        },
        "version": "6.32.5"
    }

Can't transform if App.config is not there

App.config is not part of the repo. It gets generated each time you build, but the build scripts are unable to do the transforms if App.config is missing.

The simplest solution is to simply commit the App.config file, but that will be annoying since it will change the whole time.

A better solution will be to have the build scripts either check if it exists and create it if it doesn't or just delete and recreate it.

README.md

Write something relevant in the readme file.

Testing

Find out how to and implement unit tests.

Copyright notice

Add the copyright notice to all source files

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/.

MakeRequest to return JsonResponse

MakeRequest needs to return JsonResponse instead of just the result class (like GetMovieDetailsResponse) so that we can access Limits, Error, Id and whatever else, not just the result object. Tests and DemoClient will need to be updated as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.