Implement SxxExx EpisodeNum Processing (#1009)

**Changes**
Implement and use SxxExx Episode numbering system from guide data if available.

**Issues**
Fixes #1008
This commit is contained in:
Daniel Widrick 2019-03-03 06:46:03 -05:00 committed by Bond-009
parent c328417d29
commit 5982cdad90

View File

@ -495,9 +495,7 @@ namespace Emby.XmlTv.Classes
ParseMovieDbSystem(reader, result); ParseMovieDbSystem(reader, result);
break; break;
case "SxxExx": case "SxxExx":
// TODO ParseSxxExxSystem(reader, result);
// <episode-num system="SxxExx">S03E12</episode-num>
reader.Skip();
break; break;
default: // Handles empty string and nulls default: // Handles empty string and nulls
reader.Skip(); reader.Skip();
@ -505,6 +503,29 @@ namespace Emby.XmlTv.Classes
} }
} }
public void ParseSxxExxSystem(XmlReader reader, XmlTvProgram result)
{
// <episode-num system="SxxExx">S012E32</episode-num>
var value = reader.ReadElementContentAsString();
var res = Regex.Match(value, "s([0-9]+)e([0-9]+)", RegexOptions.IgnoreCase);
if (res.Success)
{
int parsedInt;
if (int.TryParse(res.Groups[1].Value, out parsedInt))
{
result.Episode.Series = parsedInt;
}
if (int.TryParse(res.Groups[2].Value, out parsedInt))
{
result.Episode.Episode = parsedInt;
}
}
}
public void ParseMovieDbSystem(XmlReader reader, XmlTvProgram result) public void ParseMovieDbSystem(XmlReader reader, XmlTvProgram result)
{ {
// <episode-num system="thetvdb.com">series/248841</episode-num> // <episode-num system="thetvdb.com">series/248841</episode-num>