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>
|
|
|
|
|
{
|
2012-07-14 20:45:11 +00:00
|
|
|
|
protected override void FetchDataFromXmlNode(XmlReader reader, Series item)
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
2012-07-14 20:45:11 +00:00
|
|
|
|
switch (reader.Name)
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
|
|
|
|
case "id":
|
2012-07-20 19:03:11 +00:00
|
|
|
|
item.TvdbId = reader.ReadString();
|
2012-07-12 06:55:27 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2012-07-20 14:47:39 +00:00
|
|
|
|
case "Airs_DayOfWeek":
|
2012-07-20 19:03:11 +00:00
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
2012-07-20 14:47:39 +00:00
|
|
|
|
|
|
|
|
|
case "Airs_Time":
|
2012-07-20 19:03:11 +00:00
|
|
|
|
item.AirTime = reader.ReadString();
|
2012-07-20 14:47:39 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2012-07-12 06:55:27 +00:00
|
|
|
|
case "SeriesName":
|
2012-07-20 19:03:11 +00:00
|
|
|
|
item.Name = reader.ReadString();
|
2012-07-12 06:55:27 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "Status":
|
2012-07-20 19:03:11 +00:00
|
|
|
|
item.Status = reader.ReadString();
|
2012-07-12 06:55:27 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "Runtime":
|
|
|
|
|
{
|
2012-07-20 19:03:11 +00:00
|
|
|
|
string text = reader.ReadString();
|
|
|
|
|
|
2012-07-20 02:22:44 +00:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(text))
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
int runtime;
|
|
|
|
|
if (int.TryParse(text.Split(' ')[0], out runtime))
|
|
|
|
|
{
|
2012-07-30 15:00:17 +00:00
|
|
|
|
item.RunTimeInSeconds = runtime * 60;
|
2012-07-12 06:55:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
2012-07-14 20:45:11 +00:00
|
|
|
|
base.FetchDataFromXmlNode(reader, item);
|
2012-07-12 06:55:27 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|