jellyfin-server/MediaBrowser.TV/Metadata/EpisodeXmlParser.cs

50 lines
1.5 KiB
C#
Raw Normal View History

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>
{
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 "SeasonNumber":
item.SeasonNumber = reader.ReadString();
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;
}
}
}
}