diff --git a/src/Ombi.Core/Engine/Demo/DemoTvSearchEngine.cs b/src/Ombi.Core/Engine/Demo/DemoTvSearchEngine.cs index 343fb400a..2c91a458f 100644 --- a/src/Ombi.Core/Engine/Demo/DemoTvSearchEngine.cs +++ b/src/Ombi.Core/Engine/Demo/DemoTvSearchEngine.cs @@ -28,7 +28,7 @@ namespace Ombi.Core.Engine.Demo ITraktApi trakt, IRuleEvaluator r, OmbiUserManager um, ICacheService memCache, ISettingsService s, IRepository sub, IOptions lists, IImageService imageService, ISettingsService custom) - : base(identity, service, tvMaze, mapper, trakt, r, um, custom, memCache, s, sub, imageService) + : base(identity, service, tvMaze, mapper, trakt, r, um, custom, memCache, s, sub, imageService, null) { _demoLists = lists.Value; } diff --git a/src/Ombi.Core/Engine/MovieSearchEngine.cs b/src/Ombi.Core/Engine/MovieSearchEngine.cs index cda8676fd..11bcfbfa2 100644 --- a/src/Ombi.Core/Engine/MovieSearchEngine.cs +++ b/src/Ombi.Core/Engine/MovieSearchEngine.cs @@ -189,7 +189,7 @@ namespace Ombi.Core.Engine } protected async Task> TransformMovieResultsToResponse( - IEnumerable movies) + IEnumerable movies) { var viewMovies = new List(); foreach (var movie in movies) @@ -244,7 +244,7 @@ namespace Ombi.Core.Engine } } - private async Task ProcessSingleMovie(MovieSearchResult movie) + private async Task ProcessSingleMovie(MovieDbSearchResult movie) { var viewMovie = Mapper.Map(movie); return await ProcessSingleMovie(viewMovie); diff --git a/src/Ombi.Core/Engine/TvSearchEngine.cs b/src/Ombi.Core/Engine/TvSearchEngine.cs index 433cacee0..87605cce5 100644 --- a/src/Ombi.Core/Engine/TvSearchEngine.cs +++ b/src/Ombi.Core/Engine/TvSearchEngine.cs @@ -22,6 +22,8 @@ using Ombi.Helpers; using Ombi.Settings.Settings.Models; using Ombi.Store.Entities; using TraktSharp.Entities; +using Ombi.Api.TheMovieDb; +using Ombi.Api.TheMovieDb.Models; namespace Ombi.Core.Engine { @@ -29,13 +31,16 @@ namespace Ombi.Core.Engine { private readonly ISettingsService _customizationSettings; private readonly IImageService _imageService; + private readonly IMovieDbApi _theMovieDbApi; public TvSearchEngine(IPrincipal identity, IRequestServiceMain service, ITvMazeApi tvMaze, IMapper mapper, ITraktApi trakt, IRuleEvaluator r, OmbiUserManager um, ISettingsService customizationSettings, - ICacheService memCache, ISettingsService s, IRepository sub, IImageService imageService) + ICacheService memCache, ISettingsService s, IRepository sub, IImageService imageService, + IMovieDbApi theMovieDbApi) : base(identity, service, r, um, memCache, s, sub) { _imageService = imageService; + _theMovieDbApi = theMovieDbApi; TvMazeApi = tvMaze; Mapper = mapper; TraktApi = trakt; @@ -48,18 +53,18 @@ namespace Ombi.Core.Engine public async Task> Search(string searchTerm) { - var searchResult = await TvMazeApi.Search(searchTerm); + var searchResult = await _theMovieDbApi.SearchTv(searchTerm); if (searchResult != null) { var retVal = new List(); - foreach (var tvMazeSearch in searchResult) + foreach (var result in searchResult) { - if (tvMazeSearch.show.externals == null || !(tvMazeSearch.show.externals?.thetvdb.HasValue ?? false)) - { - continue; - } - var mappedResult = await ProcessResult(tvMazeSearch, false); + //if (tvMazeSearch.show.externals == null || !(tvMazeSearch.show.externals?.thetvdb.HasValue ?? false)) + //{ + // continue; + //} + var mappedResult = await ProcessResult(result, false); if (mappedResult == null) { continue; @@ -135,12 +140,14 @@ namespace Ombi.Core.Engine public async Task> Popular(int currentlyLoaded, int amountToLoad, bool includeImages = false) { + var langCode = await DefaultLanguageCode(null); + var pages = PaginationHelper.GetNextPages(currentlyLoaded, amountToLoad, ResultLimit); - var results = new List(); + var results = new List(); foreach (var pagesToLoad in pages) { - var apiResult = await Cache.GetOrAdd(nameof(Popular) + pagesToLoad.Page, - async () => await TraktApi.GetPopularShows(pagesToLoad.Page, ResultLimit), DateTime.Now.AddHours(12)); + var apiResult = await Cache.GetOrAdd(nameof(Popular) + langCode + pagesToLoad.Page, + async () => await _theMovieDbApi.PopularTv(langCode, pagesToLoad.Page), DateTime.Now.AddHours(12)); results.AddRange(apiResult.Skip(pagesToLoad.Skip).Take(pagesToLoad.Take)); } @@ -158,12 +165,14 @@ namespace Ombi.Core.Engine public async Task> Anticipated(int currentlyLoaded, int amountToLoad) { + var langCode = await DefaultLanguageCode(null); + var pages = PaginationHelper.GetNextPages(currentlyLoaded, amountToLoad, ResultLimit); - var results = new List(); + var results = new List(); foreach (var pagesToLoad in pages) { - var apiResult = await Cache.GetOrAdd(nameof(Anticipated) + pagesToLoad.Page, - async () => await TraktApi.GetAnticipatedShows(pagesToLoad.Page, ResultLimit), DateTime.Now.AddHours(12)); + var apiResult = await Cache.GetOrAdd(nameof(Anticipated) + langCode + pagesToLoad.Page, + async () => await _theMovieDbApi.UpcomingTv(langCode, pagesToLoad.Page), DateTime.Now.AddHours(12)); results.AddRange(apiResult.Skip(pagesToLoad.Skip).Take(pagesToLoad.Take)); } var processed = ProcessResults(results); @@ -180,12 +189,14 @@ namespace Ombi.Core.Engine public async Task> Trending(int currentlyLoaded, int amountToLoad) { + var langCode = await DefaultLanguageCode(null); + var pages = PaginationHelper.GetNextPages(currentlyLoaded, amountToLoad, ResultLimit); - var results = new List(); + var results = new List(); foreach (var pagesToLoad in pages) { - var apiResult = await Cache.GetOrAdd(nameof(Trending) + pagesToLoad.Page, - async () => await TraktApi.GetTrendingShows(pagesToLoad.Page, ResultLimit), DateTime.Now.AddHours(12)); + var apiResult = await Cache.GetOrAdd(nameof(Trending) + langCode + pagesToLoad.Page, + async () => await _theMovieDbApi.TopRatedTv(langCode, pagesToLoad.Page), DateTime.Now.AddHours(12)); results.AddRange(apiResult.Skip(pagesToLoad.Skip).Take(pagesToLoad.Take)); } var processed = ProcessResults(results); @@ -220,14 +231,15 @@ namespace Ombi.Core.Engine { return null; } - item.TheTvDbId = item.Id.ToString(); - if (includeImages) - { - if (item.TheTvDbId.HasValue()) - { - item.BackdropPath = await _imageService.GetTvBackground(item.TheTvDbId); - } - } + item.TheMovieDbId = item.Id.ToString(); + //item.TheTvDbId = item.Id.ToString(); + //if (includeImages) + //{ + // if (item.TheTvDbId.HasValue()) + // { + // item.BackdropPath = await _imageService.GetTvBackground(item.TheTvDbId); + // } + //} await RunSearchRules(item); diff --git a/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs b/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs index dc009371a..cb8ec0d3b 100644 --- a/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs +++ b/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs @@ -127,7 +127,7 @@ namespace Ombi.Core.Engine.V2 var pages = PaginationHelper.GetNextPages(currentlyLoaded, toLoad, _theMovieDbMaxPageItems); - var results = new List(); + var results = new List(); foreach (var pagesToLoad in pages) { var apiResult = await Cache.GetOrAdd(nameof(PopularMovies) + pagesToLoad.Page + langCode, @@ -161,7 +161,7 @@ namespace Ombi.Core.Engine.V2 var pages = PaginationHelper.GetNextPages(currentPosition, amountToLoad, _theMovieDbMaxPageItems); - var results = new List(); + var results = new List(); foreach (var pagesToLoad in pages) { var apiResult = await Cache.GetOrAdd(nameof(TopRatedMovies) + pagesToLoad.Page + langCode, @@ -177,7 +177,7 @@ namespace Ombi.Core.Engine.V2 var pages = PaginationHelper.GetNextPages(currentPosition, amountToLoad, _theMovieDbMaxPageItems); - var results = new List(); + var results = new List(); foreach (var pagesToLoad in pages) { var apiResult = await Cache.GetOrAdd(nameof(NowPlayingMovies) + pagesToLoad.Page + langCode, @@ -213,7 +213,7 @@ namespace Ombi.Core.Engine.V2 var pages = PaginationHelper.GetNextPages(currentPosition, amountToLoad, _theMovieDbMaxPageItems); - var results = new List(); + var results = new List(); foreach (var pagesToLoad in pages) { var apiResult = await Cache.GetOrAdd(nameof(UpcomingMovies) + pagesToLoad.Page + langCode, @@ -270,7 +270,7 @@ namespace Ombi.Core.Engine.V2 } protected async Task> TransformMovieResultsToResponse( - IEnumerable movies) + IEnumerable movies) { var settings = await _customizationSettings.GetSettingsAsync(); var viewMovies = new List(); @@ -286,7 +286,7 @@ namespace Ombi.Core.Engine.V2 return viewMovies; } - private async Task ProcessSingleMovie(MovieSearchResult movie) + private async Task ProcessSingleMovie(MovieDbSearchResult movie) { var viewMovie = Mapper.Map(movie); return await ProcessSingleMovie(viewMovie); diff --git a/src/Ombi.Mapping/Profiles/MovieProfile.cs b/src/Ombi.Mapping/Profiles/MovieProfile.cs index 7027f3aed..00d50fdc5 100644 --- a/src/Ombi.Mapping/Profiles/MovieProfile.cs +++ b/src/Ombi.Mapping/Profiles/MovieProfile.cs @@ -14,7 +14,7 @@ namespace Ombi.Mapping.Profiles { public MovieProfile() { - CreateMap() + CreateMap() .ForMember(dest => dest.Adult, opts => opts.MapFrom(src => src.adult)) .ForMember(dest => dest.BackdropPath, opts => opts.MapFrom(src => src.backdrop_path)) .ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.id)) @@ -24,7 +24,7 @@ namespace Ombi.Mapping.Profiles .ForMember(dest => dest.Popularity, opts => opts.MapFrom(src => src.popularity)) .ForMember(dest => dest.PosterPath, opts => opts.MapFrom(src => src.poster_path)) .ForMember(dest => dest.ReleaseDate, opts => opts.MapFrom(src => src.release_date)) - .ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.title)) + .ForMember(dest => dest.Title, opts => opts.MapFrom(src => string.IsNullOrEmpty(src.title) ? src.name : src.title)) .ForMember(dest => dest.Video, opts => opts.MapFrom(src => src.video)) .ForMember(dest => dest.VoteAverage, opts => opts.MapFrom(src => src.vote_average)) .ForMember(dest => dest.VoteCount, opts => opts.MapFrom(src => src.vote_count)); @@ -75,7 +75,7 @@ namespace Ombi.Mapping.Profiles CreateMap(); - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); diff --git a/src/Ombi.Mapping/Profiles/TvProfile.cs b/src/Ombi.Mapping/Profiles/TvProfile.cs index 0e1378d95..55f5ccf9e 100644 --- a/src/Ombi.Mapping/Profiles/TvProfile.cs +++ b/src/Ombi.Mapping/Profiles/TvProfile.cs @@ -1,6 +1,7 @@ using System; using System.Globalization; using AutoMapper; +using Ombi.Api.TheMovieDb.Models; using Ombi.Api.TvMaze.Models; using Ombi.Core.Models.Search; using Ombi.Helpers; @@ -27,6 +28,15 @@ namespace Ombi.Mapping.Profiles .ForMember(dest => dest.Banner, opts => opts.MapFrom(src => !string.IsNullOrEmpty(src.show.image.medium) ? src.show.image.medium.ToHttpsUrl() : string.Empty)) .ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.show.status)); + CreateMap() + .ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.Id)) + .ForMember(dest => dest.TheMovieDbId, opts => opts.MapFrom(src => src.Id.ToString())) + .ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.ReleaseDate)) + .ForMember(dest => dest.Overview, opts => opts.MapFrom(src => src.Overview)) + .ForMember(dest => dest.Rating, opts => opts.MapFrom(src => src.VoteAverage.ToString(CultureInfo.CurrentUICulture))) + .ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.Name)) + .ForMember(dest => dest.Banner, opts => opts.MapFrom(src => !string.IsNullOrEmpty(src.BackdropPath) ? src.BackdropPath.ToHttpsUrl() : src.PosterPath)); + CreateMap() .ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.externals.thetvdb)) .ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.premiered)) @@ -56,10 +66,27 @@ namespace Ombi.Mapping.Profiles .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 => TraktEnumHelper.GetDescription(src.Status))) - .ForMember(dest => dest.Trailer, + .ForMember(dest => dest.Trailer, opts => opts.MapFrom(src => src.Trailer != null ? src.Trailer.ToString().ToHttpsUrl() : string.Empty)) - .ForMember(dest => dest.Homepage, + .ForMember(dest => dest.Homepage, opts => opts.MapFrom(src => src.Homepage != null ? src.Homepage.ToString().ToHttpsUrl() : string.Empty)); + + + CreateMap() + .ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.Id)) + .ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.ReleaseDate)) + //.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)) + .ForMember(dest => dest.Rating, opts => opts.MapFrom(src => src.VoteAverage.ToString())) + .ForMember(dest => dest.BackdropPath, opts => opts.MapFrom(src => src.PosterPath)) + //.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 => TraktEnumHelper.GetDescription(src.Status))) + //.ForMember(dest => dest.Trailer, + // opts => opts.MapFrom(src => src.Trailer != null ? src.Trailer.ToString().ToHttpsUrl() : string.Empty)) + //.ForMember(dest => dest.Homepage, + // opts => opts.MapFrom(src => src.Homepage != null ? src.Homepage.ToString().ToHttpsUrl() : string.Empty)); } } } \ No newline at end of file diff --git a/src/Ombi.Store/Entities/Requests/TvRequests.cs b/src/Ombi.Store/Entities/Requests/TvRequests.cs index 5e33c016f..00e56f92d 100644 --- a/src/Ombi.Store/Entities/Requests/TvRequests.cs +++ b/src/Ombi.Store/Entities/Requests/TvRequests.cs @@ -7,6 +7,7 @@ namespace Ombi.Store.Entities.Requests public class TvRequests : Entity { public int TvDbId { get; set; } + //public int ExternalProviderId { get; set; } public string ImdbId { get; set; } public int? QualityOverride { get; set; } public int? RootFolder { get; set; } diff --git a/src/Ombi.TheMovieDbApi/IMovieDbApi.cs b/src/Ombi.TheMovieDbApi/IMovieDbApi.cs index 1b35381ad..2eedaa1e7 100644 --- a/src/Ombi.TheMovieDbApi/IMovieDbApi.cs +++ b/src/Ombi.TheMovieDbApi/IMovieDbApi.cs @@ -10,13 +10,16 @@ namespace Ombi.Api.TheMovieDb { Task GetMovieInformation(int movieId); Task GetMovieInformationWithExtraInfo(int movieId, string langCode = "en"); - Task> NowPlaying(string languageCode, int? page = null); - Task> PopularMovies(string languageCode, int? page = null, CancellationToken cancellationToken = default(CancellationToken)); - Task> SearchMovie(string searchTerm, int? year, string languageCode); + Task> NowPlaying(string languageCode, int? page = null); + Task> PopularMovies(string languageCode, int? page = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> PopularTv(string langCode, int? page = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> SearchMovie(string searchTerm, int? year, string languageCode); Task> SearchTv(string searchTerm, string year = default); - Task> TopRated(string languageCode, int? page = null); - Task> Upcoming(string languageCode, int? page = null); - Task> SimilarMovies(int movieId, string langCode); + Task> TopRated(string languageCode, int? page = null); + Task> Upcoming(string languageCode, int? page = null); + Task> TopRatedTv(string languageCode, int? page = null); + Task> UpcomingTv(string languageCode, int? page = null); + Task> SimilarMovies(int movieId, string langCode); Task Find(string externalId, ExternalSource source); Task GetTvExternals(int theMovieDbId); Task GetTVInfo(string themoviedbid); diff --git a/src/Ombi.TheMovieDbApi/Models/MovieSearchResult.cs b/src/Ombi.TheMovieDbApi/Models/MovieDbSearchResult.cs similarity index 94% rename from src/Ombi.TheMovieDbApi/Models/MovieSearchResult.cs rename to src/Ombi.TheMovieDbApi/Models/MovieDbSearchResult.cs index 8503cd7f7..0e4a8852f 100644 --- a/src/Ombi.TheMovieDbApi/Models/MovieSearchResult.cs +++ b/src/Ombi.TheMovieDbApi/Models/MovieDbSearchResult.cs @@ -1,6 +1,6 @@ namespace Ombi.Api.TheMovieDb.Models { - public class MovieSearchResult + public class MovieDbSearchResult { public string PosterPath { get; set; } public bool Adult { get; set; } diff --git a/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs b/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs index f270ad3b2..12eab69e4 100644 --- a/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs +++ b/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs @@ -132,7 +132,7 @@ namespace Ombi.Api.TheMovieDb return await Api.Request(request); } - public async Task> SimilarMovies(int movieId, string langCode) + public async Task> SimilarMovies(int movieId, string langCode) { var request = new Request($"movie/{movieId}/similar", BaseUri, HttpMethod.Get); request.AddQueryString("api_key", ApiToken); @@ -140,7 +140,7 @@ namespace Ombi.Api.TheMovieDb AddRetry(request); var result = await Api.Request>(request); - return Mapper.Map>(result.results); + return Mapper.Map>(result.results); } public async Task GetMovieInformationWithExtraInfo(int movieId, string langCode = "en") @@ -154,7 +154,7 @@ namespace Ombi.Api.TheMovieDb return Mapper.Map(result); } - public async Task> SearchMovie(string searchTerm, int? year, string langCode) + public async Task> SearchMovie(string searchTerm, int? year, string langCode) { var request = new Request($"search/movie", BaseUri, HttpMethod.Get); request.AddQueryString("api_key", ApiToken); @@ -171,15 +171,25 @@ namespace Ombi.Api.TheMovieDb AddRetry(request); var result = await Api.Request>(request); - return Mapper.Map>(result.results); + return Mapper.Map>(result.results); } /// /// Maintains filter parity with /movie/popular. /// - public async Task> PopularMovies(string langCode, int? page = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> PopularMovies(string langCode, int? page = null, CancellationToken cancellationToken = default(CancellationToken)) { - var request = new Request($"discover/movie", BaseUri, HttpMethod.Get); + return await Popular("movie", langCode, page, cancellationToken); + } + + public async Task> PopularTv(string langCode, int? page = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await Popular("tv", langCode, page, cancellationToken); + } + + public async Task> Popular(string type, string langCode, int? page = null, CancellationToken cancellationToken = default(CancellationToken)) + { + var request = new Request($"discover/{type}", BaseUri, HttpMethod.Get); request.AddQueryString("api_key", ApiToken); request.AddQueryString("language", langCode); request.AddQueryString("sort_by", "popularity.desc"); @@ -187,18 +197,28 @@ namespace Ombi.Api.TheMovieDb { request.AddQueryString("page", page.ToString()); } - await AddDiscoverMovieSettings(request); + await AddDiscoverSettings(request); AddRetry(request); var result = await Api.Request>(request, cancellationToken); - return Mapper.Map>(result.results); + return Mapper.Map>(result.results); + } + + public Task> TopRated(string langCode, int? page = null) + { + return TopRated("movie", langCode, page); + } + + public Task> TopRatedTv(string langCode, int? page = null) + { + return TopRated("tv", langCode, page); } /// /// Maintains filter parity with /movie/top_rated. /// - public async Task> TopRated(string langCode, int? page = null) + private async Task> TopRated(string type, string langCode, int? page = null) { - var request = new Request($"discover/movie", BaseUri, HttpMethod.Get); + var request = new Request($"discover/{type}", BaseUri, HttpMethod.Get); request.AddQueryString("api_key", ApiToken); request.AddQueryString("language", langCode); request.AddQueryString("sort_by", "vote_average.desc"); @@ -212,18 +232,27 @@ namespace Ombi.Api.TheMovieDb // to filter out extremely high-rated movies due to very little votes request.AddQueryString("vote_count.gte", "250"); - await AddDiscoverMovieSettings(request); + await AddDiscoverSettings(request); AddRetry(request); var result = await Api.Request>(request); - return Mapper.Map>(result.results); + return Mapper.Map>(result.results); + } + + public Task> Upcoming(string langCode, int? page = null) + { + return Upcoming("movie", langCode, page); + } + public Task> UpcomingTv(string langCode, int? page = null) + { + return Upcoming("tv", langCode, page); } /// /// Maintains filter parity with /movie/upcoming. /// - public async Task> Upcoming(string langCode, int? page = null) + private async Task> Upcoming(string type, string langCode, int? page = null) { - var request = new Request($"discover/movie", BaseUri, HttpMethod.Get); + var request = new Request($"discover/{type}", BaseUri, HttpMethod.Get); request.AddQueryString("api_key", ApiToken); request.AddQueryString("language", langCode); @@ -239,16 +268,16 @@ namespace Ombi.Api.TheMovieDb { request.AddQueryString("page", page.ToString()); } - await AddDiscoverMovieSettings(request); + await AddDiscoverSettings(request); AddRetry(request); var result = await Api.Request>(request); - return Mapper.Map>(result.results); + return Mapper.Map>(result.results); } /// /// Maintains filter parity with /movie/now_playing. /// - public async Task> NowPlaying(string langCode, int? page = null) + public async Task> NowPlaying(string langCode, int? page = null) { var request = new Request($"discover/movie", BaseUri, HttpMethod.Get); request.AddQueryString("api_key", ApiToken); @@ -267,10 +296,10 @@ namespace Ombi.Api.TheMovieDb request.AddQueryString("page", page.ToString()); } - await AddDiscoverMovieSettings(request); + await AddDiscoverSettings(request); AddRetry(request); var result = await Api.Request>(request); - return Mapper.Map>(result.results); + return Mapper.Map>(result.results); } public async Task GetTVInfo(string themoviedbid) @@ -330,7 +359,7 @@ namespace Ombi.Api.TheMovieDb return Api.Request(request, token); } - private async Task AddDiscoverMovieSettings(Request request) + private async Task AddDiscoverSettings(Request request) { var settings = await Settings; request.AddQueryString("include_adult", settings.ShowAdultMovies.ToString().ToLower()); diff --git a/src/Ombi.sln b/src/Ombi.sln index 70324f967..01bc0643e 100644 --- a/src/Ombi.sln +++ b/src/Ombi.sln @@ -7,6 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi", "Ombi\Ombi.csproj", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9D30CCF8-A115-4EB7-A34D-07780D752789}" ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig ..\.azuredevops\pipelines\templates\build-steps.yml = ..\.azuredevops\pipelines\templates\build-steps.yml ..\build.cake = ..\build.cake ..\CHANGELOG.md = ..\CHANGELOG.md @@ -121,7 +122,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.Webhook", "Ombi.Ap EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.CloudService", "Ombi.Api.CloudService\Ombi.Api.CloudService.csproj", "{5DE40A66-B369-469E-8626-ECE23D9D8034}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ombi.Api.RottenTomatoes", "Ombi.Api.RottenTomatoes\Ombi.Api.RottenTomatoes.csproj", "{8F19C701-7881-4BC7-8BBA-B068A6B954AD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.RottenTomatoes", "Ombi.Api.RottenTomatoes\Ombi.Api.RottenTomatoes.csproj", "{8F19C701-7881-4BC7-8BBA-B068A6B954AD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.ts b/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.ts index 1bb4f4359..e94789dcb 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.ts +++ b/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.ts @@ -29,7 +29,8 @@ export class DiscoverCardComponent implements OnInit { public ngOnInit() { if (this.result.type == RequestType.tvShow) { - this.getExtraTvInfo(); + this.fullyLoaded = true; + // this.getExtraTvInfo(); } if (this.result.type == RequestType.movie) { this.getExtraMovieInfo(); @@ -44,15 +45,15 @@ export class DiscoverCardComponent implements OnInit { } public async getExtraTvInfo() { - if (this.result.tvMovieDb) { - this.tvSearchResult = await this.searchService.getTvInfoWithMovieDbId(+this.result.id); - } else { - this.tvSearchResult = await this.searchService.getTvInfo(+this.result.id); - } - if (!this.tvSearchResult || this.tvSearchResult?.status.length > 0 && this.tvSearchResult?.status === "404") { - this.hide = true; - return; - } + // if (this.result.tvMovieDb) { + // this.tvSearchResult = await this.searchService.getTvInfoWithMovieDbId(+this.result.id); + // } else { + // this.tvSearchResult = await this.searchService.getTvInfo(+this.result.id); + // } + // if (!this.tvSearchResult || this.tvSearchResult?.status.length > 0 && this.tvSearchResult?.status === "404") { + // this.hide = true; + // return; + // } this.setTvDefaults(this.tvSearchResult); this.updateTvItem(this.tvSearchResult); diff --git a/src/Ombi/ClientApp/src/app/discover/components/carousel-list/carousel-list.component.ts b/src/Ombi/ClientApp/src/app/discover/components/carousel-list/carousel-list.component.ts index c3909512e..eeb4821c3 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/carousel-list/carousel-list.component.ts +++ b/src/Ombi/ClientApp/src/app/discover/components/carousel-list/carousel-list.component.ts @@ -289,7 +289,7 @@ export class CarouselListComponent implements OnInit { this.tvShows.forEach(m => { tempResults.push({ available: m.available, - posterPath: "../../../images/default_tv_poster.png", + posterPath: m.backdropPath ? `https://image.tmdb.org/t/p/w500/${m.backdropPath}` : "../../../images/default_tv_poster.png", requested: m.requested, title: m.title, type: RequestType.tvShow, diff --git a/src/Ombi/ClientApp/src/app/interfaces/ISearchTvResult.ts b/src/Ombi/ClientApp/src/app/interfaces/ISearchTvResult.ts index 78438a079..eb4cc2e22 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/ISearchTvResult.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/ISearchTvResult.ts @@ -36,6 +36,7 @@ export interface ISearchTvResult { subscribed: boolean; showSubscribe: boolean; fullyAvailable: boolean; + backdropPath: string; partlyAvailable: boolean; background: any; open: boolean; // THIS IS FOR THE UI diff --git a/src/Ombi/Properties/launchSettings.json b/src/Ombi/Properties/launchSettings.json index 0116bc6e8..b3899f8c3 100644 --- a/src/Ombi/Properties/launchSettings.json +++ b/src/Ombi/Properties/launchSettings.json @@ -14,7 +14,7 @@ "profiles": { "IIS Express": { "commandName": "IISExpress", - "commandLineArgs": "--host http://*:3577" , + "commandLineArgs": "--host http://*:3577", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" @@ -22,7 +22,7 @@ }, "Ombi": { "commandName": "Project", - "commandLineArgs": "--host http://localhost:3577 --baseUrl /ombi/", + "commandLineArgs": "--host http://localhost:3577", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" },