jellyfin/MediaBrowser.Controller/Providers/TV/EpisodeXmlParser.cs

57 lines
1.9 KiB
C#
Raw Normal View History

using MediaBrowser.Model.Entities.TV;
using System.IO;
2012-07-12 06:55:27 +00:00
using System.Xml;
namespace MediaBrowser.Controller.Providers.TV
2012-07-12 06:55:27 +00:00
{
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
{
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
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;
}
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-08-20 02:05:55 +00:00
case "EpisodeNumber":
{
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-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;
}
}
}
}