jellyfin-server/MediaBrowser.TV/Metadata/SeriesXmlParser.cs

48 lines
1.5 KiB
C#
Raw Normal View History

2012-07-12 06:55:27 +00:00
using System;
using System.Xml;
using MediaBrowser.Controller.Xml;
using MediaBrowser.TV.Entities;
namespace MediaBrowser.TV.Metadata
{
public class SeriesXmlParser : BaseItemXmlParser<Series>
{
protected override void FetchDataFromXmlNode(XmlReader reader, Series item)
2012-07-12 06:55:27 +00:00
{
switch (reader.Name)
2012-07-12 06:55:27 +00:00
{
case "id":
item.TvdbId = reader.ReadElementContentAsString() ?? string.Empty;
2012-07-12 06:55:27 +00:00
break;
case "SeriesName":
item.Name = reader.ReadElementContentAsString() ?? string.Empty;
2012-07-12 06:55:27 +00:00
break;
case "Status":
item.Status = reader.ReadElementContentAsString() ?? string.Empty;
2012-07-12 06:55:27 +00:00
break;
case "Runtime":
{
string text = reader.ReadElementContentAsString() ?? string.Empty;
if (!string.IsNullOrWhiteSpace(text))
2012-07-12 06:55:27 +00:00
{
int runtime;
if (int.TryParse(text.Split(' ')[0], out runtime))
{
item.RunTime = TimeSpan.FromMinutes(runtime);
}
}
break;
}
default:
base.FetchDataFromXmlNode(reader, item);
2012-07-12 06:55:27 +00:00
break;
}
}
}
}