mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-22 10:06:40 +00:00
reading missing data for tv series, and populating series end date
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user