reading missing data for tv series, and populating series end date

This commit is contained in:
Luis Miguel Almánzar
2013-05-26 02:41:37 -04:00
parent c7805912a5
commit 97cce5ea59
3 changed files with 64 additions and 1 deletions

View File

@@ -108,6 +108,38 @@ namespace MediaBrowser.Controller.Extensions
return defaultString;
}
/// <summary>
/// Safes the get DateTime.
/// </summary>
/// <param name="doc">The doc.</param>
/// <param name="path">The path.</param>
/// <returns>System.DateTime.</returns>
public static DateTime? SafeGetDateTime(this XmlDocument doc, string path)
{
return SafeGetDateTime(doc, path, null);
}
/// <summary>
/// Safes the get DateTime.
/// </summary>
/// <param name="doc">The doc.</param>
/// <param name="path">The path.</param>
/// <param name="defaultDate">The default date.</param>
/// <returns>System.DateTime.</returns>
public static DateTime? SafeGetDateTime(this XmlDocument doc, string path, DateTime? defaultDate)
{
var rvalNode = doc.SelectSingleNode(path);
if (rvalNode != null)
{
var text = rvalNode.InnerText;
DateTime date;
if (DateTime.TryParse(text, out date))
return date;
}
return defaultDate;
}
/// <summary>
/// Safes the get string.
/// </summary>