From 207280197dc3783c72b5e27de8009722440ce767 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 8 Dec 2013 15:33:24 -0500 Subject: [PATCH] added more episode values to metadata editor --- MediaBrowser.Api/ItemUpdateService.cs | 10 ++++++++++ MediaBrowser.Model/Dto/BaseItemDto.cs | 15 ++++++++++++--- MediaBrowser.Providers/TV/EpisodeXmlParser.cs | 17 +++++++++-------- MediaBrowser.Providers/TV/SeriesPostScanTask.cs | 2 +- .../TV/TvdbEpisodeProvider.cs | 14 ++++++-------- .../Dto/DtoService.cs | 7 ++++++- 6 files changed, 44 insertions(+), 21 deletions(-) diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index 9fc4bb3d04..a244b71df5 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -271,6 +271,16 @@ namespace MediaBrowser.Api item.Overview = request.Overview; item.Genres = request.Genres; + var episode = item as Episode; + if (episode != null) + { + episode.DvdSeasonNumber = request.DvdSeasonNumber; + episode.DvdEpisodeNumber = request.DvdEpisodeNumber; + episode.AirsAfterSeasonNumber = request.AirsAfterSeasonNumber; + episode.AirsBeforeEpisodeNumber = request.AirsBeforeEpisodeNumber; + episode.AirsBeforeSeasonNumber = request.AirsBeforeSeasonNumber; + } + var hasTags = item as IHasTags; if (hasTags != null) { diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index 20f60586c1..08d8df21f6 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -30,11 +30,20 @@ namespace MediaBrowser.Model.Dto /// The date created. public DateTime? DateCreated { get; set; } + public int? AirsBeforeSeasonNumber { get; set; } + public int? AirsAfterSeasonNumber { get; set; } + public int? AirsBeforeEpisodeNumber { get; set; } + + /// + /// Gets or sets the DVD season number. + /// + /// The DVD season number. + public int? DvdSeasonNumber { get; set; } /// - /// Gets or sets the special season number. + /// Gets or sets the DVD episode number. /// - /// The special season number. - public int? SpecialSeasonNumber { get; set; } + /// The DVD episode number. + public int? DvdEpisodeNumber { get; set; } /// /// Gets or sets the name of the sort. diff --git a/MediaBrowser.Providers/TV/EpisodeXmlParser.cs b/MediaBrowser.Providers/TV/EpisodeXmlParser.cs index b6ad6b11c4..b17ef6ebb8 100644 --- a/MediaBrowser.Providers/TV/EpisodeXmlParser.cs +++ b/MediaBrowser.Providers/TV/EpisodeXmlParser.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities.TV; +using System; +using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Logging; @@ -40,7 +41,7 @@ namespace MediaBrowser.Providers.TV } private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); - + /// /// Fetches the data from XML node. /// @@ -148,11 +149,11 @@ namespace MediaBrowser.Providers.TV if (!string.IsNullOrWhiteSpace(number)) { - int num; + float num; - if (int.TryParse(number, out num)) + if (float.TryParse(number, NumberStyles.Any, UsCulture, out num)) { - item.DvdEpisodeNumber = num; + item.DvdEpisodeNumber = Convert.ToInt32(num); } } break; @@ -164,11 +165,11 @@ namespace MediaBrowser.Providers.TV if (!string.IsNullOrWhiteSpace(number)) { - int num; + float num; - if (int.TryParse(number, out num)) + if (float.TryParse(number, NumberStyles.Any, UsCulture, out num)) { - item.DvdSeasonNumber = num; + item.DvdSeasonNumber = Convert.ToInt32(num); } } break; diff --git a/MediaBrowser.Providers/TV/SeriesPostScanTask.cs b/MediaBrowser.Providers/TV/SeriesPostScanTask.cs index 56b06f4906..74d54a3914 100644 --- a/MediaBrowser.Providers/TV/SeriesPostScanTask.cs +++ b/MediaBrowser.Providers/TV/SeriesPostScanTask.cs @@ -225,7 +225,7 @@ namespace MediaBrowser.Providers.TV foreach (var tuple in episodeLookup) { - if (tuple.Item1 <= 0) + if (tuple.Item1 < 0) { // Ignore season zeros continue; diff --git a/MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs index d80985fe1a..4cf7c79da9 100644 --- a/MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs @@ -410,12 +410,11 @@ namespace MediaBrowser.Providers.TV if (!string.IsNullOrWhiteSpace(val)) { - int rval; + float num; - // int.TryParse is local aware, so it can be probamatic, force us culture - if (int.TryParse(val, NumberStyles.Integer, _usCulture, out rval)) + if (float.TryParse(val, NumberStyles.Any, _usCulture, out num)) { - item.DvdEpisodeNumber = rval; + item.DvdEpisodeNumber = Convert.ToInt32(num); } } @@ -428,12 +427,11 @@ namespace MediaBrowser.Providers.TV if (!string.IsNullOrWhiteSpace(val)) { - int rval; + float num; - // int.TryParse is local aware, so it can be probamatic, force us culture - if (int.TryParse(val, NumberStyles.Integer, _usCulture, out rval)) + if (float.TryParse(val, NumberStyles.Any, _usCulture, out num)) { - item.DvdSeasonNumber = rval; + item.DvdSeasonNumber = Convert.ToInt32(num); } } diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index ba9dd170df..6e8c9d3ebe 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -1061,7 +1061,12 @@ namespace MediaBrowser.Server.Implementations.Dto if (episode != null) { dto.IndexNumberEnd = episode.IndexNumberEnd; - dto.SpecialSeasonNumber = episode.AirsAfterSeasonNumber ?? episode.AirsBeforeSeasonNumber; + + dto.DvdSeasonNumber = episode.DvdSeasonNumber; + dto.DvdEpisodeNumber = episode.DvdEpisodeNumber; + dto.AirsAfterSeasonNumber = episode.AirsAfterSeasonNumber; + dto.AirsBeforeEpisodeNumber = episode.AirsBeforeEpisodeNumber; + dto.AirsBeforeSeasonNumber = episode.AirsBeforeSeasonNumber; var seasonId = episode.SeasonId; if (seasonId.HasValue)