Parcourir la source

tvdb series provider now considers alias names

Thomas Gillen il y a 11 ans
Parent
commit
ef1dcd3423
1 fichiers modifiés avec 24 ajouts et 8 suppressions
  1. 24 8
      MediaBrowser.Providers/TV/RemoteSeriesProvider.cs

+ 24 - 8
MediaBrowser.Providers/TV/RemoteSeriesProvider.cs

@@ -1109,21 +1109,37 @@ namespace MediaBrowser.Providers.TV
                 var nodes = doc.SelectNodes("//Series");
                 var comparableName = GetComparableName(name);
                 if (nodes != null)
+                {
                     foreach (XmlNode node in nodes)
                     {
-                        var n = node.SelectSingleNode("./SeriesName");
-                        if (n != null && string.Equals(GetComparableName(n.InnerText), comparableName, StringComparison.OrdinalIgnoreCase))
+                        var titles = new List<string>();
+
+                        var nameNode = node.SelectSingleNode("./SeriesName");
+                        if (nameNode != null)
+                        {
+                            titles.Add(GetComparableName(nameNode.InnerText));
+                        }
+
+                        var aliasNode = node.SelectSingleNode("./AliasNames");
+                        if (aliasNode != null)
                         {
-                            n = node.SelectSingleNode("./seriesid");
-                            if (n != null)
-                                return n.InnerText;
+                            var alias = aliasNode.InnerText.Split('|').Select(GetComparableName);
+                            titles.AddRange(alias);
                         }
-                        else
+
+                        if (titles.Any(t => string.Equals(t, comparableName, StringComparison.OrdinalIgnoreCase)))
                         {
-                            if (n != null)
-                                Logger.Info("TVDb Provider - " + n.InnerText + " did not match " + comparableName);
+                            var id = node.SelectSingleNode("./seriesid");
+                            if (id != null)
+                                return id.InnerText;
+                        }
+
+                        foreach (var title in titles)
+                        {
+                            Logger.Info("TVDb Provider - " + title + " did not match " + comparableName);
                         }
                     }
+                }
             }
 
             // Try stripping off the year if it was supplied