jellyfin/MediaBrowser.TV/Metadata/EpisodeXmlParser.cs

45 lines
1.4 KiB
C#
Raw Normal View History

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>
{
protected override void FetchDataFromXmlNode(XmlReader reader, Episode item)
2012-07-12 06:55:27 +00:00
{
switch (reader.Name)
2012-07-12 06:55:27 +00:00
{
case "filename":
{
string filename = reader.ReadString();
2012-07-12 06:55:27 +00:00
if (!string.IsNullOrWhiteSpace(filename))
2012-07-12 06:55:27 +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":
string number = reader.ReadString();
if (!string.IsNullOrWhiteSpace(number))
{
item.IndexNumber = int.Parse(number);
}
2012-07-12 06:55:27 +00:00
break;
case "EpisodeName":
item.Name = reader.ReadString();
2012-07-12 06:55:27 +00:00
break;
default:
base.FetchDataFromXmlNode(reader, item);
2012-07-12 06:55:27 +00:00
break;
}
}
}
}