From bc2ff149b4cdbfc3424dda7634ed1d1f90f3d3b6 Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Tue, 17 Jan 2017 17:05:19 -0500 Subject: [PATCH] Maybe this will solve the error Couldn't refresh info for [tt2032572][USS Indianapolis: Men of Courage]: Object reference not set to an instance of an object --- .../MetadataSource/SkyHook/SkyHookProxy.cs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs index fa6665d2d..f32733553 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs @@ -152,19 +152,25 @@ namespace NzbDrone.Core.MetadataSource.SkyHook if (resource.videos != null) { - foreach(Video video in resource.videos.results) + foreach (Video video in resource.videos.results) { - if(video.type == "Trailer" && video.site == "YouTube") + if (video.type == "Trailer" && video.site == "YouTube") { - movie.YouTubeTrailerId = video.key; - break; + if (video.key != null) + { + movie.YouTubeTrailerId = video.key; + break; + } } } } - if (resource.production_companies != null && resource.production_companies.Count() > 0) + if (resource.production_companies != null) { - movie.Studio = resource.production_companies[0].name; + if (resource.production_companies.Any()) + { + movie.Studio = resource.production_companies[0].name; + } } return movie; @@ -345,25 +351,19 @@ namespace NzbDrone.Core.MetadataSource.SkyHook { imdbMovie.SortTitle = Parser.Parser.NormalizeTitle(result.title); imdbMovie.Title = result.title; - string titleSlug = ToUrlSlug(result.title); - imdbMovie.TitleSlug = titleSlug.ToLower().Replace(" ", "-"); + imdbMovie.TitleSlug = ToUrlSlug(result.title); if (result.release_date.IsNotNullOrWhiteSpace()) { 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.TitleSlug += "-" + imdbMovie.Year; imdbMovie.Images = new List(); imdbMovie.Overview = result.overview; try { - string url = result.poster_path; var imdbPoster = _configService.GetCoverForURL(result.poster_path, MediaCoverTypes.Poster); imdbMovie.Images.Add(imdbPoster); }