Adding first implementation of release_dates for movies.

This commit is contained in:
Leonardo Galli 2017-01-08 12:58:39 +01:00
parent 97095733dd
commit 55f4a81dee
6 changed files with 61 additions and 1 deletions

View File

@ -27,6 +27,7 @@ namespace NzbDrone.Api.Movie
public MovieStatusType Status { get; set; }
public string Overview { get; set; }
public DateTime? InCinemas { get; set; }
public DateTime? PhysicalRelease { get; set; }
public List<MediaCover> Images { get; set; }
public string Website { get; set; }
@ -87,6 +88,7 @@ namespace NzbDrone.Api.Movie
//AlternateTitles
SortTitle = model.SortTitle,
InCinemas = model.InCinemas,
PhysicalRelease = model.PhysicalRelease,
//TotalEpisodeCount
//EpisodeCount
//EpisodeFileCount
@ -134,6 +136,7 @@ namespace NzbDrone.Api.Movie
//AlternateTitles
SortTitle = resource.SortTitle,
InCinemas = resource.InCinemas,
PhysicalRelease = resource.PhysicalRelease,
//TotalEpisodeCount
//EpisodeCount
//EpisodeFileCount

View File

@ -0,0 +1,23 @@
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(110)]
public class add_phyiscal_release : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Alter.Table("Movies").AddColumn("PhysicalRelease").AsDateTime().Nullable();
}
}
}

View File

@ -61,6 +61,27 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
public float vote_average { get; set; }
public int vote_count { get; set; }
public AlternativeTitles alternative_titles { get; set; }
public ReleaseDatesResource release_dates { get; set; }
}
public class ReleaseDatesResource
{
public List<ReleaseDates> results { get; set; }
}
public class ReleaseDate
{
public string certification { get; set; }
public string iso_639_1 { get; set; }
public string note { get; set; }
public string release_date { get; set; }
public int type { get; set; }
}
public class ReleaseDates
{
public string iso_3166_1 { get; set; }
public List<ReleaseDate> release_dates { get; set; }
}
public class Belongs_To_Collection

View File

@ -70,7 +70,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
.SetSegment("route", "movie")
.SetSegment("id", TmdbId.ToString())
.SetSegment("secondaryRoute", "")
.AddQueryParam("append_to_response", "alternative_titles")
.AddQueryParam("append_to_response", "alternative_titles,release_dates")
.AddQueryParam("country", "US")
.Build();
@ -102,6 +102,17 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
movie.AlternativeTitles.Add(title.title);
}
foreach(ReleaseDates releaseDates in resource.release_dates.results)
{
foreach(ReleaseDate releaseDate in releaseDates.release_dates)
{
if (releaseDate.type == 5 || releaseDate.type == 4)
{
movie.PhysicalRelease = DateTime.Parse(releaseDate.release_date);
}
}
}
movie.Ratings = new Ratings();
movie.Ratings.Votes = resource.vote_count;
movie.Ratings.Value = (decimal)resource.vote_average;

View File

@ -286,6 +286,7 @@
<Compile Include="Datastore\Migration\098_remove_titans_of_tv.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Datastore\Migration\110_add_physical_release_to_table.cs" />
<Compile Include="Datastore\Migration\109_add_movie_formats_to_naming_config.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />

View File

@ -41,6 +41,7 @@ namespace NzbDrone.Core.Tv
public string RootFolderPath { get; set; }
public DateTime Added { get; set; }
public DateTime? InCinemas { get; set; }
public DateTime? PhysicalRelease { get; set; }
public LazyLoaded<Profile> Profile { get; set; }
public HashSet<int> Tags { get; set; }
public AddMovieOptions AddOptions { get; set; }