support nfo episode attributes

This commit is contained in:
Luke Pulverenti 2016-06-24 16:07:35 -04:00
parent 38ba821c50
commit 2d3522593e
2 changed files with 52 additions and 0 deletions

View File

@ -188,6 +188,48 @@ namespace MediaBrowser.XbmcMetadata.Parsers
break;
}
case "displayseason":
{
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))
{
if ((item.ParentIndexNumber ?? 0) == 0)
{
item.AirsBeforeSeasonNumber = rval;
}
}
}
break;
}
case "displayepisode":
{
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))
{
if ((item.ParentIndexNumber ?? 0) == 0)
{
item.AirsBeforeEpisodeNumber = rval;
}
}
}
break;
}
default:
base.FetchDataFromXmlNode(reader, itemResult);

View File

@ -72,11 +72,21 @@ namespace MediaBrowser.XbmcMetadata.Savers
{
writer.WriteElementString("airsbefore_episode", episode.AirsBeforeEpisodeNumber.Value.ToString(UsCulture));
}
if (episode.AirsBeforeEpisodeNumber.HasValue)
{
writer.WriteElementString("displayepisode", episode.AirsBeforeEpisodeNumber.Value.ToString(UsCulture));
}
if (episode.AirsBeforeSeasonNumber.HasValue)
{
writer.WriteElementString("airsbefore_season", episode.AirsBeforeSeasonNumber.Value.ToString(UsCulture));
}
var season = episode.AiredSeasonNumber;
if (season.HasValue)
{
writer.WriteElementString("displayseason", season.Value.ToString(UsCulture));
}
if (episode.DvdEpisodeNumber.HasValue)
{
writer.WriteElementString("DVD_episodenumber", episode.DvdEpisodeNumber.Value.ToString(UsCulture));