From d4d2e854869e7cc34965a38f6248a364c06974e0 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Sat, 18 Aug 2012 10:31:48 -0400 Subject: [PATCH] Added support for RunningTime in metadata --- .../Xml/BaseItemXmlParser.cs | 27 ++++++++++++++++--- MediaBrowser.TV/Metadata/SeriesXmlParser.cs | 16 ----------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/MediaBrowser.Controller/Xml/BaseItemXmlParser.cs b/MediaBrowser.Controller/Xml/BaseItemXmlParser.cs index de00adbef..eabbae869 100644 --- a/MediaBrowser.Controller/Xml/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Xml/BaseItemXmlParser.cs @@ -129,6 +129,22 @@ namespace MediaBrowser.Controller.Xml item.CustomRating = reader.ReadString(); break; + case "Runtime": + case "RunningTime": + { + string text = reader.ReadString(); + + if (!string.IsNullOrWhiteSpace(text)) + { + int runtime; + if (int.TryParse(text.Split(' ')[0], out runtime)) + { + item.RunTimeTicks = TimeSpan.FromMinutes(runtime).Ticks; + } + } + break; + } + case "Genre": { var genres = (item.Genres ?? new string[] { }).ToList(); @@ -184,10 +200,15 @@ namespace MediaBrowser.Controller.Xml case "ProductionYear": { - int ProductionYear; - if (int.TryParse(reader.ReadString(), out ProductionYear) && ProductionYear > 1850) + string val = reader.ReadString(); + + if (!string.IsNullOrWhiteSpace(val)) { - item.ProductionYear = ProductionYear; + int ProductionYear; + if (int.TryParse(val, out ProductionYear) && ProductionYear > 1850) + { + item.ProductionYear = ProductionYear; + } } break; diff --git a/MediaBrowser.TV/Metadata/SeriesXmlParser.cs b/MediaBrowser.TV/Metadata/SeriesXmlParser.cs index 8cb828355..c306c6249 100644 --- a/MediaBrowser.TV/Metadata/SeriesXmlParser.cs +++ b/MediaBrowser.TV/Metadata/SeriesXmlParser.cs @@ -61,22 +61,6 @@ namespace MediaBrowser.TV.Metadata item.Status = reader.ReadString(); break; - case "Runtime": - { - string text = reader.ReadString(); - - if (!string.IsNullOrWhiteSpace(text)) - { - - int runtime; - if (int.TryParse(text.Split(' ')[0], out runtime)) - { - item.RunTimeTicks = TimeSpan.FromMinutes(runtime).Ticks; - } - } - break; - } - default: base.FetchDataFromXmlNode(reader, item); break;