mirror of
https://github.com/jellyfin/TMDbLib.git
synced 2025-02-22 06:20:29 +00:00
Merge pull request #222 from LordMike/issue-146
added region option to relevant movie methods
This commit is contained in:
commit
856b1584d5
@ -216,7 +216,7 @@ namespace TMDbLib.Client
|
||||
return response;
|
||||
}
|
||||
|
||||
public async Task<SearchContainerWithDates<SearchMovie>> GetMovieNowPlayingListAsync(string language = null, int page = 0)
|
||||
public async Task<SearchContainerWithDates<SearchMovie>> GetMovieNowPlayingListAsync(string language = null, int page = 0, string region = null)
|
||||
{
|
||||
RestRequest req = _client.Create("movie/now_playing");
|
||||
|
||||
@ -224,13 +224,15 @@ namespace TMDbLib.Client
|
||||
req.AddParameter("page", page.ToString());
|
||||
if (language != null)
|
||||
req.AddParameter("language", language);
|
||||
|
||||
if (region != null)
|
||||
req.AddParameter("region", region);
|
||||
|
||||
RestResponse<SearchContainerWithDates<SearchMovie>> resp = await req.ExecuteGet<SearchContainerWithDates<SearchMovie>>().ConfigureAwait(false);
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
public async Task<SearchContainer<SearchMovie>> GetMoviePopularListAsync(string language = null, int page = 0)
|
||||
public async Task<SearchContainer<SearchMovie>> GetMoviePopularListAsync(string language = null, int page = 0, string region = null)
|
||||
{
|
||||
RestRequest req = _client.Create("movie/popular");
|
||||
|
||||
@ -238,6 +240,8 @@ namespace TMDbLib.Client
|
||||
req.AddParameter("page", page.ToString());
|
||||
if (language != null)
|
||||
req.AddParameter("language", language);
|
||||
if (region != null)
|
||||
req.AddParameter("region", region);
|
||||
|
||||
RestResponse<SearchContainer<SearchMovie>> resp = await req.ExecuteGet<SearchContainer<SearchMovie>>().ConfigureAwait(false);
|
||||
|
||||
@ -274,7 +278,7 @@ namespace TMDbLib.Client
|
||||
return await GetMovieMethod<SearchContainer<SearchMovie>>(movieId, MovieMethods.Similar, page: page, language: language, dateFormat: "yyyy-MM-dd").ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<SearchContainer<SearchMovie>> GetMovieTopRatedListAsync(string language = null, int page = 0)
|
||||
public async Task<SearchContainer<SearchMovie>> GetMovieTopRatedListAsync(string language = null, int page = 0, string region = null)
|
||||
{
|
||||
RestRequest req = _client.Create("movie/top_rated");
|
||||
|
||||
@ -282,6 +286,8 @@ namespace TMDbLib.Client
|
||||
req.AddParameter("page", page.ToString());
|
||||
if (language != null)
|
||||
req.AddParameter("language", language);
|
||||
if (region != null)
|
||||
req.AddParameter("region", region);
|
||||
|
||||
RestResponse<SearchContainer<SearchMovie>> resp = await req.ExecuteGet<SearchContainer<SearchMovie>>().ConfigureAwait(false);
|
||||
|
||||
@ -293,7 +299,7 @@ namespace TMDbLib.Client
|
||||
return await GetMovieMethod<TranslationsContainer>(movieId, MovieMethods.Translations).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<SearchContainerWithDates<SearchMovie>> GetMovieUpcomingListAsync(string language = null, int page = 0)
|
||||
public async Task<SearchContainerWithDates<SearchMovie>> GetMovieUpcomingListAsync(string language = null, int page = 0, string region = null)
|
||||
{
|
||||
RestRequest req = _client.Create("movie/upcoming");
|
||||
|
||||
@ -301,6 +307,8 @@ namespace TMDbLib.Client
|
||||
req.AddParameter("page", page.ToString());
|
||||
if (language != null)
|
||||
req.AddParameter("language", language);
|
||||
if (region != null)
|
||||
req.AddParameter("region", region);
|
||||
|
||||
RestResponse<SearchContainerWithDates<SearchMovie>> resp = await req.ExecuteGet<SearchContainerWithDates<SearchMovie>>().ConfigureAwait(false);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Xunit;
|
||||
@ -460,6 +461,15 @@ namespace TMDbLibTests
|
||||
|
||||
// At least one title should differ
|
||||
Assert.True(list.Results.Any(s => listDe.Results.Any(x => x.Title != s.Title)));
|
||||
|
||||
SearchContainer<SearchMovie> listRegion = Config.Client.GetMoviePopularListAsync(region:"de").Result;
|
||||
|
||||
Assert.NotNull(listRegion);
|
||||
Assert.True(listRegion.Results.Count > 0);
|
||||
Assert.Equal(1, listRegion.Page);
|
||||
|
||||
// At least one title should differ
|
||||
Assert.True(listDe.Results.Any(s => listRegion.Results.Any(x => x.Title != s.Title)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -488,6 +498,15 @@ namespace TMDbLibTests
|
||||
|
||||
// At least one title should differ
|
||||
Assert.True(list.Results.Any(s => listDe.Results.Any(x => x.Title != s.Title)));
|
||||
|
||||
SearchContainer<SearchMovie> listRegion = Config.Client.GetMovieTopRatedListAsync(region:"de").Result;
|
||||
|
||||
Assert.NotNull(listRegion);
|
||||
Assert.True(listRegion.Results.Count > 0);
|
||||
Assert.Equal(1, listRegion.Page);
|
||||
|
||||
// At least one title should differ
|
||||
Assert.True(listDe.Results.Any(s => listRegion.Results.Any(x => x.Title != s.Title)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -516,6 +535,15 @@ namespace TMDbLibTests
|
||||
|
||||
// At least one title should differ
|
||||
Assert.True(list.Results.Any(s => listDe.Results.Any(x => x.Title != s.Title)));
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listRegion = Config.Client.GetMovieNowPlayingListAsync(region:"de").Result;
|
||||
|
||||
Assert.NotNull(listRegion);
|
||||
Assert.True(listRegion.Results.Count > 0);
|
||||
Assert.Equal(1, listRegion.Page);
|
||||
|
||||
// At least one title should differ
|
||||
Assert.True(listDe.Results.Any(s => listRegion.Results.Any(x => x.Title != s.Title)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -536,7 +564,7 @@ namespace TMDbLibTests
|
||||
Assert.True(listPage2.Results.Count > 0);
|
||||
Assert.Equal(2, listPage2.Page);
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listDe = Config.Client.GetMovieUpcomingListAsync("de").Result;
|
||||
SearchContainerWithDates<SearchMovie> listDe = Config.Client.GetMovieUpcomingListAsync(language:"de").Result;
|
||||
|
||||
Assert.NotNull(listDe);
|
||||
Assert.True(listDe.Results.Count > 0);
|
||||
@ -544,6 +572,15 @@ namespace TMDbLibTests
|
||||
|
||||
// At least one title should differ
|
||||
Assert.True(list.Results.Any(s => listDe.Results.Any(x => x.Title != s.Title)));
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listDeRegion = Config.Client.GetMovieUpcomingListAsync(region: "de").Result;
|
||||
|
||||
Assert.NotNull(listDeRegion);
|
||||
Assert.True(listDeRegion.Results.Count > 0);
|
||||
Assert.Equal(1, listDeRegion.Page);
|
||||
|
||||
// At least one title should differ
|
||||
Assert.True(listDe.Results.Any(s => listDeRegion.Results.Any(x => x.Title != s.Title)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
Loading…
x
Reference in New Issue
Block a user