|
|
@ -3,7 +3,7 @@ using System.Linq;
|
|
|
|
using System.Security.Principal;
|
|
|
|
using System.Security.Principal;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using AutoMapper;
|
|
|
|
using AutoMapper;
|
|
|
|
//using Ombi.Api.Trakt;
|
|
|
|
using Ombi.Api.Trakt;
|
|
|
|
using Ombi.Api.TvMaze;
|
|
|
|
using Ombi.Api.TvMaze;
|
|
|
|
using Ombi.Core.Models.Requests;
|
|
|
|
using Ombi.Core.Models.Requests;
|
|
|
|
using Ombi.Core.Models.Search;
|
|
|
|
using Ombi.Core.Models.Search;
|
|
|
@ -18,21 +18,21 @@ namespace Ombi.Core.Engine
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
public TvSearchEngine(IPrincipal identity, IRequestServiceMain service, ITvMazeApi tvMaze, IMapper mapper, ISettingsService<PlexSettings> plexSettings,
|
|
|
|
public TvSearchEngine(IPrincipal identity, IRequestServiceMain service, ITvMazeApi tvMaze, IMapper mapper, ISettingsService<PlexSettings> plexSettings,
|
|
|
|
ISettingsService<EmbySettings> embySettings/*, ITraktApi trakt*/)
|
|
|
|
ISettingsService<EmbySettings> embySettings, ITraktApi trakt)
|
|
|
|
: base(identity, service)
|
|
|
|
: base(identity, service)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TvMazeApi = tvMaze;
|
|
|
|
TvMazeApi = tvMaze;
|
|
|
|
Mapper = mapper;
|
|
|
|
Mapper = mapper;
|
|
|
|
PlexSettings = plexSettings;
|
|
|
|
PlexSettings = plexSettings;
|
|
|
|
EmbySettings = embySettings;
|
|
|
|
EmbySettings = embySettings;
|
|
|
|
//TraktApi = trakt;
|
|
|
|
TraktApi = trakt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private ITvMazeApi TvMazeApi { get; }
|
|
|
|
private ITvMazeApi TvMazeApi { get; }
|
|
|
|
private IMapper Mapper { get; }
|
|
|
|
private IMapper Mapper { get; }
|
|
|
|
private ISettingsService<PlexSettings> PlexSettings { get; }
|
|
|
|
private ISettingsService<PlexSettings> PlexSettings { get; }
|
|
|
|
private ISettingsService<EmbySettings> EmbySettings { get; }
|
|
|
|
private ISettingsService<EmbySettings> EmbySettings { get; }
|
|
|
|
//private ITraktApi TraktApi { get; }
|
|
|
|
private ITraktApi TraktApi { get; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<SearchTvShowViewModel>> Search(string searchTerm)
|
|
|
|
public async Task<IEnumerable<SearchTvShowViewModel>> Search(string searchTerm)
|
|
|
@ -46,27 +46,27 @@ namespace Ombi.Core.Engine
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//public async Task<IEnumerable<SearchTvShowViewModel>> Popular()
|
|
|
|
public async Task<IEnumerable<SearchTvShowViewModel>> Popular()
|
|
|
|
//{
|
|
|
|
{
|
|
|
|
// var result = await TraktApi.GetPopularShows();
|
|
|
|
var result = await TraktApi.GetPopularShows();
|
|
|
|
// return await ProcessResults(result);
|
|
|
|
return await ProcessResults(result);
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//public async Task<IEnumerable<SearchTvShowViewModel>> Anticipated()
|
|
|
|
public async Task<IEnumerable<SearchTvShowViewModel>> Anticipated()
|
|
|
|
//{
|
|
|
|
{
|
|
|
|
// var result = await TraktApi.GetAnticipatedShows();
|
|
|
|
var result = await TraktApi.GetAnticipatedShows();
|
|
|
|
// return await ProcessResults(result);
|
|
|
|
return await ProcessResults(result);
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
//public async Task<IEnumerable<SearchTvShowViewModel>> MostWatches()
|
|
|
|
public async Task<IEnumerable<SearchTvShowViewModel>> MostWatches()
|
|
|
|
//{
|
|
|
|
{
|
|
|
|
// var result = await TraktApi.GetMostWatchesShows();
|
|
|
|
var result = await TraktApi.GetMostWatchesShows();
|
|
|
|
// return await ProcessResults(result);
|
|
|
|
return await ProcessResults(result);
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
//public async Task<IEnumerable<SearchTvShowViewModel>> Trending()
|
|
|
|
public async Task<IEnumerable<SearchTvShowViewModel>> Trending()
|
|
|
|
//{
|
|
|
|
{
|
|
|
|
// var result = await TraktApi.GetTrendingShows();
|
|
|
|
var result = await TraktApi.GetTrendingShows();
|
|
|
|
// return await ProcessResults(result);
|
|
|
|
return await ProcessResults(result);
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private async Task<IEnumerable<SearchTvShowViewModel>> ProcessResults<T>(IEnumerable<T> items)
|
|
|
|
private async Task<IEnumerable<SearchTvShowViewModel>> ProcessResults<T>(IEnumerable<T> items)
|
|
|
|
{
|
|
|
|
{
|
|
|
|