From dd6a4eefe5b1ea65b284d07f2f5aed3527b66f24 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 12 Mar 2016 22:30:42 -0500 Subject: [PATCH] support single tmdb urls in nfo --- MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs index 30243ff57c..7362ee58f7 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs @@ -195,8 +195,20 @@ namespace MediaBrowser.XbmcMetadata.Parsers item.SetProviderId(MetadataProviders.Imdb, m.Value); } - // TODO: Support Tmdb + // Support Tmdb // http://www.themoviedb.org/movie/36557 + var srch = "themoviedb.org/movie/"; + var index = xml.IndexOf(srch, StringComparison.OrdinalIgnoreCase); + + if (index != -1) + { + var tmdbId = xml.Substring(index + srch.Length).TrimEnd('/'); + int value; + if (!string.IsNullOrWhiteSpace(tmdbId) && int.TryParse(tmdbId, NumberStyles.Any, CultureInfo.InvariantCulture, out value)) + { + item.SetProviderId(MetadataProviders.Tmdb, tmdbId); + } + } } protected virtual void FetchDataFromXmlNode(XmlReader reader, MetadataResult itemResult)