pull/3895/head
tidusjar 6 years ago
parent eaa4a7ec1c
commit 4fb965e782

@ -1,17 +1,14 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using TraktApiSharp.Enums;
using TraktApiSharp.Objects.Get.Shows;
using TraktApiSharp.Objects.Get.Shows.Common;
using TraktSharp.Entities;
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>> GetAnticipatedShows(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<TraktShow>> GetTrendingShows(int? page = default(int?), int? limitPerPage = default(int?));
Task<TraktShow> GetTvExtendedInfo(string imdbId);
}
}

@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="TraktApiSharp" Version="1.0.0-alpha1-fixed-issue59" />
<PackageReference Include="TraktSharp.NetStandard2" Version="0.3.0" />
</ItemGroup>
<ItemGroup>

@ -1,12 +1,11 @@
using System;

using System.Collections.Generic;
using System.Linq;
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 TraktSharp;
using TraktSharp.Entities;
using TraktSharp.Enums;
namespace Ombi.Api.Trakt
{
@ -18,36 +17,38 @@ namespace Ombi.Api.Trakt
private readonly string _apiKey = StringCipher.DecryptString(Encrypted, "ApiKey");
public TraktApi()
{
Client = new TraktClient(_apiKey);
Client = new TraktClient
{
Authentication =
{
ClientId = _apiKey,
ClientSecret = "7beeb6f1c0c842341f6bd285adb86200cb810e431fff0a8a1ed7158af4cffbbb"
}
};
}
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;
var popular = await Client.Shows.GetPopularShowsAsync(TraktExtendedOption.Full, page, limitPerPage);
return popular;
}
public async Task<IEnumerable<TraktTrendingShow>> GetTrendingShows(int? page = null, int? limitPerPage = null)
public async Task<IEnumerable<TraktShow>> 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;
var trendingShowsTop10 = await Client.Shows.GetTrendingShowsAsync(TraktExtendedOption.Full, page, limitPerPage);
return trendingShowsTop10.Select(x => x.Show);
}
public async Task<IEnumerable<TraktMostAnticipatedShow>> GetAnticipatedShows(int? page = null, int? limitPerPage = null)
public async Task<IEnumerable<TraktShow>> 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;
var anticipatedShows = await Client.Shows.GetAnticipatedShowsAsync(TraktExtendedOption.Full, page, limitPerPage);
return anticipatedShows.Select(x => x.Show);
}
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;
}
public async Task<TraktShow> GetTvExtendedInfo(string imdbId)
{
return await Client.Shows.GetShowAsync(imdbId, new TraktExtendedInfo { Full = true });
return await Client.Shows.GetShowAsync(imdbId, TraktExtendedOption.Full);
}
}
}

@ -25,10 +25,9 @@ namespace Ombi.Core.Engine.Demo
{
public DemoTvSearchEngine(IPrincipal identity, IRequestServiceMain service, ITvMazeApi tvMaze, IMapper mapper,
ISettingsService<PlexSettings> plexSettings, ISettingsService<EmbySettings> embySettings, IPlexContentRepository repo,
IEmbyContentRepository embyRepo, ITraktApi trakt, IRuleEvaluator r, OmbiUserManager um, ICacheService memCache,
ITraktApi trakt, IRuleEvaluator r, OmbiUserManager um, ICacheService memCache,
ISettingsService<OmbiSettings> s, IRepository<RequestSubscription> sub, IOptions<DemoLists> lists)
: base(identity, service, tvMaze, mapper, plexSettings, embySettings, repo, embyRepo, trakt, r, um, memCache, s, sub)
: base(identity, service, tvMaze, mapper, trakt, r, um, memCache, s, sub)
{
_demoLists = lists.Value;
}
@ -56,7 +55,7 @@ namespace Ombi.Core.Engine.Demo
{
continue;
}
retVal.Add(ProcessResult(tvMazeSearch));
retVal.Add(await ProcessResult(tvMazeSearch));
}
return retVal;
}
@ -78,7 +77,7 @@ namespace Ombi.Core.Engine.Demo
}
var movieResult = await TvMazeApi.ShowLookup(tv);
responses.Add(ProcessResult(movieResult));
responses.Add(await ProcessResult(movieResult));
}
return responses;

@ -12,9 +12,7 @@ namespace Ombi.Core.Engine.Interfaces
Task<IEnumerable<SearchTvShowViewModel>> Popular(int currentlyLoaded, int amountToLoad);
Task<IEnumerable<SearchTvShowViewModel>> Anticipated();
Task<IEnumerable<SearchTvShowViewModel>> Anticipated(int currentlyLoaded, int amountToLoad);
Task<IEnumerable<SearchTvShowViewModel>> MostWatches();
Task<IEnumerable<SearchTvShowViewModel>> Trending();
Task<IEnumerable<SearchTvShowViewModel>> MostWatches(int currentlyLoaded, int amountToLoad);
Task<IEnumerable<SearchTvShowViewModel>> Trending(int currentlyLoaded, int amountToLoad);
int ResultLimit { get; set; }
}

@ -21,33 +21,24 @@ using Ombi.Core.Authentication;
using Ombi.Helpers;
using Ombi.Settings.Settings.Models;
using Ombi.Store.Entities;
using TraktApiSharp.Objects.Get.Shows;
using TraktApiSharp.Objects.Get.Shows.Common;
using TraktSharp.Entities;
namespace Ombi.Core.Engine
{
public class TvSearchEngine : BaseMediaEngine, ITvSearchEngine
{
public TvSearchEngine(IPrincipal identity, IRequestServiceMain service, ITvMazeApi tvMaze, IMapper mapper, ISettingsService<PlexSettings> plexSettings,
ISettingsService<EmbySettings> embySettings, IPlexContentRepository repo, IEmbyContentRepository embyRepo, ITraktApi trakt, IRuleEvaluator r, OmbiUserManager um,
public TvSearchEngine(IPrincipal identity, IRequestServiceMain service, ITvMazeApi tvMaze, IMapper mapper,
ITraktApi trakt, IRuleEvaluator r, OmbiUserManager um,
ICacheService memCache, ISettingsService<OmbiSettings> s, IRepository<RequestSubscription> sub)
: base(identity, service, r, um, memCache, s, sub)
{
TvMazeApi = tvMaze;
Mapper = mapper;
PlexSettings = plexSettings;
EmbySettings = embySettings;
PlexContentRepo = repo;
TraktApi = trakt;
EmbyContentRepo = embyRepo;
}
protected ITvMazeApi TvMazeApi { get; }
protected IMapper Mapper { get; }
private ISettingsService<PlexSettings> PlexSettings { get; }
private ISettingsService<EmbySettings> EmbySettings { get; }
private IPlexContentRepository PlexContentRepo { get; }
private IEmbyContentRepository EmbyContentRepo { get; }
private ITraktApi TraktApi { get; }
public async Task<IEnumerable<SearchTvShowViewModel>> Search(string searchTerm)
@ -63,7 +54,7 @@ namespace Ombi.Core.Engine
{
continue;
}
retVal.Add(ProcessResult(tvMazeSearch));
retVal.Add(await ProcessResult(tvMazeSearch));
}
return retVal;
}
@ -129,7 +120,7 @@ namespace Ombi.Core.Engine
{
var result = await Cache.GetOrAdd(CacheKeys.PopularTv, async () => await TraktApi.GetPopularShows(null, ResultLimit), DateTime.Now.AddHours(12));
var processed = ProcessResults(result);
return processed;
return await processed;
}
public async Task<IEnumerable<SearchTvShowViewModel>> Popular(int currentlyLoaded, int amountToLoad)
@ -143,7 +134,7 @@ namespace Ombi.Core.Engine
results.AddRange(apiResult.Skip(pagesToLoad.Skip).Take(pagesToLoad.Take));
}
var processed = ProcessResults(results);
return processed;
return await processed;
}
public async Task<IEnumerable<SearchTvShowViewModel>> Anticipated()
@ -151,13 +142,13 @@ namespace Ombi.Core.Engine
var result = await Cache.GetOrAdd(CacheKeys.AnticipatedTv, async () => await TraktApi.GetAnticipatedShows(null, ResultLimit), DateTime.Now.AddHours(12));
var processed = ProcessResults(result);
return processed;
return await processed;
}
public async Task<IEnumerable<SearchTvShowViewModel>> Anticipated(int currentlyLoaded, int amountToLoad)
{
var pages = PaginationHelper.GetNextPages(currentlyLoaded, amountToLoad, ResultLimit);
var results = new List<TraktMostAnticipatedShow>();
var results = new List<TraktShow>();
foreach (var pagesToLoad in pages)
{
var apiResult = await Cache.GetOrAdd(nameof(Anticipated) + pagesToLoad.Page,
@ -165,41 +156,21 @@ namespace Ombi.Core.Engine
results.AddRange(apiResult.Skip(pagesToLoad.Skip).Take(pagesToLoad.Take));
}
var processed = ProcessResults(results);
return processed;
}
public async Task<IEnumerable<SearchTvShowViewModel>> MostWatches()
{
var result = await Cache.GetOrAdd(CacheKeys.MostWatchesTv, async () => await TraktApi.GetMostWatchesShows(null, ResultLimit), DateTime.Now.AddHours(12));
var processed = ProcessResults(result);
return processed;
return await processed;
}
public async Task<IEnumerable<SearchTvShowViewModel>> Trending()
{
var result = await Cache.GetOrAdd(CacheKeys.TrendingTv, async () => await TraktApi.GetTrendingShows(null, ResultLimit), DateTime.Now.AddHours(12));
var processed = ProcessResults(result);
return processed;
return await processed;
}
public async Task<IEnumerable<SearchTvShowViewModel>> MostWatches(int currentlyLoaded, int amountToLoad)
{
var pages = PaginationHelper.GetNextPages(currentlyLoaded, amountToLoad, ResultLimit);
var results = new List<TraktMostWatchedShow>();
foreach (var pagesToLoad in pages)
{
var apiResult = await Cache.GetOrAdd(nameof(MostWatches) + pagesToLoad.Page,
async () => await TraktApi.GetMostWatchesShows(null, pagesToLoad.Page, ResultLimit), DateTime.Now.AddHours(12));
results.AddRange(apiResult.Skip(pagesToLoad.Skip).Take(pagesToLoad.Take));
}
var processed = ProcessResults(results);
return processed;
}
public async Task<IEnumerable<SearchTvShowViewModel>> Trending(int currentlyLoaded, int amountToLoad)
{
var pages = PaginationHelper.GetNextPages(currentlyLoaded, amountToLoad, ResultLimit);
var results = new List<TraktTrendingShow>();
var results = new List<TraktShow>();
foreach (var pagesToLoad in pages)
{
var apiResult = await Cache.GetOrAdd(nameof(Trending) + pagesToLoad.Page,
@ -207,22 +178,23 @@ namespace Ombi.Core.Engine
results.AddRange(apiResult.Skip(pagesToLoad.Skip).Take(pagesToLoad.Take));
}
var processed = ProcessResults(results);
return processed;
return await processed;
}
protected IEnumerable<SearchTvShowViewModel> ProcessResults<T>(IEnumerable<T> items)
protected async Task<IEnumerable<SearchTvShowViewModel>> ProcessResults<T>(IEnumerable<T> items)
{
var retVal = new List<SearchTvShowViewModel>();
foreach (var tvMazeSearch in items)
{
retVal.Add(ProcessResult(tvMazeSearch));
retVal.Add(await ProcessResult(tvMazeSearch));
}
return retVal;
}
protected SearchTvShowViewModel ProcessResult<T>(T tvMazeSearch)
protected async Task<SearchTvShowViewModel> ProcessResult<T>(T tvMazeSearch)
{
return Mapper.Map<SearchTvShowViewModel>(tvMazeSearch);
var mapped = Mapper.Map<SearchTvShowViewModel>(tvMazeSearch);
return await ProcessResult(mapped);
}
private async Task<SearchTvShowViewModel> ProcessResult(SearchTvShowViewModel item)

@ -5,7 +5,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Threading.Tasks;
using TraktApiSharp.Objects.Get.Shows;
using Ombi.Core.Rule.Interfaces;
using Ombi.Store.Repository.Requests;
@ -21,6 +20,7 @@ using Ombi.Core.Models.Search.V2;
using Ombi.Core.Settings;
using Ombi.Core.Settings.Models.External;
using Ombi.Store.Repository;
using TraktSharp.Entities;
namespace Ombi.Core.Engine.V2
{
@ -148,9 +148,9 @@ namespace Ombi.Core.Engine.V2
return model;
}
model.Trailer = result.Trailer;
model.Trailer = result.Trailer.AbsoluteUri;
model.Certification = result.Certification;
model.Homepage = result.Homepage;
model.Homepage = result.Homepage.AbsoluteUri;
return model;
}

@ -2,15 +2,10 @@
using System.Globalization;
using AutoMapper;
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 Ombi.Store.Repository.Requests;
//using TraktApiSharp.Objects.Get.Shows;
//using TraktApiSharp.Objects.Get.Shows.Common;
using TraktSharp.Entities;
using TraktSharp.Helpers;
namespace Ombi.Mapping.Profiles
{
@ -51,78 +46,18 @@ namespace Ombi.Mapping.Profiles
.ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.status));
//CreateMap<TvMazeCustomSeason, SeasonRequests>()
// .ConstructUsing(x =>
// {
// var season = new SeasonRequests
// {
// SeasonNumber = x.SeasonNumber
// };
// foreach (var ep in x.EpisodeNumber)
// {
// season.Episodes.Add(new EpisodeRequests
// {
// EpisodeNumber = ep,
// });
// }
// return 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.Banner, opts => opts.MapFrom(src => src.Images.Banner.Full))
.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.Status, opts => opts.MapFrom(src => TraktEnumHelper.GetDescription(src.Status)))
.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<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));
}
}
}

@ -1,9 +1,11 @@
import { Component, OnInit, Input } from "@angular/core";
import { IDiscoverCardResult } from "../../interfaces";
import { RequestType, ISearchTvResult, ISearchMovieResult } from "../../../interfaces";
import { SearchService } from "../../../services";
import { SearchV2Service } from "../../../services";
import { MatDialog } from "@angular/material";
import { DiscoverCardDetailsComponent } from "./discover-card-details.component";
import { ISearchTvResultV2 } from "../../interfaces/ISearchTvResultV2";
import { ISearchMovieResultV2 } from "../../interfaces/ISearchMovieResultV2";
@Component({
selector: "discover-card",
@ -15,7 +17,7 @@ export class DiscoverCardComponent implements OnInit {
@Input() public result: IDiscoverCardResult;
public RequestType = RequestType;
constructor(private searchService: SearchService, private dialog: MatDialog) { }
constructor(private searchService: SearchV2Service, private dialog: MatDialog) { }
public ngOnInit() {
if (this.result.type == RequestType.tvShow) {
@ -34,23 +36,22 @@ export class DiscoverCardComponent implements OnInit {
});
}
public getExtraTvInfo() {
this.searchService.getShowInformation(this.result.id)
.subscribe(x => {
if (x) {
this.setTvDefaults(x);
this.updateTvItem(x);
}
});
public async getExtraTvInfo() {
var result = await this.searchService.getTvInfo(this.result.id);
this.setTvDefaults(result);
this.updateTvItem(result);
}
private getExtraMovieInfo() {
this.searchService.getMovieInformation(this.result.id)
.subscribe(m => {
this.updateMovieItem(m);
});
// if(!this.result.imdbid) {
this.searchService.getFullMovieDetails(this.result.id)
.subscribe(m => {
this.updateMovieItem(m);
});
// }
}
private updateMovieItem(updated: ISearchMovieResult) {
private updateMovieItem(updated: ISearchMovieResultV2) {
this.result.url = "http://www.imdb.com/title/" + updated.imdbId + "/";
this.result.available = updated.available;
this.result.requested = updated.requested;
@ -59,7 +60,7 @@ export class DiscoverCardComponent implements OnInit {
}
private setTvDefaults(x: ISearchTvResult) {
private setTvDefaults(x: ISearchTvResultV2) {
if (!x.imdbId) {
x.imdbId = "https://www.tvmaze.com/shows/" + x.seriesId;
} else {
@ -67,7 +68,7 @@ export class DiscoverCardComponent implements OnInit {
}
}
private updateTvItem(updated: ISearchTvResult) {
private updateTvItem(updated: ISearchTvResultV2) {
this.result.title = updated.title;
this.result.id = updated.id;
this.result.available = updated.fullyAvailable;

@ -53,9 +53,7 @@ export class DiscoverComponent implements OnInit {
return;
}
if (!this.isScrolling) {
debugger;
this.isScrolling = true;
console.log("SCROLLED!")
this.loading();
if (this.popularActive) {
this.movies = await this.searchService.popularMoviesByPage(this.contentLoaded, 12);
@ -138,7 +136,8 @@ export class DiscoverComponent implements OnInit {
url: `http://www.imdb.com/title/${m.imdbId}/`,
rating: m.voteAverage,
overview: m.overview,
approved: m.approved
approved: m.approved,
imdbid: m.imdbId
});
});
this.tvShows.forEach(m => {
@ -152,7 +151,8 @@ export class DiscoverComponent implements OnInit {
url: undefined,
rating: +m.rating,
overview: m.overview,
approved: m.approved
approved: m.approved,
imdbid: m.imdbId
});
});
this.shuffle(tempResults);
@ -173,7 +173,8 @@ export class DiscoverComponent implements OnInit {
url: `http://www.imdb.com/title/${m.imdbId}/`,
rating: m.voteAverage,
overview: m.overview,
approved: m.approved
approved: m.approved,
imdbid: m.imdbId
});
});
this.tvShows.forEach(m => {
@ -187,7 +188,8 @@ export class DiscoverComponent implements OnInit {
url: undefined,
rating: +m.rating,
overview: m.overview,
approved: m.approved
approved: m.approved,
imdbid: m.imdbId
});
});
this.shuffle(this.discoverResults);

@ -11,4 +11,5 @@ export interface IDiscoverCardResult {
requested: boolean;
rating: number;
overview: string;
imdbid: string;
}

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
@ -309,13 +310,14 @@ namespace Ombi.Controllers.V1
[HttpGet("tv/mostwatched")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesDefaultResponseType]
[Obsolete("This method is obsolete, Trakt API no longer supports this")]
public async Task<IEnumerable<SearchTvShowViewModel>> MostWatched()
{
if (IsDemo)
{
return await DemoTvSearch.NowPlayingMovies();
}
return await TvEngine.MostWatches();
return await TvEngine.Popular();
}
/// <summary>

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authorization;
using System;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
@ -274,9 +275,10 @@ namespace Ombi.Controllers.V2
[HttpGet("tv/mostwatched")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesDefaultResponseType]
[Obsolete("This method is obsolete, Trakt API no longer supports this")]
public async Task<IEnumerable<SearchTvShowViewModel>> MostWatched()
{
return await _tvSearchEngine.MostWatches();
return await _tvSearchEngine.Popular();
}
/// <summary>
@ -287,9 +289,10 @@ namespace Ombi.Controllers.V2
[HttpGet("tv/mostwatched/{currentPosition}/{amountToLoad}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesDefaultResponseType]
[Obsolete("This method is obsolete, Trakt API no longer supports this")]
public async Task<IEnumerable<SearchTvShowViewModel>> MostWatched(int currentPosition, int amountToLoad)
{
return await _tvSearchEngine.MostWatches(currentPosition, amountToLoad);
return await _tvSearchEngine.Popular(currentPosition, amountToLoad);
}
/// <summary>

Loading…
Cancel
Save