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.
68 lines
2.2 KiB
68 lines
2.2 KiB
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)
|
|
{
|
|
switch (reader.Name)
|
|
{
|
|
case "filename":
|
|
{
|
|
string filename = reader.ReadString();
|
|
|
|
if (!string.IsNullOrWhiteSpace(filename))
|
|
{
|
|
string metadataFolder = Path.GetDirectoryName(item.Path);
|
|
item.PrimaryImagePath = Path.Combine(metadataFolder, filename);
|
|
}
|
|
break;
|
|
}
|
|
case "EpisodeNumber":
|
|
string number = reader.ReadString();
|
|
|
|
if (!string.IsNullOrWhiteSpace(number))
|
|
{
|
|
item.IndexNumber = int.Parse(number);
|
|
}
|
|
break;
|
|
|
|
case "SeasonNumber":
|
|
item.SeasonNumber = reader.ReadString();
|
|
break;
|
|
|
|
case "EpisodeName":
|
|
item.Name = reader.ReadString();
|
|
break;
|
|
|
|
case "FirstAired":
|
|
{
|
|
string firstAired = reader.ReadString();
|
|
|
|
if (!string.IsNullOrWhiteSpace(firstAired))
|
|
{
|
|
DateTime airDate;
|
|
|
|
if (DateTime.TryParse(firstAired, out airDate) && airDate.Year > 1850)
|
|
{
|
|
item.PremiereDate = airDate;
|
|
item.ProductionYear = airDate.Year;
|
|
}
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
default:
|
|
base.FetchDataFromXmlNode(reader, item);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|