From 30d2b41fbb2f7c55db36eead05f5e8a9276ab030 Mon Sep 17 00:00:00 2001 From: Vlad Ilies Date: Mon, 16 Jan 2017 20:57:43 +0200 Subject: [PATCH] Added movie studio to movie details page (#262) * modified Movie model * db migration * ui template modification --- src/NzbDrone.Api/Series/MovieResource.cs | 7 +++++-- .../Migration/120_add_studio_to_table.cs | 20 +++++++++++++++++++ .../MetadataSource/SkyHook/SkyHookProxy.cs | 5 +++++ src/NzbDrone.Core/NzbDrone.Core.csproj | 1 + src/NzbDrone.Core/Tv/Movie.cs | 1 + src/NzbDrone.Core/Tv/RefreshMovieService.cs | 1 + src/UI/Movies/Details/InfoViewTemplate.hbs | 3 +++ 7 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 src/NzbDrone.Core/Datastore/Migration/120_add_studio_to_table.cs diff --git a/src/NzbDrone.Api/Series/MovieResource.cs b/src/NzbDrone.Api/Series/MovieResource.cs index d791ba130..66b47def1 100644 --- a/src/NzbDrone.Api/Series/MovieResource.cs +++ b/src/NzbDrone.Api/Series/MovieResource.cs @@ -35,6 +35,7 @@ namespace NzbDrone.Api.Movie public int Year { get; set; } public bool HasFile { get; set; } public string YouTubeTrailerId { get; set; } + public string Studio { get; set; } //View & Edit public string Path { get; set; } @@ -146,7 +147,8 @@ namespace NzbDrone.Api.Movie AlternativeTitles = model.AlternativeTitles, Ratings = model.Ratings, MovieFile = movieFile, - YouTubeTrailerId = model.YouTubeTrailerId + YouTubeTrailerId = model.YouTubeTrailerId, + Studio = model.Studio }; } @@ -194,7 +196,8 @@ namespace NzbDrone.Api.Movie AddOptions = resource.AddOptions, AlternativeTitles = resource.AlternativeTitles, Ratings = resource.Ratings, - YouTubeTrailerId = resource.YouTubeTrailerId + YouTubeTrailerId = resource.YouTubeTrailerId, + Studio = resource.Studio }; } diff --git a/src/NzbDrone.Core/Datastore/Migration/120_add_studio_to_table.cs b/src/NzbDrone.Core/Datastore/Migration/120_add_studio_to_table.cs new file mode 100644 index 000000000..823688c61 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/120_add_studio_to_table.cs @@ -0,0 +1,20 @@ +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(120)] + public class add_studio : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Alter.Table("Movies").AddColumn("Studio").AsString().Nullable(); + } + + } +} diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs index 55efffe74..4e8718944 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs @@ -162,6 +162,11 @@ namespace NzbDrone.Core.MetadataSource.SkyHook } } + if (resource.production_companies != null && resource.production_companies.Count() > 0) + { + movie.Studio = resource.production_companies[0].name; + } + return movie; } diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 87a4c28b2..e15d5d659 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -183,6 +183,7 @@ + diff --git a/src/NzbDrone.Core/Tv/Movie.cs b/src/NzbDrone.Core/Tv/Movie.cs index a96890e72..4c14a45d1 100644 --- a/src/NzbDrone.Core/Tv/Movie.cs +++ b/src/NzbDrone.Core/Tv/Movie.cs @@ -49,6 +49,7 @@ namespace NzbDrone.Core.Tv public int MovieFileId { get; set; } public List AlternativeTitles { get; set; } public string YouTubeTrailerId{ get; set; } + public string Studio { get; set; } public bool HasFile => MovieFileId > 0; diff --git a/src/NzbDrone.Core/Tv/RefreshMovieService.cs b/src/NzbDrone.Core/Tv/RefreshMovieService.cs index 3001bf953..a086cf3ec 100644 --- a/src/NzbDrone.Core/Tv/RefreshMovieService.cs +++ b/src/NzbDrone.Core/Tv/RefreshMovieService.cs @@ -85,6 +85,7 @@ namespace NzbDrone.Core.Tv movie.Year = movieInfo.Year; movie.PhysicalRelease = movieInfo.PhysicalRelease; movie.YouTubeTrailerId = movieInfo.YouTubeTrailerId; + movie.Studio = movieInfo.Studio; try { diff --git a/src/UI/Movies/Details/InfoViewTemplate.hbs b/src/UI/Movies/Details/InfoViewTemplate.hbs index 9c73ab5b1..70e190f28 100644 --- a/src/UI/Movies/Details/InfoViewTemplate.hbs +++ b/src/UI/Movies/Details/InfoViewTemplate.hbs @@ -6,6 +6,9 @@ {{network}} {{/if}} + {{#if studio}} + {{studio}} + {{/if}} {{runtime}} minutes {{path}}