get movie ratings from imdb via omdb

pull/702/head
Luke Pulverenti 12 years ago
parent 6ad5c9fa71
commit 6b84095add

@ -575,6 +575,13 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <value>The community rating.</value>
public float? CommunityRating { get; set; }
/// <summary>
/// Gets or sets the community rating vote count.
/// </summary>
/// <value>The community rating vote count.</value>
public int VoteCount { get; set; }
/// <summary>
/// Gets or sets the run time ticks.
/// </summary>

@ -679,11 +679,14 @@ namespace MediaBrowser.Providers.Movies
float rating;
string voteAvg = movieData.vote_average.ToString(CultureInfo.InvariantCulture);
//tmdb appears to have unified their numbers to always report "7.3" regardless of country
// so I removed the culture-specific processing here because it was not working for other countries -ebr
if (float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out rating))
movie.CommunityRating = rating;
movie.VoteCount = movieData.vote_count;
//release date and certification are retrieved based on configured country and we fall back on US if not there and to minimun release date if still no match
if (movieData.releases != null && movieData.releases.countries != null)
{

@ -15,7 +15,7 @@ namespace MediaBrowser.Providers.Movies
{
public class OpenMovieDatabaseProvider : BaseMetadataProvider
{
private readonly SemaphoreSlim _resourcePool = new SemaphoreSlim(2, 2);
private readonly SemaphoreSlim _resourcePool = new SemaphoreSlim(1, 1);
/// <summary>
/// Gets the json serializer.
@ -157,6 +157,24 @@ namespace MediaBrowser.Providers.Movies
item.CriticRating = tomatoMeter;
}
int voteCount;
if (!string.IsNullOrEmpty(result.imdbVotes)
&& int.TryParse(result.imdbVotes, NumberStyles.Integer, UsCulture, out voteCount)
&& voteCount >= 0)
{
item.VoteCount = voteCount;
}
float imdbRating;
if (!string.IsNullOrEmpty(result.imdbRating)
&& float.TryParse(result.imdbRating, NumberStyles.Number, UsCulture, out imdbRating)
&& imdbRating >= 0)
{
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))

@ -27,11 +27,6 @@ namespace MediaBrowser.Providers.TV
/// </summary>
class RemoteSeriesProvider : BaseMetadataProvider, IDisposable
{
/// <summary>
/// The _provider manager
/// </summary>
private readonly IProviderManager _providerManager;
/// <summary>
/// The tv db
/// </summary>
@ -60,10 +55,9 @@ namespace MediaBrowser.Providers.TV
/// <param name="httpClient">The HTTP client.</param>
/// <param name="logManager">The log manager.</param>
/// <param name="configurationManager">The configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
/// <param name="zipClient">The zip client.</param>
/// <exception cref="System.ArgumentNullException">httpClient</exception>
public RemoteSeriesProvider(IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager, IZipClient zipClient)
public RemoteSeriesProvider(IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IZipClient zipClient)
: base(logManager, configurationManager)
{
if (httpClient == null)
@ -71,7 +65,6 @@ namespace MediaBrowser.Providers.TV
throw new ArgumentNullException("httpClient");
}
HttpClient = httpClient;
_providerManager = providerManager;
_zipClient = zipClient;
Current = this;
}

Loading…
Cancel
Save