diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index e9f250d2a..4e94c3942 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -40,6 +40,17 @@ namespace MediaBrowser.Controller.Entities.TV 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 DVD episode number. + /// + /// The DVD episode number. + public int? DvdEpisodeNumber { get; set; } + /// /// We want to group into series not show individually in an index /// diff --git a/MediaBrowser.Providers/Savers/EpisodeXmlSaver.cs b/MediaBrowser.Providers/Savers/EpisodeXmlSaver.cs index 35dd551f1..88b3af5be 100644 --- a/MediaBrowser.Providers/Savers/EpisodeXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/EpisodeXmlSaver.cs @@ -92,6 +92,16 @@ namespace MediaBrowser.Providers.Savers builder.Append("" + SecurityElement.Escape(episode.ParentIndexNumber.Value.ToString(_usCulture)) + ""); } + if (episode.DvdEpisodeNumber.HasValue) + { + builder.Append("" + SecurityElement.Escape(episode.DvdEpisodeNumber.Value.ToString(_usCulture)) + ""); + } + + if (episode.DvdSeasonNumber.HasValue) + { + builder.Append("" + SecurityElement.Escape(episode.DvdSeasonNumber.Value.ToString(_usCulture)) + ""); + } + if (episode.PremiereDate.HasValue) { builder.Append("" + SecurityElement.Escape(episode.PremiereDate.Value.ToString("yyyy-MM-dd")) + ""); @@ -113,7 +123,9 @@ namespace MediaBrowser.Providers.Savers "EpisodeNumberEnd", "airsafter_season", "airsbefore_episode", - "airsbefore_season" + "airsbefore_season", + "DVD_episodenumber", + "DVD_season" }); } diff --git a/MediaBrowser.Providers/TV/EpisodeXmlParser.cs b/MediaBrowser.Providers/TV/EpisodeXmlParser.cs index 5d970107e..b6ad6b11c 100644 --- a/MediaBrowser.Providers/TV/EpisodeXmlParser.cs +++ b/MediaBrowser.Providers/TV/EpisodeXmlParser.cs @@ -142,6 +142,38 @@ namespace MediaBrowser.Providers.TV break; } + case "DVD_episodenumber": + { + var number = reader.ReadElementContentAsString(); + + if (!string.IsNullOrWhiteSpace(number)) + { + int num; + + if (int.TryParse(number, out num)) + { + item.DvdEpisodeNumber = num; + } + } + break; + } + + case "DVD_season": + { + var number = reader.ReadElementContentAsString(); + + if (!string.IsNullOrWhiteSpace(number)) + { + int num; + + if (int.TryParse(number, out num)) + { + item.DvdSeasonNumber = num; + } + } + break; + } + case "airsbefore_episode": { var val = reader.ReadElementContentAsString(); diff --git a/MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs index 5d9f387fe..d80985fe1 100644 --- a/MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs @@ -404,6 +404,42 @@ namespace MediaBrowser.Providers.TV break; } + case "DVD_episodenumber": + { + var val = reader.ReadElementContentAsString(); + + if (!string.IsNullOrWhiteSpace(val)) + { + int rval; + + // int.TryParse is local aware, so it can be probamatic, force us culture + if (int.TryParse(val, NumberStyles.Integer, _usCulture, out rval)) + { + item.DvdEpisodeNumber = rval; + } + } + + break; + } + + case "DVD_season": + { + var val = reader.ReadElementContentAsString(); + + if (!string.IsNullOrWhiteSpace(val)) + { + int rval; + + // int.TryParse is local aware, so it can be probamatic, force us culture + if (int.TryParse(val, NumberStyles.Integer, _usCulture, out rval)) + { + item.DvdSeasonNumber = rval; + } + } + + break; + } + case "airsbefore_episode": { var val = reader.ReadElementContentAsString();