Merge remote-tracking branch 'refs/remotes/galli-leo/develop' into develop

This commit is contained in:
Tim Turner 2017-01-09 17:26:25 -05:00
commit 6016948329
4 changed files with 36 additions and 9 deletions

View File

@ -24,13 +24,15 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
private readonly IHttpRequestBuilderFactory _requestBuilder;
private readonly IHttpRequestBuilderFactory _movieBuilder;
private readonly ITmdbConfigService _configService;
private readonly IMovieService _movieService;
public SkyHookProxy(IHttpClient httpClient, ISonarrCloudRequestBuilder requestBuilder, ITmdbConfigService configService, Logger logger)
public SkyHookProxy(IHttpClient httpClient, ISonarrCloudRequestBuilder requestBuilder, ITmdbConfigService configService, IMovieService movieService, Logger logger)
{
_httpClient = httpClient;
_requestBuilder = requestBuilder.SkyHookTvdb;
_movieBuilder = requestBuilder.TMDB;
_configService = configService;
_movieService = movieService;
_logger = logger;
}
@ -93,6 +95,13 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
movie.InCinemas = DateTime.Parse(resource.release_date);
movie.Year = movie.InCinemas.Value.Year;
var slugResult = _movieService.FindByTitleSlug(movie.TitleSlug);
if (slugResult != null)
{
_logger.Debug("Movie with this title slug already exists. Adding year...");
}
movie.TitleSlug += "-" + movie.Year.ToString();
movie.Images.Add(_configService.GetCoverForURL(resource.poster_path, MediaCoverTypes.Poster));//TODO: Update to load image specs from tmdb page!
movie.Images.Add(_configService.GetCoverForURL(resource.backdrop_path, MediaCoverTypes.Banner));
movie.Runtime = resource.runtime;
@ -320,6 +329,14 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
string titleSlug = result.title;
imdbMovie.TitleSlug = titleSlug.ToLower().Replace(" ", "-");
imdbMovie.Year = DateTime.Parse(result.release_date).Year;
var slugResult = _movieService.FindByTitleSlug(imdbMovie.TitleSlug);
if (slugResult != null)
{
_logger.Debug("Movie with this title slug already exists. Adding year...");
}
imdbMovie.TitleSlug += "-" + imdbMovie.Year.ToString();
imdbMovie.Images = new List<MediaCover.MediaCover>();
imdbMovie.Overview = result.overview;
try

View File

@ -13,6 +13,7 @@ namespace NzbDrone.Core.Tv
Movie FindByTitle(string cleanTitle);
Movie FindByTitle(string cleanTitle, int year);
Movie FindByImdbId(string imdbid);
Movie FindByTitleSlug(string slug);
List<Movie> GetMoviesByFileId(int fileId);
void SetFileId(int fileId, int movieId);
}
@ -114,5 +115,9 @@ namespace NzbDrone.Core.Tv
SetFields(new Movie { Id = episodeId, MovieFileId = fileId }, movie => movie.MovieFileId);
}
public Movie FindByTitleSlug(string slug)
{
return Query.Where(m => m.TitleSlug == slug).FirstOrDefault();
}
}
}

View File

@ -24,6 +24,7 @@ namespace NzbDrone.Core.Tv
Movie FindByTitle(string title);
Movie FindByTitle(string title, int year);
Movie FindByTitleInexact(string title);
Movie FindByTitleSlug(string slug);
Movie GetMovieByFileId(int fileId);
void DeleteMovie(int movieId, bool deleteFiles);
List<Movie> GetAllMovies();
@ -218,5 +219,10 @@ namespace NzbDrone.Core.Tv
{
return _movieRepository.GetMoviesByFileId(fileId).First();
}
public Movie FindByTitleSlug(string slug)
{
return _movieRepository.FindByTitleSlug(slug);
}
}
}

View File

@ -3,26 +3,25 @@
<dl class="dl-horizontal info">
<dt>Home page</dt>
<dd><a href="https://sonarr.tv/">sonarr.tv</a></dd>
<dd><a href="https://radarr.tdb/">radarr.tdb</a></dd>
<dt>Wiki</dt>
<dd><a href="https://wiki.sonarr.tv/">wiki.sonarr.tv</a></dd>
<dd><a href="https://wiki.radarr.tdb/">wiki.radarr.tdb</a></dd>
<dt>Forums</dt>
<!-- <dt>Forums</dt>
<dd><a href="https://forums.sonarr.tv/">forums.sonarr.tv</a></dd>
<dt>Twitter</dt>
<dd><a href="https://twitter.com/sonarrtv">@sonarrtv</a></dd>
<dt>IRC</dt>
<dd><a href="irc://irc.freenode.net/#sonarr">#sonarr on Freenode</a> or (<a href="http://webchat.freenode.net/?channels=#sonarr">webchat</a>)</dd>
<dd><a href="irc://irc.freenode.net/#sonarr">#sonarr on Freenode</a> or (<a href="http://webchat.freenode.net/?channels=#sonarr">webchat</a>)</dd>-->
<dt>Source</dt>
<dd><a href="https://github.com/Sonarr/Sonarr/">github.com/Sonarr/Sonarr</a></dd>
<dd><a href="https://github.com/galli-leo/Radarr/">github.com/galli-leo/Radarr</a></dd>
<dt>Feature Requests</dt>
<dd><a href="https://forums.sonarr.tv/">forums.sonarr.tv</a></dd>
<dd><a href="https://github.com/Sonarr/Sonarr/issues">github.com/Sonarr/Sonarr/issues</a> <b>(Please post issues on the forum first and not on github)</b></dd>
<!--<dd><a href="https://forums.sonarr.tv/">forums.sonarr.tv</a></dd>-->
<dd><a href="https://github.com/galli-leo/Radarr/issues">github.com/galli-leo/Radarr/issues</a></dd>
</dl>
</fieldset>