From 79dc9f29d9bffae50a1fb24d8650d0ea73a73a45 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 17 Mar 2016 23:40:38 -0400 Subject: [PATCH] support additional id formats for movies and series --- .../Parsers/MovieNfoParser.cs | 21 +++++++++++---- .../Parsers/SeriesNfoParser.cs | 26 +++++++++++++++---- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs index 14c214f04..f27f0a191 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs @@ -36,13 +36,24 @@ namespace MediaBrowser.XbmcMetadata.Parsers switch (reader.Name) { case "id": - var id = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(id)) { - item.SetProviderId(MetadataProviders.Imdb, id); - } - break; + string imdbId = reader.GetAttribute("IMDB"); + string tmdbId = reader.GetAttribute("TMDB"); + if (string.IsNullOrWhiteSpace(imdbId)) + { + imdbId = reader.ReadElementContentAsString(); + } + if (!string.IsNullOrWhiteSpace(imdbId)) + { + item.SetProviderId(MetadataProviders.Imdb, imdbId); + } + if (!string.IsNullOrWhiteSpace(tmdbId)) + { + item.SetProviderId(MetadataProviders.Tmdb, tmdbId); + } + break; + } case "set": { var movie = item as Movie; diff --git a/MediaBrowser.XbmcMetadata/Parsers/SeriesNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/SeriesNfoParser.cs index 03dba56e0..d5b5428c0 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/SeriesNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/SeriesNfoParser.cs @@ -27,13 +27,29 @@ namespace MediaBrowser.XbmcMetadata.Parsers switch (reader.Name) { case "id": - string id = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(id)) { - item.SetProviderId(MetadataProviders.Tvdb, id); - } - break; + string imdbId = reader.GetAttribute("IMDB"); + string tmdbId = reader.GetAttribute("TMDB"); + string tvdbId = reader.GetAttribute("TVDB"); + if (string.IsNullOrWhiteSpace(tvdbId)) + { + tvdbId = reader.ReadElementContentAsString(); + } + if (!string.IsNullOrWhiteSpace(imdbId)) + { + item.SetProviderId(MetadataProviders.Imdb, imdbId); + } + if (!string.IsNullOrWhiteSpace(tmdbId)) + { + item.SetProviderId(MetadataProviders.Tmdb, tmdbId); + } + if (!string.IsNullOrWhiteSpace(tvdbId)) + { + item.SetProviderId(MetadataProviders.Tvcom, tvdbId); + } + break; + } case "airs_dayofweek": { item.AirDays = TVUtils.GetAirDays(reader.ReadElementContentAsString());