mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-07 13:41:13 -07:00
stuff
This commit is contained in:
parent
39cac898c6
commit
fc3ed1105d
26 changed files with 294 additions and 166 deletions
|
@ -1,16 +1,16 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
//using TraktApiSharp.Enums;
|
||||
//using TraktApiSharp.Objects.Get.Shows;
|
||||
//using TraktApiSharp.Objects.Get.Shows.Common;
|
||||
using TraktApiSharp.Enums;
|
||||
using TraktApiSharp.Objects.Get.Shows;
|
||||
using TraktApiSharp.Objects.Get.Shows.Common;
|
||||
|
||||
namespace Ombi.Api.Trakt
|
||||
{
|
||||
public interface ITraktApi
|
||||
{
|
||||
//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<TraktShow>> GetPopularShows(int? page = default(int?), int? limitPerPage = default(int?));
|
||||
//Task<IEnumerable<TraktTrendingShow>> GetTrendingShows(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<TraktShow>> GetPopularShows(int? page = default(int?), int? limitPerPage = default(int?));
|
||||
Task<IEnumerable<TraktTrendingShow>> GetTrendingShows(int? page = default(int?), int? limitPerPage = default(int?));
|
||||
}
|
||||
}
|
|
@ -4,6 +4,10 @@
|
|||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TraktApiSharp" Version="1.0.0-alpha1-fixed-issue59" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ombi.Api\Ombi.Api.csproj" />
|
||||
<ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj" />
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Threading.Tasks;
|
||||
//using Ombi.Helpers;
|
||||
//using TraktApiSharp;
|
||||
//using TraktApiSharp.Enums;
|
||||
//using TraktApiSharp.Objects.Get.Shows;
|
||||
//using TraktApiSharp.Objects.Get.Shows.Common;
|
||||
//using TraktApiSharp.Requests.Parameters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Ombi.Helpers;
|
||||
using TraktApiSharp;
|
||||
using TraktApiSharp.Enums;
|
||||
using TraktApiSharp.Objects.Get.Shows;
|
||||
using TraktApiSharp.Objects.Get.Shows.Common;
|
||||
using TraktApiSharp.Requests.Parameters;
|
||||
|
||||
//namespace Ombi.Api.Trakt
|
||||
//{
|
||||
// public class TraktApi : ITraktApi
|
||||
// {
|
||||
// private TraktClient Client { get; }
|
||||
namespace Ombi.Api.Trakt
|
||||
{
|
||||
public class TraktApi : ITraktApi
|
||||
{
|
||||
private TraktClient Client { get; }
|
||||
|
||||
// private static readonly string Encrypted = "MTM0ZTU2ODM1MGY3NDI3NTExZTI1N2E2NTM0MDI2NjYwNDgwY2Y5YjkzYzc3ZjczNzhmMzQwNjAzYjY3MzgxZA==";
|
||||
// private readonly string _apiKey = StringCipher.DecryptString(Encrypted, "ApiKey");
|
||||
// public TraktApi()
|
||||
// {
|
||||
// Client = new TraktClient(_apiKey);
|
||||
// }
|
||||
private static readonly string Encrypted = "MTM0ZTU2ODM1MGY3NDI3NTExZTI1N2E2NTM0MDI2NjYwNDgwY2Y5YjkzYzc3ZjczNzhmMzQwNjAzYjY3MzgxZA==";
|
||||
private readonly string _apiKey = StringCipher.DecryptString(Encrypted, "ApiKey");
|
||||
public TraktApi()
|
||||
{
|
||||
Client = new TraktClient(_apiKey);
|
||||
}
|
||||
|
||||
// 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);
|
||||
// return popular.Value;
|
||||
// }
|
||||
public async Task<IEnumerable<TraktShow>> GetPopularShows(int? page = null, int? limitPerPage = null)
|
||||
{
|
||||
var popular = await Client.Shows.GetPopularShowsAsync(new TraktExtendedInfo { Full = true, Images = true}, null, page ?? 1, limitPerPage ?? 10);
|
||||
return popular.Value;
|
||||
}
|
||||
|
||||
// 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);
|
||||
// return trendingShowsTop10.Value;
|
||||
// }
|
||||
public async Task<IEnumerable<TraktTrendingShow>> GetTrendingShows(int? page = null, int? limitPerPage = null)
|
||||
{
|
||||
var trendingShowsTop10 = await Client.Shows.GetTrendingShowsAsync(new TraktExtendedInfo { Full = true, Images = true }, null, page ?? 1, limitPerPage ?? 10);
|
||||
return trendingShowsTop10.Value;
|
||||
}
|
||||
|
||||
// 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);
|
||||
// return anticipatedShows.Value;
|
||||
// }
|
||||
public async Task<IEnumerable<TraktMostAnticipatedShow>> GetAnticipatedShows(int? page = null, int? limitPerPage = null)
|
||||
{
|
||||
var anticipatedShows = await Client.Shows.GetMostAnticipatedShowsAsync(new TraktExtendedInfo { Full = true, Images = true }, null, page ?? 1, limitPerPage ?? 10);
|
||||
return anticipatedShows.Value;
|
||||
}
|
||||
|
||||
// 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);
|
||||
// return anticipatedShows.Value;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
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, Images = true }, null, page ?? 1, limitPerPage ?? 10);
|
||||
return anticipatedShows.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,5 +52,26 @@ namespace Ombi.Core.Engine
|
|||
}
|
||||
return _dbTv;
|
||||
}
|
||||
|
||||
public RequestCountModel RequestCount()
|
||||
{
|
||||
var movieQuery = MovieRequestService.GetAllQueryable();
|
||||
var tvQuery = MovieRequestService.GetAllQueryable();
|
||||
|
||||
var pendingMovies = movieQuery.Count(x => !x.Approved && !x.Available);
|
||||
var approvedMovies = movieQuery.Count(x => x.Approved && !x.Available);
|
||||
var availableMovies = movieQuery.Count(x => x.Available);
|
||||
|
||||
var pendingTv = tvQuery.Count(x => !x.Approved && !x.Available);
|
||||
var approvedTv = tvQuery.Count(x => x.Approved && !x.Available);
|
||||
var availableTv = tvQuery.Count(x => x.Available);
|
||||
|
||||
return new RequestCountModel
|
||||
{
|
||||
Approved = approvedTv + approvedMovies,
|
||||
Available = availableTv + availableMovies,
|
||||
Pending = pendingMovies + pendingTv
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,5 +14,6 @@ namespace Ombi.Core.Engine
|
|||
Task<IEnumerable<MovieRequestModel>> SearchMovieRequest(string search);
|
||||
Task RemoveMovieRequest(int requestId);
|
||||
Task<MovieRequestModel> UpdateMovieRequest(MovieRequestModel request);
|
||||
RequestCountModel RequestCount();
|
||||
}
|
||||
}
|
|
@ -12,5 +12,6 @@ namespace Ombi.Core.Engine
|
|||
Task<RequestEngineResult> RequestTvShow(SearchTvShowViewModel tv);
|
||||
Task<IEnumerable<TvRequestModel>> SearchTvRequest(string search);
|
||||
Task<TvRequestModel> UpdateTvRequest(TvRequestModel request);
|
||||
RequestCountModel RequestCount();
|
||||
}
|
||||
}
|
|
@ -9,9 +9,10 @@ namespace Ombi.Core.Engine.Interfaces
|
|||
Task<IEnumerable<SearchTvShowViewModel>> Search(string searchTerm);
|
||||
|
||||
Task<SearchTvShowViewModel> GetShowInformation(int tvdbId);
|
||||
//Task<IEnumerable<SearchTvShowViewModel>> Popular();
|
||||
//Task<IEnumerable<SearchTvShowViewModel>> Anticipated();
|
||||
//Task<IEnumerable<SearchTvShowViewModel>> MostWatches();
|
||||
//Task<IEnumerable<SearchTvShowViewModel>> Trending();
|
||||
Task<IEnumerable<SearchTvShowViewModel>> Popular();
|
||||
Task<IEnumerable<SearchTvShowViewModel>> Anticipated();
|
||||
Task<IEnumerable<SearchTvShowViewModel>> MostWatches();
|
||||
Task<IEnumerable<SearchTvShowViewModel>> Trending();
|
||||
|
||||
}
|
||||
}
|
|
@ -22,7 +22,7 @@ namespace Ombi.Core.Engine
|
|||
{
|
||||
|
||||
public TvSearchEngine(IPrincipal identity, IRequestServiceMain service, ITvMazeApi tvMaze, IMapper mapper, ISettingsService<PlexSettings> plexSettings,
|
||||
ISettingsService<EmbySettings> embySettings, IPlexContentRepository repo)
|
||||
ISettingsService<EmbySettings> embySettings, IPlexContentRepository repo, ITraktApi trakt)
|
||||
: base(identity, service)
|
||||
{
|
||||
TvMazeApi = tvMaze;
|
||||
|
@ -30,7 +30,7 @@ namespace Ombi.Core.Engine
|
|||
PlexSettings = plexSettings;
|
||||
EmbySettings = embySettings;
|
||||
PlexContentRepo = repo;
|
||||
//TraktApi = trakt;
|
||||
TraktApi = trakt;
|
||||
}
|
||||
|
||||
private ITvMazeApi TvMazeApi { get; }
|
||||
|
@ -38,7 +38,7 @@ namespace Ombi.Core.Engine
|
|||
private ISettingsService<PlexSettings> PlexSettings { get; }
|
||||
private ISettingsService<EmbySettings> EmbySettings { get; }
|
||||
private IPlexContentRepository PlexContentRepo { get; }
|
||||
//private ITraktApi TraktApi { get; }
|
||||
private ITraktApi TraktApi { get; }
|
||||
|
||||
|
||||
public async Task<IEnumerable<SearchTvShowViewModel>> Search(string searchTerm)
|
||||
|
@ -97,27 +97,27 @@ namespace Ombi.Core.Engine
|
|||
return await ProcessResult(mapped, existingRequests, plexSettings, embySettings);
|
||||
}
|
||||
|
||||
//public async Task<IEnumerable<SearchTvShowViewModel>> Popular()
|
||||
//{
|
||||
// var result = await TraktApi.GetPopularShows();
|
||||
// return await ProcessResults(result);
|
||||
//}
|
||||
public async Task<IEnumerable<SearchTvShowViewModel>> Popular()
|
||||
{
|
||||
var result = await TraktApi.GetPopularShows();
|
||||
return await ProcessResults(result);
|
||||
}
|
||||
|
||||
//public async Task<IEnumerable<SearchTvShowViewModel>> Anticipated()
|
||||
//{
|
||||
// var result = await TraktApi.GetAnticipatedShows();
|
||||
// return await ProcessResults(result);
|
||||
//}
|
||||
//public async Task<IEnumerable<SearchTvShowViewModel>> MostWatches()
|
||||
//{
|
||||
// var result = await TraktApi.GetMostWatchesShows();
|
||||
// return await ProcessResults(result);
|
||||
//}
|
||||
//public async Task<IEnumerable<SearchTvShowViewModel>> Trending()
|
||||
//{
|
||||
// var result = await TraktApi.GetTrendingShows();
|
||||
// return await ProcessResults(result);
|
||||
//}
|
||||
public async Task<IEnumerable<SearchTvShowViewModel>> Anticipated()
|
||||
{
|
||||
var result = await TraktApi.GetAnticipatedShows();
|
||||
return await ProcessResults(result);
|
||||
}
|
||||
public async Task<IEnumerable<SearchTvShowViewModel>> MostWatches()
|
||||
{
|
||||
var result = await TraktApi.GetMostWatchesShows();
|
||||
return await ProcessResults(result);
|
||||
}
|
||||
public async Task<IEnumerable<SearchTvShowViewModel>> Trending()
|
||||
{
|
||||
var result = await TraktApi.GetTrendingShows();
|
||||
return await ProcessResults(result);
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<SearchTvShowViewModel>> ProcessResults<T>(IEnumerable<T> items)
|
||||
{
|
||||
|
@ -154,13 +154,6 @@ namespace Ombi.Core.Engine
|
|||
item.Available = true;
|
||||
item.PlexUrl = content.Url;
|
||||
}
|
||||
//var plexShow = PlexChecker.GetTvShow(plexTvShows.ToArray(), t.show.name, t.show.premiered?.Substring(0, 4),
|
||||
// providerId);
|
||||
//if (plexShow != null)
|
||||
//{
|
||||
// viewT.Available = true;
|
||||
// viewT.PlexUrl = plexShow.Url;
|
||||
//}
|
||||
}
|
||||
|
||||
if (item.Id > 0 && item.Available)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Ombi.Core.Models.Requests;
|
||||
using Ombi.Store.Entities;
|
||||
|
@ -22,5 +23,6 @@ namespace Ombi.Core.Requests.Models
|
|||
Task<IEnumerable<T>> GetAllAsync(int count, int position);
|
||||
Task<T> GetAsync(int id);
|
||||
T UpdateRequest(T model);
|
||||
IQueryable<T> GetAllQueryable();
|
||||
}
|
||||
}
|
|
@ -128,6 +128,23 @@ namespace Ombi.Core.Models.Requests
|
|||
return retVal;
|
||||
}
|
||||
|
||||
public IQueryable<T> GetAllQueryable()
|
||||
{
|
||||
var retVal = new List<T>();
|
||||
var blobs = Repo.GetAllQueryable();
|
||||
foreach (var b in blobs)
|
||||
{
|
||||
if (b == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var model = ByteConverterHelper.ReturnObject<T>(b.Content);
|
||||
model.Id = b.Id;
|
||||
retVal.Add(model);
|
||||
}
|
||||
return retVal.AsQueryable();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<T>> GetAllAsync()
|
||||
{
|
||||
var blobs = await Repo.GetAllAsync().ConfigureAwait(false);
|
||||
|
|
9
src/Ombi.Core/Models/Requests/RequestCountModel.cs
Normal file
9
src/Ombi.Core/Models/Requests/RequestCountModel.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
namespace Ombi.Core.Models.Requests
|
||||
{
|
||||
public class RequestCountModel
|
||||
{
|
||||
public int Pending { get; set; }
|
||||
public int Approved { get; set; }
|
||||
public int Available { get; set; }
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ using Ombi.Api.Emby;
|
|||
using Ombi.Api.Plex;
|
||||
using Ombi.Api.Sonarr;
|
||||
using Ombi.Api.TheMovieDb;
|
||||
using Ombi.Api.Trakt;
|
||||
using Ombi.Api.TvMaze;
|
||||
using Ombi.Core;
|
||||
using Ombi.Core.Engine;
|
||||
|
@ -51,6 +52,7 @@ namespace Ombi.DependencyInjection
|
|||
services.AddTransient<IEmbyApi, EmbyApi>();
|
||||
services.AddTransient<ISonarrApi, SonarrApi>();
|
||||
services.AddTransient<ITvMazeApi, TvMazeApi>();
|
||||
services.AddTransient<ITraktApi, TraktApi>();
|
||||
}
|
||||
|
||||
public static void RegisterStore(this IServiceCollection services)
|
||||
|
|
|
@ -5,6 +5,9 @@ using Ombi.Api.TvMaze.Models;
|
|||
using Ombi.Core.Models.Requests;
|
||||
using Ombi.Core.Models.Search;
|
||||
using Ombi.Helpers;
|
||||
using TraktApiSharp.Objects.Get.Shows;
|
||||
using TraktApiSharp.Objects.Get.Shows.Common;
|
||||
|
||||
//using TraktApiSharp.Objects.Get.Shows;
|
||||
//using TraktApiSharp.Objects.Get.Shows.Common;
|
||||
|
||||
|
@ -43,57 +46,58 @@ namespace Ombi.Mapping.Profiles
|
|||
.ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.status))
|
||||
.ForMember(dest => dest.SeasonRequests, opts => opts.MapFrom(src => src.Season));
|
||||
|
||||
//CreateMap<TraktShow, SearchTvShowViewModel>()
|
||||
// .ForMember(dest => dest.Id, opts => opts.MapFrom(src => Convert.ToInt32(src.Ids.Tvdb.ToString())))
|
||||
// .ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.FirstAired.HasValue ? src.FirstAired.Value.ToString("yyyy-MM-ddTHH:mm:ss") : string.Empty))
|
||||
// .ForMember(dest => dest.ImdbId, opts => opts.MapFrom(src => src.Ids.Imdb))
|
||||
// .ForMember(dest => dest.Network, opts => opts.MapFrom(src => src.Network))
|
||||
// .ForMember(dest => dest.Overview, opts => opts.MapFrom(src => src.Overview.RemoveHtml()))
|
||||
// .ForMember(dest => dest.Rating, opts => opts.MapFrom(src => src.Rating.ToString()))
|
||||
// .ForMember(dest => dest.Runtime, opts => opts.MapFrom(src => src.Runtime.ToString()))
|
||||
// .ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.Title))
|
||||
// .ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.Status.DisplayName))
|
||||
// .ForMember(dest => dest.Trailer, opts => opts.MapFrom(src => src.Trailer))
|
||||
// .ForMember(dest => dest.Homepage, opts => opts.MapFrom(src => src.Homepage));
|
||||
CreateMap<TraktShow, SearchTvShowViewModel>()
|
||||
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => Convert.ToInt32(src.Ids.Tvdb.ToString())))
|
||||
.ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.FirstAired.HasValue ? src.FirstAired.Value.ToString("yyyy-MM-ddTHH:mm:ss") : string.Empty))
|
||||
.ForMember(dest => dest.Banner, opts => opts.MapFrom(src => src.Ids.Imdb))
|
||||
.ForMember(dest => dest.ImdbId, opts => opts.MapFrom(src => src.Ids.Imdb))
|
||||
.ForMember(dest => dest.Network, opts => opts.MapFrom(src => src.Network))
|
||||
.ForMember(dest => dest.Overview, opts => opts.MapFrom(src => src.Overview.RemoveHtml()))
|
||||
.ForMember(dest => dest.Rating, opts => opts.MapFrom(src => src.Rating.ToString()))
|
||||
.ForMember(dest => dest.Runtime, opts => opts.MapFrom(src => src.Runtime.ToString()))
|
||||
.ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.Title))
|
||||
.ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.Status.DisplayName))
|
||||
.ForMember(dest => dest.Trailer, opts => opts.MapFrom(src => src.Trailer))
|
||||
.ForMember(dest => dest.Homepage, opts => opts.MapFrom(src => src.Homepage));
|
||||
|
||||
//CreateMap<TraktTrendingShow, SearchTvShowViewModel>()
|
||||
// .ForMember(dest => dest.Id, opts => opts.MapFrom(src => Convert.ToInt32(src.Show.Ids.Tvdb.ToString())))
|
||||
// .ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.Show.FirstAired.HasValue ? src.Show.FirstAired.Value.ToString("yyyy-MM-ddTHH:mm:ss") : string.Empty))
|
||||
// .ForMember(dest => dest.ImdbId, opts => opts.MapFrom(src => src.Show.Ids.Imdb))
|
||||
// .ForMember(dest => dest.Network, opts => opts.MapFrom(src => src.Show.Network))
|
||||
// .ForMember(dest => dest.Overview, opts => opts.MapFrom(src => src.Show.Overview.RemoveHtml()))
|
||||
// .ForMember(dest => dest.Rating, opts => opts.MapFrom(src => src.Show.Rating.ToString()))
|
||||
// .ForMember(dest => dest.Runtime, opts => opts.MapFrom(src => src.Show.Runtime.ToString()))
|
||||
// .ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.Show.Title))
|
||||
// .ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.Show.Status.DisplayName))
|
||||
// .ForMember(dest => dest.Trailer, opts => opts.MapFrom(src => src.Show.Trailer))
|
||||
// .ForMember(dest => dest.Homepage, opts => opts.MapFrom(src => src.Show.Homepage));
|
||||
CreateMap<TraktTrendingShow, SearchTvShowViewModel>()
|
||||
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => Convert.ToInt32(src.Show.Ids.Tvdb.ToString())))
|
||||
.ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.Show.FirstAired.HasValue ? src.Show.FirstAired.Value.ToString("yyyy-MM-ddTHH:mm:ss") : string.Empty))
|
||||
.ForMember(dest => dest.ImdbId, opts => opts.MapFrom(src => src.Show.Ids.Imdb))
|
||||
.ForMember(dest => dest.Network, opts => opts.MapFrom(src => src.Show.Network))
|
||||
.ForMember(dest => dest.Overview, opts => opts.MapFrom(src => src.Show.Overview.RemoveHtml()))
|
||||
.ForMember(dest => dest.Rating, opts => opts.MapFrom(src => src.Show.Rating.ToString()))
|
||||
.ForMember(dest => dest.Runtime, opts => opts.MapFrom(src => src.Show.Runtime.ToString()))
|
||||
.ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.Show.Title))
|
||||
.ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.Show.Status.DisplayName))
|
||||
.ForMember(dest => dest.Trailer, opts => opts.MapFrom(src => src.Show.Trailer))
|
||||
.ForMember(dest => dest.Homepage, opts => opts.MapFrom(src => src.Show.Homepage));
|
||||
|
||||
//CreateMap<TraktMostAnticipatedShow, SearchTvShowViewModel>()
|
||||
// .ForMember(dest => dest.Id, opts => opts.MapFrom(src => Convert.ToInt32(src.Show.Ids.Tvdb.ToString())))
|
||||
// .ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.Show.FirstAired.HasValue ? src.Show.FirstAired.Value.ToString("yyyy-MM-ddTHH:mm:ss") : string.Empty))
|
||||
// .ForMember(dest => dest.ImdbId, opts => opts.MapFrom(src => src.Show.Ids.Imdb))
|
||||
// .ForMember(dest => dest.Network, opts => opts.MapFrom(src => src.Show.Network))
|
||||
// .ForMember(dest => dest.Overview, opts => opts.MapFrom(src => src.Show.Overview.RemoveHtml()))
|
||||
// .ForMember(dest => dest.Rating, opts => opts.MapFrom(src => src.Show.Rating.ToString()))
|
||||
// .ForMember(dest => dest.Runtime, opts => opts.MapFrom(src => src.Show.Runtime.ToString()))
|
||||
// .ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.Show.Title))
|
||||
// .ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.Show.Status.DisplayName))
|
||||
// .ForMember(dest => dest.Trailer, opts => opts.MapFrom(src => src.Show.Trailer))
|
||||
// .ForMember(dest => dest.Homepage, opts => opts.MapFrom(src => src.Show.Homepage));
|
||||
CreateMap<TraktMostAnticipatedShow, SearchTvShowViewModel>()
|
||||
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => Convert.ToInt32(src.Show.Ids.Tvdb.ToString())))
|
||||
.ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.Show.FirstAired.HasValue ? src.Show.FirstAired.Value.ToString("yyyy-MM-ddTHH:mm:ss") : string.Empty))
|
||||
.ForMember(dest => dest.ImdbId, opts => opts.MapFrom(src => src.Show.Ids.Imdb))
|
||||
.ForMember(dest => dest.Network, opts => opts.MapFrom(src => src.Show.Network))
|
||||
.ForMember(dest => dest.Overview, opts => opts.MapFrom(src => src.Show.Overview.RemoveHtml()))
|
||||
.ForMember(dest => dest.Rating, opts => opts.MapFrom(src => src.Show.Rating.ToString()))
|
||||
.ForMember(dest => dest.Runtime, opts => opts.MapFrom(src => src.Show.Runtime.ToString()))
|
||||
.ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.Show.Title))
|
||||
.ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.Show.Status.DisplayName))
|
||||
.ForMember(dest => dest.Trailer, opts => opts.MapFrom(src => src.Show.Trailer))
|
||||
.ForMember(dest => dest.Homepage, opts => opts.MapFrom(src => src.Show.Homepage));
|
||||
|
||||
//CreateMap<TraktMostWatchedShow, SearchTvShowViewModel>()
|
||||
// .ForMember(dest => dest.Id, opts => opts.MapFrom(src => Convert.ToInt32(src.Show.Ids.Tvdb.ToString())))
|
||||
// .ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.Show.FirstAired.HasValue ? src.Show.FirstAired.Value.ToString("yyyy-MM-ddTHH:mm:ss") : string.Empty))
|
||||
// .ForMember(dest => dest.ImdbId, opts => opts.MapFrom(src => src.Show.Ids.Imdb))
|
||||
// .ForMember(dest => dest.Network, opts => opts.MapFrom(src => src.Show.Network))
|
||||
// .ForMember(dest => dest.Overview, opts => opts.MapFrom(src => src.Show.Overview.RemoveHtml()))
|
||||
// .ForMember(dest => dest.Rating, opts => opts.MapFrom(src => src.Show.Rating.ToString()))
|
||||
// .ForMember(dest => dest.Runtime, opts => opts.MapFrom(src => src.Show.Runtime.ToString()))
|
||||
// .ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.Show.Title))
|
||||
// .ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.Show.Status.DisplayName))
|
||||
// .ForMember(dest => dest.Trailer, opts => opts.MapFrom(src => src.Show.Trailer))
|
||||
// .ForMember(dest => dest.Homepage, opts => opts.MapFrom(src => src.Show.Homepage));
|
||||
CreateMap<TraktMostWatchedShow, SearchTvShowViewModel>()
|
||||
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => Convert.ToInt32(src.Show.Ids.Tvdb.ToString())))
|
||||
.ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.Show.FirstAired.HasValue ? src.Show.FirstAired.Value.ToString("yyyy-MM-ddTHH:mm:ss") : string.Empty))
|
||||
.ForMember(dest => dest.ImdbId, opts => opts.MapFrom(src => src.Show.Ids.Imdb))
|
||||
.ForMember(dest => dest.Network, opts => opts.MapFrom(src => src.Show.Network))
|
||||
.ForMember(dest => dest.Overview, opts => opts.MapFrom(src => src.Show.Overview.RemoveHtml()))
|
||||
.ForMember(dest => dest.Rating, opts => opts.MapFrom(src => src.Show.Rating.ToString()))
|
||||
.ForMember(dest => dest.Runtime, opts => opts.MapFrom(src => src.Show.Runtime.ToString()))
|
||||
.ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.Show.Title))
|
||||
.ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.Show.Status.DisplayName))
|
||||
.ForMember(dest => dest.Trailer, opts => opts.MapFrom(src => src.Show.Trailer))
|
||||
.ForMember(dest => dest.Homepage, opts => opts.MapFrom(src => src.Show.Homepage));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Ombi.Store.Entities;
|
||||
|
||||
|
@ -17,5 +18,6 @@ namespace Ombi.Store.Repository
|
|||
Task<RequestBlobs> InsertAsync(RequestBlobs entity);
|
||||
RequestBlobs Update(RequestBlobs entity);
|
||||
void UpdateAll(IEnumerable<RequestBlobs> entity);
|
||||
IQueryable<RequestBlobs> GetAllQueryable();
|
||||
}
|
||||
}
|
|
@ -143,5 +143,10 @@ namespace Ombi.Store.Repository
|
|||
Db.SaveChanges();
|
||||
|
||||
}
|
||||
|
||||
public IQueryable<RequestBlobs> GetAllQueryable()
|
||||
{
|
||||
return Db.Requests.AsQueryable();
|
||||
}
|
||||
}
|
||||
}
|
7
src/Ombi/Config/ApplicationSettings.cs
Normal file
7
src/Ombi/Config/ApplicationSettings.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
namespace Ombi.Config
|
||||
{
|
||||
public class ApplicationSettings
|
||||
{
|
||||
public string Version { get; set; }
|
||||
}
|
||||
}
|
|
@ -58,7 +58,6 @@ namespace Ombi.Controllers
|
|||
{
|
||||
try
|
||||
{
|
||||
|
||||
return await TvRequestEngine.GetTvRequests(count, position);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -93,5 +92,13 @@ namespace Ombi.Controllers
|
|||
{
|
||||
return await TvRequestEngine.UpdateTvRequest(model);
|
||||
}
|
||||
|
||||
[HttpGet("count")]
|
||||
[AllowAnonymous]
|
||||
public RequestCountModel GetCountOfRequests()
|
||||
{
|
||||
// Doesn't matter if we use the TvEngine or MovieEngine, this method is in the base class
|
||||
return TvRequestEngine.RequestCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,25 +72,25 @@ namespace Ombi.Controllers
|
|||
return await TvEngine.GetShowInformation(tvdbId);
|
||||
}
|
||||
|
||||
//[HttpGet("tv/popular")]
|
||||
//public async Task<IEnumerable<SearchTvShowViewModel>> PopularTv()
|
||||
//{
|
||||
// return await TvEngine.Popular();
|
||||
//}
|
||||
//[HttpGet("tv/anticiplated")]
|
||||
//public async Task<IEnumerable<SearchTvShowViewModel>> AnticiplatedTv()
|
||||
//{
|
||||
// return await TvEngine.Anticipated();
|
||||
//}
|
||||
//[HttpGet("tv/mostwatched")]
|
||||
//public async Task<IEnumerable<SearchTvShowViewModel>> MostWatched()
|
||||
//{
|
||||
// return await TvEngine.MostWatches();
|
||||
//}
|
||||
//[HttpGet("tv/trending")]
|
||||
//public async Task<IEnumerable<SearchTvShowViewModel>> Trending()
|
||||
//{
|
||||
// return await TvEngine.Trending();
|
||||
//}
|
||||
[HttpGet("tv/popular")]
|
||||
public async Task<IEnumerable<SearchTvShowViewModel>> PopularTv()
|
||||
{
|
||||
return await TvEngine.Popular();
|
||||
}
|
||||
[HttpGet("tv/anticiplated")]
|
||||
public async Task<IEnumerable<SearchTvShowViewModel>> AnticiplatedTv()
|
||||
{
|
||||
return await TvEngine.Anticipated();
|
||||
}
|
||||
[HttpGet("tv/mostwatched")]
|
||||
public async Task<IEnumerable<SearchTvShowViewModel>> MostWatched()
|
||||
{
|
||||
return await TvEngine.MostWatches();
|
||||
}
|
||||
[HttpGet("tv/trending")]
|
||||
public async Task<IEnumerable<SearchTvShowViewModel>> Trending()
|
||||
{
|
||||
return await TvEngine.Trending();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Ombi.Auth;
|
||||
using Ombi.Config;
|
||||
using Ombi.DependencyInjection;
|
||||
using Ombi.Mapping;
|
||||
using Ombi.Schedule;
|
||||
|
@ -72,6 +73,7 @@ namespace Ombi
|
|||
|
||||
|
||||
services.Configure<TokenAuthenticationOptions>(Configuration.GetSection("TokenAuthentication"));
|
||||
services.Configure<ApplicationSettings>(Configuration.GetSection("ApplicationSettings"));
|
||||
|
||||
services.AddHangfire(x =>
|
||||
{
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
"Default": "Warning"
|
||||
}
|
||||
},
|
||||
"Version": "{{VERSIONNUMBER}}",
|
||||
"ApplicationSettings": {
|
||||
"Verison": "{{VERSIONNUMBER}}"
|
||||
},
|
||||
"TokenAuthentication": {
|
||||
"SecretKey": "OmbiKey",
|
||||
"SecretKey": "secretkey_secretkey123!",
|
||||
"Issuer": "OmbiIssuer",
|
||||
"Audience": "OmbiAudience",
|
||||
"TokenPath": "/api/v1/token/",
|
||||
|
|
|
@ -33,6 +33,12 @@ export interface ITvRequestModel extends IMediaBase {
|
|||
firstAired: string,
|
||||
}
|
||||
|
||||
export interface IRequestCountModel {
|
||||
pending: number,
|
||||
approved: number,
|
||||
available: number
|
||||
}
|
||||
|
||||
export interface IChildTvRequest extends IMediaBase {
|
||||
requestAll: boolean,
|
||||
seasonRequests: ISeasonRequests[],
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
.landing-box {
|
||||
height: 150px;
|
||||
background: #333333 !important;
|
||||
border-radius: 2%
|
||||
border-radius: 2%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
box-shadow: 5px 3px 5px black;
|
||||
}
|
||||
|
||||
.landing-logo {
|
||||
|
|
|
@ -4,24 +4,46 @@
|
|||
<img [src]="customizationSettings.logo" />
|
||||
</div>
|
||||
|
||||
<h1>Hey! Welcome back to {{customizationSettings.applicationName}}</h1>
|
||||
|
||||
<h1>
|
||||
Hey! Welcome back to
|
||||
<span *ngIf="customizationSettings.applicationName">
|
||||
{{customizationSettings.applicationName}}
|
||||
</span>
|
||||
<span *ngIf="!customizationSettings.applicationName">
|
||||
Ombi
|
||||
</span>
|
||||
</h1>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<h3 *ngIf="landingPageSettings.noticeEnabled" [innerHtml]="landingPageSettings.noticeText" style="background-color: {{landingPageSettings.noticeBackgroundColor}}"></h3>
|
||||
<div class="col-md-3 landing-box">
|
||||
<div class="col-md-3 landing-box" [routerLink]="['/search']">
|
||||
<div>
|
||||
Request Something
|
||||
Search
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-md-offset-1 landing-box">
|
||||
<div class="col-md-3 col-md-offset-1 landing-box" [routerLink]="['/requests']">
|
||||
<div>
|
||||
View all your requests
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<div *ngIf="requestCount">
|
||||
Pending Requests: <span>{{requestCount.pending}}</span>
|
||||
<br />
|
||||
Approved Requests: <span>{{requestCount.approved}}</span>
|
||||
<br />
|
||||
Available Requests: <span>{{requestCount.available}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-md-offset-1 landing-box">
|
||||
<div>
|
||||
Report an issue
|
||||
Media Server Status:
|
||||
<span *ngIf="mediaServerStatus"><i class="fa fa-check-circle" style="color: #00c853"></i></span>
|
||||
<span *ngIf="!mediaServerStatus"><i class="fa fa-times-circle" style="color: #d50000"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { SettingsService } from '../services/settings.service';
|
||||
import { RequestService } from '../services/request.service';
|
||||
import { ILandingPageSettings, ICustomizationSettings } from '../interfaces/ISettings';
|
||||
import { IRequestCountModel } from '../interfaces/IRequestModel';
|
||||
|
||||
@Component({
|
||||
selector: 'ombi',
|
||||
|
@ -10,13 +12,19 @@ import { ILandingPageSettings, ICustomizationSettings } from '../interfaces/ISet
|
|||
})
|
||||
export class LandingPageComponent implements OnInit {
|
||||
|
||||
constructor(private settingsService: SettingsService) { }
|
||||
constructor(private settingsService: SettingsService, private requestService : RequestService) { }
|
||||
|
||||
customizationSettings : ICustomizationSettings;
|
||||
landingPageSettings: ILandingPageSettings;
|
||||
requestCount: IRequestCountModel;
|
||||
|
||||
mediaServerStatus: boolean;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
||||
this.settingsService.getLandingPage().subscribe(x => this.landingPageSettings = x);
|
||||
this.requestService.getRequestsCount().subscribe(x => this.requestCount = x);
|
||||
|
||||
this.mediaServerStatus = true;
|
||||
}
|
||||
}
|
|
@ -5,6 +5,8 @@ import { AuthService } from '../auth/auth.service';
|
|||
import { StatusService } from '../services/status.service';
|
||||
import { NotificationService } from '../services/notification.service';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'ombi',
|
||||
moduleId: module.id,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Http } from '@angular/http';
|
||||
import { AuthHttp } from 'angular2-jwt';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
|
||||
|
@ -6,11 +7,11 @@ import { ServiceAuthHelpers } from './service.helpers';
|
|||
import { IRequestEngineResult } from '../interfaces/IRequestEngineResult';
|
||||
import { ISearchMovieResult } from '../interfaces/ISearchMovieResult';
|
||||
import { ISearchTvResult } from '../interfaces/ISearchTvResult';
|
||||
import { IMovieRequestModel, ITvRequestModel } from '../interfaces/IRequestModel';
|
||||
import { IMovieRequestModel, ITvRequestModel, IRequestCountModel } from '../interfaces/IRequestModel';
|
||||
|
||||
@Injectable()
|
||||
export class RequestService extends ServiceAuthHelpers {
|
||||
constructor(http: AuthHttp) {
|
||||
constructor(http: AuthHttp, private basicHttp : Http) {
|
||||
super(http, '/api/v1/Request/');
|
||||
}
|
||||
|
||||
|
@ -53,4 +54,8 @@ export class RequestService extends ServiceAuthHelpers {
|
|||
updateTvRequest(request: ITvRequestModel): Observable<ITvRequestModel> {
|
||||
return this.http.post(`${this.url}tv/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
getRequestsCount(): Observable<IRequestCountModel> {
|
||||
return this.basicHttp.get(`${this.url}count`).map(this.extractData);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue