From 56a5b6ec899f4b5269697afca4543d2d06c1e621 Mon Sep 17 00:00:00 2001 From: Vlad Ilies Date: Sun, 15 Jan 2017 22:17:24 +0200 Subject: [PATCH] Added trailer link to movie links (#255) (#282) * added YouTubeTrailerId to movie model * db migration for new column * added videos to append_to_response for tmdb * increased height of .series-posters-item * new handlebar helper to build the trailer url --- src/NzbDrone.Api/Series/MovieResource.cs | 7 +++++-- .../119_add_youtube_trailer_id_table .cs | 21 +++++++++++++++++++ .../SkyHook/Resource/TMDBResources.cs | 18 ++++++++++++++++ .../MetadataSource/SkyHook/SkyHookProxy.cs | 14 ++++++++++++- src/NzbDrone.Core/NzbDrone.Core.csproj | 1 + src/NzbDrone.Core/Tv/Movie.cs | 1 + src/NzbDrone.Core/Tv/RefreshMovieService.cs | 1 + src/UI/Cells/MovieLinksTemplate.hbs | 5 +++++ src/UI/Handlebars/Helpers/Series.js | 4 ++++ src/UI/Movies/Details/InfoViewTemplate.hbs | 4 ++++ .../SeriesOverviewItemViewTemplate.hbs | 4 ++++ .../Posters/SeriesPostersItemViewTemplate.hbs | 4 +++- src/UI/Movies/movies.less | 4 ++-- 13 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 src/NzbDrone.Core/Datastore/Migration/119_add_youtube_trailer_id_table .cs diff --git a/src/NzbDrone.Api/Series/MovieResource.cs b/src/NzbDrone.Api/Series/MovieResource.cs index c0cc8d623..d791ba130 100644 --- a/src/NzbDrone.Api/Series/MovieResource.cs +++ b/src/NzbDrone.Api/Series/MovieResource.cs @@ -34,6 +34,7 @@ namespace NzbDrone.Api.Movie public string RemotePoster { get; set; } public int Year { get; set; } public bool HasFile { get; set; } + public string YouTubeTrailerId { get; set; } //View & Edit public string Path { get; set; } @@ -144,7 +145,8 @@ namespace NzbDrone.Api.Movie AddOptions = model.AddOptions, AlternativeTitles = model.AlternativeTitles, Ratings = model.Ratings, - MovieFile = movieFile + MovieFile = movieFile, + YouTubeTrailerId = model.YouTubeTrailerId }; } @@ -191,7 +193,8 @@ namespace NzbDrone.Api.Movie Added = resource.Added, AddOptions = resource.AddOptions, AlternativeTitles = resource.AlternativeTitles, - Ratings = resource.Ratings + Ratings = resource.Ratings, + YouTubeTrailerId = resource.YouTubeTrailerId }; } diff --git a/src/NzbDrone.Core/Datastore/Migration/119_add_youtube_trailer_id_table .cs b/src/NzbDrone.Core/Datastore/Migration/119_add_youtube_trailer_id_table .cs new file mode 100644 index 000000000..e975f3d9c --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/119_add_youtube_trailer_id_table .cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; +using System.Data; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(119)] + public class add_youtube_trailer_id : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Alter.Table("Movies").AddColumn("YouTubeTrailerId").AsString().Nullable(); + + } + + } +} diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/TMDBResources.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/TMDBResources.cs index c0987e04f..469e72776 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/TMDBResources.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/TMDBResources.cs @@ -66,6 +66,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource public int vote_count { get; set; } public AlternativeTitles alternative_titles { get; set; } public ReleaseDatesResource release_dates { get; set; } + public VideosResource videos { get; set; } } public class ReleaseDatesResource @@ -130,4 +131,21 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource public string iso_3166_1 { get; set; } public string title { get; set; } } + + public class VideosResource + { + public List