From 5a0f02007fa26632579ee4d4879b384bff282ded Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Fri, 28 Apr 2017 14:14:02 +0200 Subject: [PATCH] Added trailer links to the discovery page. --- .../MetadataSource/SkyHook/Resource/TMDBResources.cs | 2 ++ src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs | 9 +++++++++ src/UI/AddMovies/SearchResultViewTemplate.hbs | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/TMDBResources.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/TMDBResources.cs index f7bb98909..b3aa65ac2 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/TMDBResources.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/TMDBResources.cs @@ -34,6 +34,8 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource public int vote_count { get; set; } public bool video { get; set; } public float vote_average { get; set; } + public string trailer_key { get; set; } + public string trailer_site { get; set; } } diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs index 0286082c1..c656c02a6 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs @@ -591,6 +591,15 @@ namespace NzbDrone.Core.MetadataSource.SkyHook _logger.Debug(result); } + if (result.trailer_key.IsNotNullOrWhiteSpace() && result.trailer_site.IsNotNullOrWhiteSpace()) + { + if (result.trailer_site == "youtube") + { + imdbMovie.YouTubeTrailerId = result.trailer_key; + } + + } + return imdbMovie; } catch (Exception e) diff --git a/src/UI/AddMovies/SearchResultViewTemplate.hbs b/src/UI/AddMovies/SearchResultViewTemplate.hbs index 65a8dab46..cf58e5df1 100644 --- a/src/UI/AddMovies/SearchResultViewTemplate.hbs +++ b/src/UI/AddMovies/SearchResultViewTemplate.hbs @@ -27,6 +27,12 @@ In Cinemas {{/if_eq}} {{ratings.value}} + + {{#if youTubeTrailerId}} + + Trailer + + {{/if}}