You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.TV/Metadata/EpisodeXmlParser.cs

58 lines
1.9 KiB

using System.IO;
13 years ago
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)
13 years ago
{
switch (reader.Name)
13 years ago
{
case "filename":
{
string filename = reader.ReadElementContentAsString();
13 years ago
if (!string.IsNullOrWhiteSpace(filename))
13 years ago
{
string seasonFolder = Path.GetDirectoryName(item.Path);
item.PrimaryImagePath = Path.Combine(seasonFolder, "metadata", filename);
13 years ago
}
break;
}
case "SeasonNumber":
{
string number = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(number))
{
item.ParentIndexNumber = int.Parse(number);
}
break;
}
case "EpisodeNumber":
{
string number = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(number))
{
item.IndexNumber = int.Parse(number);
}
break;
}
13 years ago
case "EpisodeName":
item.Name = reader.ReadElementContentAsString();
13 years ago
break;
default:
base.FetchDataFromXmlNode(reader, item);
13 years ago
break;
}
}
}
}