2012-07-12 06:55:27 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Xml;
|
|
|
|
|
using MediaBrowser.Controller.Xml;
|
|
|
|
|
using MediaBrowser.TV.Entities;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.TV.Metadata
|
|
|
|
|
{
|
|
|
|
|
public class EpisodeXmlParser : BaseItemXmlParser<Episode>
|
|
|
|
|
{
|
2012-07-14 20:45: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-07-20 19:03:11 +00:00
|
|
|
|
string filename = reader.ReadString();
|
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;
|
|
|
|
|
}
|
|
|
|
|
case "EpisodeNumber":
|
2012-07-20 19:03:11 +00:00
|
|
|
|
string number = reader.ReadString();
|
2012-07-20 02:22:44 +00:00
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(number))
|
|
|
|
|
{
|
|
|
|
|
item.IndexNumber = int.Parse(number);
|
|
|
|
|
}
|
2012-07-12 06:55:27 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "SeasonNumber":
|
2012-07-20 19:03:11 +00:00
|
|
|
|
item.SeasonNumber = reader.ReadString();
|
2012-07-12 06:55:27 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "EpisodeName":
|
2012-07-20 19:03:11 +00:00
|
|
|
|
item.Name = reader.ReadString();
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|