mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
Added the TraktApi back
This commit is contained in:
parent
179280a282
commit
e0d5b03c7a
10 changed files with 127 additions and 109 deletions
BIN
Ombi/Assemblies/TraktApiSharp.dll
Normal file
BIN
Ombi/Assemblies/TraktApiSharp.dll
Normal file
Binary file not shown.
|
@ -1,16 +1,16 @@
|
||||||
//using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
//using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
//using TraktApiSharp.Enums;
|
using TraktApiSharp.Enums;
|
||||||
//using TraktApiSharp.Objects.Get.Shows;
|
using TraktApiSharp.Objects.Get.Shows;
|
||||||
//using TraktApiSharp.Objects.Get.Shows.Common;
|
using TraktApiSharp.Objects.Get.Shows.Common;
|
||||||
|
|
||||||
//namespace Ombi.Api.Trakt
|
namespace Ombi.Api.Trakt
|
||||||
//{
|
{
|
||||||
// public interface ITraktApi
|
public interface ITraktApi
|
||||||
// {
|
{
|
||||||
// Task<IEnumerable<TraktMostAnticipatedShow>> GetAnticipatedShows(int? page = default(int?), int? limitPerPage = default(int?));
|
Task<IEnumerable<TraktMostAnticipatedShow>> GetAnticipatedShows(int? page = default(int?), int? limitPerPage = default(int?));
|
||||||
// Task<IEnumerable<TraktMostWatchedShow>> GetMostWatchesShows(TraktTimePeriod period = null, int? page = default(int?), int? limitPerPage = default(int?));
|
Task<IEnumerable<TraktMostWatchedShow>> GetMostWatchesShows(TraktTimePeriod period = null, int? page = default(int?), int? limitPerPage = default(int?));
|
||||||
// Task<IEnumerable<TraktShow>> GetPopularShows(int? page = default(int?), int? limitPerPage = default(int?));
|
Task<IEnumerable<TraktShow>> GetPopularShows(int? page = default(int?), int? limitPerPage = default(int?));
|
||||||
// Task<IEnumerable<TraktTrendingShow>> GetTrendingShows(int? page = default(int?), int? limitPerPage = default(int?));
|
Task<IEnumerable<TraktTrendingShow>> GetTrendingShows(int? page = default(int?), int? limitPerPage = default(int?));
|
||||||
// }
|
}
|
||||||
//}
|
}
|
|
@ -9,4 +9,10 @@
|
||||||
<ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj" />
|
<ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="TraktApiSharp">
|
||||||
|
<HintPath>..\Assemblies\TraktApiSharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
|
@ -1,49 +1,49 @@
|
||||||
//using System;
|
using System;
|
||||||
//using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
//using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
//using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
//using TraktApiSharp;
|
using TraktApiSharp;
|
||||||
//using TraktApiSharp.Enums;
|
using TraktApiSharp.Enums;
|
||||||
//using TraktApiSharp.Objects.Get.Shows;
|
using TraktApiSharp.Objects.Get.Shows;
|
||||||
//using TraktApiSharp.Objects.Get.Shows.Common;
|
using TraktApiSharp.Objects.Get.Shows.Common;
|
||||||
//using TraktApiSharp.Requests.Parameters;
|
using TraktApiSharp.Requests.Parameters;
|
||||||
|
|
||||||
//namespace Ombi.Api.Trakt
|
namespace Ombi.Api.Trakt
|
||||||
//{
|
{
|
||||||
// public class TraktApi : ITraktApi
|
public class TraktApi : ITraktApi
|
||||||
// {
|
{
|
||||||
// private TraktClient Client { get; }
|
private TraktClient Client { get; }
|
||||||
|
|
||||||
// private static readonly string Encrypted = "MTM0ZTU2ODM1MGY3NDI3NTExZTI1N2E2NTM0MDI2NjYwNDgwY2Y5YjkzYzc3ZjczNzhmMzQwNjAzYjY3MzgxZA==";
|
private static readonly string Encrypted = "MTM0ZTU2ODM1MGY3NDI3NTExZTI1N2E2NTM0MDI2NjYwNDgwY2Y5YjkzYzc3ZjczNzhmMzQwNjAzYjY3MzgxZA==";
|
||||||
// private readonly string _apiKey = StringCipher.DecryptString(Encrypted, "ApiKey");
|
private readonly string _apiKey = StringCipher.DecryptString(Encrypted, "ApiKey");
|
||||||
// public TraktApi()
|
public TraktApi()
|
||||||
// {
|
{
|
||||||
// Client = new TraktClient(_apiKey);
|
Client = new TraktClient(_apiKey);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// public async Task<IEnumerable<TraktShow>> GetPopularShows(int? page = null, int? limitPerPage = null)
|
public async Task<IEnumerable<TraktShow>> GetPopularShows(int? page = null, int? limitPerPage = null)
|
||||||
// {
|
{
|
||||||
// var popular = await Client.Shows.GetPopularShowsAsync(new TraktExtendedInfo { Full = true }, null, page ?? 1, limitPerPage ?? 10);
|
var popular = await Client.Shows.GetPopularShowsAsync(new TraktExtendedInfo { Full = true }, null, page ?? 1, limitPerPage ?? 10);
|
||||||
// return popular.Value;
|
return popular.Value;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// public async Task<IEnumerable<TraktTrendingShow>> GetTrendingShows(int? page = null, int? limitPerPage = null)
|
public async Task<IEnumerable<TraktTrendingShow>> GetTrendingShows(int? page = null, int? limitPerPage = null)
|
||||||
// {
|
{
|
||||||
// var trendingShowsTop10 = await Client.Shows.GetTrendingShowsAsync(new TraktExtendedInfo { Full = true }, null, page ?? 1, limitPerPage ?? 10);
|
var trendingShowsTop10 = await Client.Shows.GetTrendingShowsAsync(new TraktExtendedInfo { Full = true }, null, page ?? 1, limitPerPage ?? 10);
|
||||||
// return trendingShowsTop10.Value;
|
return trendingShowsTop10.Value;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// public async Task<IEnumerable<TraktMostAnticipatedShow>> GetAnticipatedShows(int? page = null, int? limitPerPage = null)
|
public async Task<IEnumerable<TraktMostAnticipatedShow>> GetAnticipatedShows(int? page = null, int? limitPerPage = null)
|
||||||
// {
|
{
|
||||||
// var anticipatedShows = await Client.Shows.GetMostAnticipatedShowsAsync(new TraktExtendedInfo { Full = true }, null, page ?? 1, limitPerPage ?? 10);
|
var anticipatedShows = await Client.Shows.GetMostAnticipatedShowsAsync(new TraktExtendedInfo { Full = true }, null, page ?? 1, limitPerPage ?? 10);
|
||||||
// return anticipatedShows.Value;
|
return anticipatedShows.Value;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// public async Task<IEnumerable<TraktMostWatchedShow>> GetMostWatchesShows(TraktTimePeriod period = null, int? page = null, int? limitPerPage = null)
|
public async Task<IEnumerable<TraktMostWatchedShow>> GetMostWatchesShows(TraktTimePeriod period = null, int? page = null, int? limitPerPage = null)
|
||||||
// {
|
{
|
||||||
// var anticipatedShows = await Client.Shows.GetMostWatchedShowsAsync(period ?? TraktTimePeriod.Monthly, new TraktExtendedInfo { Full = true }, null, page ?? 1, limitPerPage ?? 10);
|
var anticipatedShows = await Client.Shows.GetMostWatchedShowsAsync(period ?? TraktTimePeriod.Monthly, new TraktExtendedInfo { Full = true }, null, page ?? 1, limitPerPage ?? 10);
|
||||||
// return anticipatedShows.Value;
|
return anticipatedShows.Value;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,9 @@ namespace Ombi.Core.Engine
|
||||||
public interface ITvSearchEngine
|
public interface ITvSearchEngine
|
||||||
{
|
{
|
||||||
Task<IEnumerable<SearchTvShowViewModel>> Search(string searchTerm);
|
Task<IEnumerable<SearchTvShowViewModel>> Search(string searchTerm);
|
||||||
//Task<IEnumerable<SearchTvShowViewModel>> Popular();
|
Task<IEnumerable<SearchTvShowViewModel>> Popular();
|
||||||
//Task<IEnumerable<SearchTvShowViewModel>> Anticipated();
|
Task<IEnumerable<SearchTvShowViewModel>> Anticipated();
|
||||||
//Task<IEnumerable<SearchTvShowViewModel>> MostWatches();
|
Task<IEnumerable<SearchTvShowViewModel>> MostWatches();
|
||||||
//Task<IEnumerable<SearchTvShowViewModel>> Trending();
|
Task<IEnumerable<SearchTvShowViewModel>> Trending();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,4 +26,10 @@
|
||||||
<ProjectReference Include="..\Ombi.TheMovieDbApi\Ombi.Api.TheMovieDb.csproj" />
|
<ProjectReference Include="..\Ombi.TheMovieDbApi\Ombi.Api.TheMovieDb.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="TraktApiSharp">
|
||||||
|
<HintPath>..\Assemblies\TraktApiSharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
|
@ -65,25 +65,25 @@ namespace Ombi.Controllers
|
||||||
return await TvEngine.Search(searchTerm);
|
return await TvEngine.Search(searchTerm);
|
||||||
}
|
}
|
||||||
|
|
||||||
//[HttpGet("tv/popular")]
|
[HttpGet("tv/popular")]
|
||||||
//public async Task<IEnumerable<SearchTvShowViewModel>> PopularTv()
|
public async Task<IEnumerable<SearchTvShowViewModel>> PopularTv()
|
||||||
//{
|
{
|
||||||
// return await TvEngine.Popular();
|
return await TvEngine.Popular();
|
||||||
//}
|
}
|
||||||
//[HttpGet("tv/anticiplated")]
|
[HttpGet("tv/anticiplated")]
|
||||||
//public async Task<IEnumerable<SearchTvShowViewModel>> AnticiplatedTv()
|
public async Task<IEnumerable<SearchTvShowViewModel>> AnticiplatedTv()
|
||||||
//{
|
{
|
||||||
// return await TvEngine.Anticipated();
|
return await TvEngine.Anticipated();
|
||||||
//}
|
}
|
||||||
//[HttpGet("tv/mostwatched")]
|
[HttpGet("tv/mostwatched")]
|
||||||
//public async Task<IEnumerable<SearchTvShowViewModel>> MostWatched()
|
public async Task<IEnumerable<SearchTvShowViewModel>> MostWatched()
|
||||||
//{
|
{
|
||||||
// return await TvEngine.MostWatches();
|
return await TvEngine.MostWatches();
|
||||||
//}
|
}
|
||||||
//[HttpGet("tv/trending")]
|
[HttpGet("tv/trending")]
|
||||||
//public async Task<IEnumerable<SearchTvShowViewModel>> Trending()
|
public async Task<IEnumerable<SearchTvShowViewModel>> Trending()
|
||||||
//{
|
{
|
||||||
// return await TvEngine.Trending();
|
return await TvEngine.Trending();
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,12 @@
|
||||||
<ProjectReference Include="..\Ombi.TheMovieDbApi\Ombi.Api.TheMovieDb.csproj" />
|
<ProjectReference Include="..\Ombi.TheMovieDbApi\Ombi.Api.TheMovieDb.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="TraktApiSharp">
|
||||||
|
<HintPath>..\Assemblies\TraktApiSharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Update="wwwroot\app\interfaces\ISearchMovieResult - Copy.js">
|
<Content Update="wwwroot\app\interfaces\ISearchMovieResult - Copy.js">
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
|
|
@ -59,10 +59,10 @@ namespace Ombi
|
||||||
// Add framework services.
|
// Add framework services.
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
services.AddOmbiMappingProfile();
|
services.AddOmbiMappingProfile();
|
||||||
services.AddAutoMapper(expression =>
|
//services.AddAutoMapper(expression =>
|
||||||
{
|
//{
|
||||||
expression.AddCollectionMappers();
|
// expression.AddCollectionMappers();
|
||||||
});
|
//});
|
||||||
services.RegisterDependencies(); // Ioc and EF
|
services.RegisterDependencies(); // Ioc and EF
|
||||||
|
|
||||||
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue