diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-03 10:26:54 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-03 10:26:54 -0400 |
| commit | 35f755cce38b892293233556bf748c57f38a2170 (patch) | |
| tree | 941351cb47cff20334517a4f6d48ded1ead1135a | |
| parent | 765884efb44b4f1401dc5e0bc99f0c8e0055143c (diff) | |
fixes #511 - Get Imdb rating for tv series using Omdb
| -rw-r--r-- | MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs b/MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs index 326e112a85..c4a3318913 100644 --- a/MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs +++ b/MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs @@ -149,13 +149,25 @@ namespace MediaBrowser.Providers.Movies { var result = JsonSerializer.DeserializeFromStream<RootObject>(stream); - int tomatoMeter; - - if (!string.IsNullOrEmpty(result.tomatoMeter) - && int.TryParse(result.tomatoMeter, NumberStyles.Integer, UsCulture, out tomatoMeter) - && tomatoMeter >= 0) + // Seeing some bogus RT data on omdb for series, so filter it out here + // RT doesn't even have tv series + if (!(item is Series)) { - item.CriticRating = tomatoMeter; + int tomatoMeter; + + if (!string.IsNullOrEmpty(result.tomatoMeter) + && int.TryParse(result.tomatoMeter, NumberStyles.Integer, UsCulture, out tomatoMeter) + && tomatoMeter >= 0) + { + item.CriticRating = tomatoMeter; + } + + if (!string.IsNullOrEmpty(result.tomatoConsensus) + && !string.Equals(result.tomatoConsensus, "n/a", StringComparison.OrdinalIgnoreCase) + && !string.Equals(result.tomatoConsensus, "No consensus yet.", StringComparison.OrdinalIgnoreCase)) + { + item.CriticRatingSummary = result.tomatoConsensus; + } } int voteCount; @@ -175,13 +187,6 @@ namespace MediaBrowser.Providers.Movies { item.CommunityRating = imdbRating; } - - if (!string.IsNullOrEmpty(result.tomatoConsensus) - && !string.Equals(result.tomatoConsensus, "n/a", StringComparison.OrdinalIgnoreCase) - && !string.Equals(result.tomatoConsensus, "No consensus yet.", StringComparison.OrdinalIgnoreCase)) - { - item.CriticRatingSummary = result.tomatoConsensus; - } } data.LastRefreshStatus = ProviderRefreshStatus.Success; |
