Skip to content

Commit

Permalink
fix: Remove old trending source (#4987)
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
sephrat authored Jul 19, 2023
1 parent 763b64d commit aacaa3e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
7 changes: 1 addition & 6 deletions src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,14 @@ public async Task<IEnumerable<SearchMovieViewModel>> TopRatedMovies(int currentP
public async Task<IEnumerable<SearchMovieViewModel>> NowPlayingMovies(int currentPosition, int amountToLoad)
{
var langCode = await DefaultLanguageCode(null);
var isOldTrendingSourceEnabled = await _feature.FeatureEnabled(FeatureNames.OldTrendingSource);

var pages = PaginationHelper.GetNextPages(currentPosition, amountToLoad, _theMovieDbMaxPageItems);

var results = new List<MovieDbSearchResult>();
foreach (var pagesToLoad in pages)
{
var search = () => (isOldTrendingSourceEnabled) ?
MovieApi.NowPlaying(langCode, pagesToLoad.Page)
: MovieApi.TrendingMovies(langCode, pagesToLoad.Page);

var apiResult = await Cache.GetOrAddAsync(nameof(NowPlayingMovies) + pagesToLoad.Page + langCode,
search, DateTimeOffset.Now.AddHours(12));
() => MovieApi.TrendingMovies(langCode, pagesToLoad.Page), DateTimeOffset.Now.AddHours(12));
results.AddRange(apiResult.Skip(pagesToLoad.Skip).Take(pagesToLoad.Take));
}
return await TransformMovieResultsToResponse(results);
Expand Down
6 changes: 1 addition & 5 deletions src/Ombi.Core/Engine/V2/TvSearchEngineV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,13 @@ public async Task<IEnumerable<SearchTvShowViewModel>> Anticipated(int currentlyL
public async Task<IEnumerable<SearchTvShowViewModel>> Trending(int currentlyLoaded, int amountToLoad)
{
var langCode = await DefaultLanguageCode(null);
var isOldTrendingSourceEnabled = await _feature.FeatureEnabled(FeatureNames.OldTrendingSource);

var pages = PaginationHelper.GetNextPages(currentlyLoaded, amountToLoad, ResultLimit);
var results = new List<MovieDbSearchResult>();
foreach (var pagesToLoad in pages)
{
var search = ( async () => (isOldTrendingSourceEnabled) ?
await _movieApi.TopRatedTv(langCode, pagesToLoad.Page)
: await _movieApi.TrendingTv(langCode, pagesToLoad.Page));
var apiResult = await Cache.GetOrAddAsync(nameof(Trending) + langCode + pagesToLoad.Page,
search, DateTimeOffset.Now.AddHours(12));
() => _movieApi.TrendingTv(langCode, pagesToLoad.Page), DateTimeOffset.Now.AddHours(12));
results.AddRange(apiResult.Skip(pagesToLoad.Skip).Take(pagesToLoad.Take));
}

Expand Down
1 change: 0 additions & 1 deletion src/Ombi.Settings/Settings/Models/FeatureSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class FeatureEnablement
public static class FeatureNames
{
public const string Movie4KRequests = nameof(Movie4KRequests);
public const string OldTrendingSource = nameof(OldTrendingSource);
public const string PlayedSync = nameof(PlayedSync);
}
}

0 comments on commit aacaa3e

Please sign in to comment.