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:
parent
c328417d29
commit
5982cdad90
|
@ -495,9 +495,7 @@ namespace Emby.XmlTv.Classes
|
|||
ParseMovieDbSystem(reader, result);
|
||||
break;
|
||||
case "SxxExx":
|
||||
// TODO
|
||||
// <episode-num system="SxxExx">S03E12</episode-num>
|
||||
reader.Skip();
|
||||
ParseSxxExxSystem(reader, result);
|
||||
break;
|
||||
default: // Handles empty string and nulls
|
||||
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)
|
||||
{
|
||||
// <episode-num system="thetvdb.com">series/248841</episode-num>
|
||||
|
|
Loading…
Reference in New Issue
Block a user