record dvd season/episode numbers

This commit is contained in:
Luke Pulverenti 2013-12-08 13:07:45 -05:00
parent b595814254
commit fd0a7cb140
4 changed files with 92 additions and 1 deletions

View File

@ -40,6 +40,17 @@ namespace MediaBrowser.Controller.Entities.TV
public int? AirsAfterSeasonNumber { get; set; }
public int? AirsBeforeEpisodeNumber { get; set; }
/// <summary>
/// Gets or sets the DVD season number.
/// </summary>
/// <value>The DVD season number.</value>
public int? DvdSeasonNumber { get; set; }
/// <summary>
/// Gets or sets the DVD episode number.
/// </summary>
/// <value>The DVD episode number.</value>
public int? DvdEpisodeNumber { get; set; }
/// <summary>
/// We want to group into series not show individually in an index
/// </summary>

View File

@ -92,6 +92,16 @@ namespace MediaBrowser.Providers.Savers
builder.Append("<SeasonNumber>" + SecurityElement.Escape(episode.ParentIndexNumber.Value.ToString(_usCulture)) + "</SeasonNumber>");
}
if (episode.DvdEpisodeNumber.HasValue)
{
builder.Append("<DVD_episodenumber>" + SecurityElement.Escape(episode.DvdEpisodeNumber.Value.ToString(_usCulture)) + "</DVD_episodenumber>");
}
if (episode.DvdSeasonNumber.HasValue)
{
builder.Append("<DVD_season>" + SecurityElement.Escape(episode.DvdSeasonNumber.Value.ToString(_usCulture)) + "</DVD_season>");
}
if (episode.PremiereDate.HasValue)
{
builder.Append("<FirstAired>" + SecurityElement.Escape(episode.PremiereDate.Value.ToString("yyyy-MM-dd")) + "</FirstAired>");
@ -113,7 +123,9 @@ namespace MediaBrowser.Providers.Savers
"EpisodeNumberEnd",
"airsafter_season",
"airsbefore_episode",
"airsbefore_season"
"airsbefore_season",
"DVD_episodenumber",
"DVD_season"
});
}

View File

@ -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();

View File

@ -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();