mirror of
https://github.com/Radarr/Radarr.git
synced 2025-04-24 06:27:08 -04:00
parent
6b743439eb
commit
1f72e1de74
3 changed files with 23 additions and 7 deletions
|
@ -1,13 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.MetadataSource.SkyHook;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common.Categories;
|
||||
|
||||
namespace NzbDrone.Core.Test.MetadataSource.SkyHook
|
||||
|
@ -20,6 +16,8 @@ namespace NzbDrone.Core.Test.MetadataSource.SkyHook
|
|||
public void Setup()
|
||||
{
|
||||
UseRealHttp();
|
||||
|
||||
Mocker.SetConstant<ITmdbConfigService>(Mocker.Resolve<TmdbConfigService>());
|
||||
}
|
||||
|
||||
[TestCase(11, "Star Wars")]
|
||||
|
|
|
@ -511,7 +511,19 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
|||
|
||||
var movieResults = response.Resource.results;
|
||||
|
||||
return movieResults.SelectList(MapMovie);
|
||||
return movieResults.SelectList(MapSearchResult);
|
||||
}
|
||||
|
||||
private Movie MapSearchResult(MovieResult result)
|
||||
{
|
||||
var movie = _movieService.FindByTmdbId(result.id);
|
||||
|
||||
if (movie == null)
|
||||
{
|
||||
movie = MapMovie(result);
|
||||
}
|
||||
|
||||
return movie;
|
||||
}
|
||||
|
||||
public Movie MapMovie(MovieResult result)
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace NzbDrone.Core.Movies
|
|||
Movie AddMovie(Movie newMovie);
|
||||
List<Movie> AddMovies(List<Movie> newMovies);
|
||||
Movie FindByImdbId(string imdbid);
|
||||
Movie FindByTmdbId(int tmdbid);
|
||||
Movie FindByTitle(string title);
|
||||
Movie FindByTitle(string title, int year);
|
||||
Movie FindByTitleInexact(string title, int? year);
|
||||
|
@ -237,6 +238,11 @@ namespace NzbDrone.Core.Movies
|
|||
return _movieRepository.FindByImdbId(imdbid);
|
||||
}
|
||||
|
||||
public Movie FindByTmdbId(int tmdbid)
|
||||
{
|
||||
return _movieRepository.FindByTmdbId(tmdbid);
|
||||
}
|
||||
|
||||
private List<Movie> FindByTitleInexactAll(string title)
|
||||
{
|
||||
// find any movie clean title within the provided release title
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue