You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.TV/Metadata/SeriesXmlParser.cs

82 lines
2.7 KiB

13 years ago
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)
13 years ago
{
switch (reader.Name)
13 years ago
{
case "id":
item.TvdbId = reader.ReadString();
13 years ago
break;
case "Airs_DayOfWeek":
{
string day = reader.ReadString();
if (!string.IsNullOrWhiteSpace(day))
{
if (day.Equals("Daily", StringComparison.OrdinalIgnoreCase))
{
item.AirDays = new DayOfWeek[] {
DayOfWeek.Sunday,
DayOfWeek.Monday,
DayOfWeek.Tuesday,
DayOfWeek.Wednesday,
DayOfWeek.Thursday,
DayOfWeek.Friday,
DayOfWeek.Saturday
};
}
else
{
item.AirDays = new DayOfWeek[] {
(DayOfWeek)Enum.Parse(typeof(DayOfWeek), day, true)
};
}
}
break;
}
case "Airs_Time":
item.AirTime = reader.ReadString();
break;
13 years ago
case "SeriesName":
item.Name = reader.ReadString();
13 years ago
break;
case "Status":
item.Status = reader.ReadString();
13 years ago
break;
case "Runtime":
{
string text = reader.ReadString();
if (!string.IsNullOrWhiteSpace(text))
13 years ago
{
int runtime;
if (int.TryParse(text.Split(' ')[0], out runtime))
{
item.RunTime = TimeSpan.FromMinutes(runtime);
}
}
break;
}
default:
base.FetchDataFromXmlNode(reader, item);
13 years ago
break;
}
}
}
}