@ -3,14 +3,14 @@ using System.Net.Http;
using System.Threading.Tasks ;
using Microsoft.EntityFrameworkCore.Internal ;
using Newtonsoft.Json ;
using Ombi.Api. Emby .Models;
using Ombi.Api. Emby .Models.Media.Tv;
using Ombi.Api. Emby .Models.Movie;
using Ombi.Api. Jellyfin .Models;
using Ombi.Api. Jellyfin .Models.Media.Tv;
using Ombi.Api. Jellyfin .Models.Movie;
using Ombi.Helpers ;
namespace Ombi.Api. Emby
namespace Ombi.Api. Jellyfin
{
public class JellyfinApi : I Emby Api
public class JellyfinApi : I Jellyfin Api
{
public JellyfinApi ( IApi api )
{
@ -20,27 +20,27 @@ namespace Ombi.Api.Emby
private IApi Api { get ; }
/// <summary>
/// Returns all users from the Emby Instance
/// Returns all users from the Jellyfin Instance
/// </summary>
/// <param name="baseUri"></param>
/// <param name="apiKey"></param>
public async Task < List < Emby User> > GetUsers ( string baseUri , string apiKey )
public async Task < List < Jellyfin User> > GetUsers ( string baseUri , string apiKey )
{
var request = new Request ( "users" , baseUri , HttpMethod . Get ) ;
AddHeaders ( request , apiKey ) ;
var obj = await Api . Request < List < Emby User> > ( request ) ;
var obj = await Api . Request < List < Jellyfin User> > ( request ) ;
return obj ;
}
public async Task < Emby SystemInfo> GetSystemInformation ( string apiKey , string baseUrl )
public async Task < Jellyfin SystemInfo> GetSystemInformation ( string apiKey , string baseUrl )
{
var request = new Request ( "System/Info" , baseUrl , HttpMethod . Get ) ;
AddHeaders ( request , apiKey ) ;
var obj = await Api . Request < Emby SystemInfo> ( request ) ;
var obj = await Api . Request < Jellyfin SystemInfo> ( request ) ;
return obj ;
}
@ -56,7 +56,7 @@ namespace Ombi.Api.Emby
return obj ;
}
public async Task < Emby User> LogIn ( string username , string password , string apiKey , string baseUri )
public async Task < Jellyfin User> LogIn ( string username , string password , string apiKey , string baseUri )
{
var request = new Request ( "users/authenticatebyname" , baseUri , HttpMethod . Post ) ;
var body = new
@ -71,11 +71,11 @@ namespace Ombi.Api.Emby
$"MediaBrowser Client=\" Ombi \ ", Device=\"Ombi\", DeviceId=\"v3\", Version=\"v3\"" ) ;
AddHeaders ( request , apiKey ) ;
var obj = await Api . Request < Emby User> ( request ) ;
var obj = await Api . Request < Jellyfin User> ( request ) ;
return obj ;
}
public async Task < EmbyItemContainer< Emby Movie> > GetCollection ( string mediaId , string apiKey , string userId , string baseUrl )
public async Task < JellyfinItemContainer< Jellyfin Movie> > GetCollection ( string mediaId , string apiKey , string userId , string baseUrl )
{
var request = new Request ( $"users/{userId}/items?parentId={mediaId}" , baseUrl , HttpMethod . Get ) ;
AddHeaders ( request , apiKey ) ;
@ -84,22 +84,22 @@ namespace Ombi.Api.Emby
request . AddQueryString ( "IsVirtualItem" , "False" ) ;
return await Api . Request < EmbyItemContainer< Emby Movie> > ( request ) ;
return await Api . Request < JellyfinItemContainer< Jellyfin Movie> > ( request ) ;
}
public async Task < EmbyItemContainer< Emby Movie> > GetAllMovies ( string apiKey , int startIndex , int count , string userId , string baseUri )
public async Task < JellyfinItemContainer< Jellyfin Movie> > GetAllMovies ( string apiKey , int startIndex , int count , string userId , string baseUri )
{
return await GetAll < Emby Movie> ( "Movie" , apiKey , userId , baseUri , true , startIndex , count ) ;
return await GetAll < Jellyfin Movie> ( "Movie" , apiKey , userId , baseUri , true , startIndex , count ) ;
}
public async Task < EmbyItemContainer< Emby Episodes> > GetAllEpisodes ( string apiKey , int startIndex , int count , string userId , string baseUri )
public async Task < JellyfinItemContainer< Jellyfin Episodes> > GetAllEpisodes ( string apiKey , int startIndex , int count , string userId , string baseUri )
{
return await GetAll < Emby Episodes> ( "Episode" , apiKey , userId , baseUri , false , startIndex , count ) ;
return await GetAll < Jellyfin Episodes> ( "Episode" , apiKey , userId , baseUri , false , startIndex , count ) ;
}
public async Task < EmbyItemContainer< Emby Series> > GetAllShows ( string apiKey , int startIndex , int count , string userId , string baseUri )
public async Task < JellyfinItemContainer< Jellyfin Series> > GetAllShows ( string apiKey , int startIndex , int count , string userId , string baseUri )
{
return await GetAll < Emby Series> ( "Series" , apiKey , userId , baseUri , false , startIndex , count ) ;
return await GetAll < Jellyfin Series> ( "Series" , apiKey , userId , baseUri , false , startIndex , count ) ;
}
public async Task < SeriesInformation > GetSeriesInformation ( string mediaId , string apiKey , string userId , string baseUrl )
@ -126,7 +126,7 @@ namespace Ombi.Api.Emby
return JsonConvert . DeserializeObject < T > ( response ) ;
}
private async Task < Emby ItemContainer< T > > GetAll < T > ( string type , string apiKey , string userId , string baseUri , bool includeOverview = false )
private async Task < Jellyfin ItemContainer< T > > GetAll < T > ( string type , string apiKey , string userId , string baseUri , bool includeOverview = false )
{
var request = new Request ( $"users/{userId}/items" , baseUri , HttpMethod . Get ) ;
@ -139,10 +139,10 @@ namespace Ombi.Api.Emby
AddHeaders ( request , apiKey ) ;
var obj = await Api . Request < Emby ItemContainer< T > > ( request ) ;
var obj = await Api . Request < Jellyfin ItemContainer< T > > ( request ) ;
return obj ;
}
private async Task < Emby ItemContainer< T > > GetAll < T > ( string type , string apiKey , string userId , string baseUri , bool includeOverview , int startIndex , int count )
private async Task < Jellyfin ItemContainer< T > > GetAll < T > ( string type , string apiKey , string userId , string baseUri , bool includeOverview , int startIndex , int count )
{
var request = new Request ( $"users/{userId}/items" , baseUri , HttpMethod . Get ) ;
@ -157,7 +157,7 @@ namespace Ombi.Api.Emby
AddHeaders ( request , apiKey ) ;
var obj = await Api . Request < Emby ItemContainer< T > > ( request ) ;
var obj = await Api . Request < Jellyfin ItemContainer< T > > ( request ) ;
return obj ;
}
@ -172,7 +172,7 @@ namespace Ombi.Api.Emby
req . AddHeader ( "Device" , "Ombi" ) ;
}
public Task < Emby ConnectUser> LoginConnectUser ( string username , string password )
public Task < Jellyfin ConnectUser> LoginConnectUser ( string username , string password )
{
throw new System . NotImplementedException ( ) ;
}