2012-08-15 13:20:29 +00:00
|
|
|
|
using System.IO;
|
2012-07-12 06:55:27 +00:00
|
|
|
|
using System.Xml;
|
|
|
|
|
using MediaBrowser.Controller.Xml;
|
|
|
|
|
using MediaBrowser.TV.Entities;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.TV.Metadata
|
|
|
|
|
{
|
|
|
|
|
public class EpisodeXmlParser : BaseItemXmlParser<Episode>
|
|
|
|
|
{
|
2012-08-20 21:48:11 +00:00
|
|
|
|
protected override void FetchDataFromXmlNode(XmlReader reader, Episode 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 "filename":
|
|
|
|
|
{
|
2012-08-20 21:48:11 +00:00
|
|
|
|
string filename = reader.ReadElementContentAsString();
|
2012-07-12 06:55:27 +00:00
|
|
|
|
|
2012-07-20 02:22:44 +00:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(filename))
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
2012-08-11 19:21:06 +00:00
|
|
|
|
string seasonFolder = Path.GetDirectoryName(item.Path);
|
|
|
|
|
item.PrimaryImagePath = Path.Combine(seasonFolder, "metadata", filename);
|
2012-07-12 06:55:27 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2012-08-20 02:05:55 +00:00
|
|
|
|
case "SeasonNumber":
|
|
|
|
|
{
|
2012-08-20 21:48:11 +00:00
|
|
|
|
string number = reader.ReadElementContentAsString();
|
2012-08-20 02:05:55 +00:00
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(number))
|
|
|
|
|
{
|
|
|
|
|
item.ParentIndexNumber = int.Parse(number);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2012-07-20 02:22:44 +00:00
|
|
|
|
|
2012-08-20 02:05:55 +00:00
|
|
|
|
case "EpisodeNumber":
|
2012-07-20 02:22:44 +00:00
|
|
|
|
{
|
2012-08-20 21:48:11 +00:00
|
|
|
|
string number = reader.ReadElementContentAsString();
|
2012-08-20 02:05:55 +00:00
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(number))
|
|
|
|
|
{
|
|
|
|
|
item.IndexNumber = int.Parse(number);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2012-07-20 02:22:44 +00:00
|
|
|
|
}
|
2012-07-12 06:55:27 +00:00
|
|
|
|
|
|
|
|
|
case "EpisodeName":
|
2012-08-20 21:48:11 +00:00
|
|
|
|
item.Name = reader.ReadElementContentAsString();
|
2012-07-12 06:55:27 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2012-08-20 21:48:11 +00:00
|
|
|
|
base.FetchDataFromXmlNode(reader, item);
|
2012-07-12 06:55:27 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|