diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index 9fc4bb3d0..a244b71df 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 20f60586c..08d8df21f 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 special season number. + /// Gets or sets the DVD season number. /// - /// The special season number. - public int? SpecialSeasonNumber { get; set; } + /// The DVD season number. + public int? DvdSeasonNumber { get; set; } + /// + /// Gets or sets the DVD episode number. + /// + /// 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 b6ad6b11c..b17ef6ebb 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 56b06f490..74d54a391 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 d80985fe1..4cf7c79da 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 ba9dd170d..6e8c9d3eb 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)