mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-07 10:14:13 -04:00
TheMovieDB: Handling year search/get
This commit is contained in:
parent
bb3e912ffa
commit
6632ac5f1b
@ -95,7 +95,8 @@ namespace Kyoo.TheMovieDb
|
|||||||
{
|
{
|
||||||
if (!show.TryGetID(Provider.Slug, out int id))
|
if (!show.TryGetID(Provider.Slug, out int id))
|
||||||
{
|
{
|
||||||
Show found = (await _SearchShows(show.Title ?? show.Slug)).FirstOrDefault();
|
Show found = (await _SearchShows(show.Title ?? show.Slug, show.StartAir?.Year))
|
||||||
|
.FirstOrDefault(x => x.IsMovie == show.IsMovie);
|
||||||
if (found?.TryGetID(Provider.Slug, out id) != true)
|
if (found?.TryGetID(Provider.Slug, out id) != true)
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
@ -228,11 +229,12 @@ namespace Kyoo.TheMovieDb
|
|||||||
/// Search for a show using it's name as a query.
|
/// Search for a show using it's name as a query.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="query">The query to search for</param>
|
/// <param name="query">The query to search for</param>
|
||||||
|
/// <param name="year">The year in witch the show has aired.</param>
|
||||||
/// <returns>A list of shows containing metadata from TheMovieDb</returns>
|
/// <returns>A list of shows containing metadata from TheMovieDb</returns>
|
||||||
private async Task<ICollection<Show>> _SearchShows(string query)
|
private async Task<ICollection<Show>> _SearchShows(string query, int? year = null)
|
||||||
{
|
{
|
||||||
TMDbClient client = new(_apiKey.Value.ApiKey);
|
TMDbClient client = new(_apiKey.Value.ApiKey);
|
||||||
return (await client.SearchMultiAsync(query))
|
return (await client.SearchMultiAsync(query, year: year ?? 0))
|
||||||
.Results
|
.Results
|
||||||
.Select(x =>
|
.Select(x =>
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user