From 3907e2b168c51d4b360de7e3d5884ecdd33d719f Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Fri, 9 Jan 2015 19:03:44 +0100 Subject: [PATCH] Fixed: Xbmc metadata no longer fails if an episode has no rating. --- .../MetaData/Consumers/Xbmc/XbmcMetadata.cs | 13 +++++++++++-- .../MetadataSource/SkyHook/SkyHookProxy.cs | 5 +---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/NzbDrone.Core/MetaData/Consumers/Xbmc/XbmcMetadata.cs b/src/NzbDrone.Core/MetaData/Consumers/Xbmc/XbmcMetadata.cs index 6d21870bd..159ed22e4 100644 --- a/src/NzbDrone.Core/MetaData/Consumers/Xbmc/XbmcMetadata.cs +++ b/src/NzbDrone.Core/MetaData/Consumers/Xbmc/XbmcMetadata.cs @@ -171,7 +171,12 @@ public override MetadataFileResult SeriesMetadata(Series series) var tvShow = new XElement("tvshow"); tvShow.Add(new XElement("title", series.Title)); - tvShow.Add(new XElement("rating", series.Ratings.Value)); + + if (series.Ratings != null && series.Ratings.Votes > 0) + { + tvShow.Add(new XElement("rating", series.Ratings.Value)); + } + tvShow.Add(new XElement("plot", series.Overview)); tvShow.Add(new XElement("episodeguide", new XElement("url", episodeGuideUrl))); tvShow.Add(new XElement("episodeguideurl", episodeGuideUrl)); @@ -257,7 +262,11 @@ public override MetadataFileResult EpisodeMetadata(Series series, EpisodeFile ep } details.Add(new XElement("watched", "false")); - details.Add(new XElement("rating", episode.Ratings.Value)); + + if (episode.Ratings != null && episode.Ratings.Votes > 0) + { + details.Add(new XElement("rating", episode.Ratings.Value)); + } //Todo: get guest stars, writer and director //details.Add(new XElement("credits", tvdbEpisode.Writer.FirstOrDefault())); diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs index 365245265..b888a1d50 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs @@ -118,10 +118,7 @@ private static Episode MapEpisode(EpisodeResource oracleEpisode) episode.AirDate = oracleEpisode.AirDate; episode.AirDateUtc = oracleEpisode.AirDateUtc; - if (oracleEpisode.Rating != null) - { - episode.Ratings = MapRatings(oracleEpisode.Rating); - } + episode.Ratings = MapRatings(oracleEpisode.Rating); //Don't include series fanart images as episode screenshot if (oracleEpisode.Image != null)