Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
This commit is contained in:
commit
fbcca1eabf
|
@ -258,7 +258,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
// webm
|
// webm
|
||||||
if (videoCodec.Equals("libvpx", StringComparison.OrdinalIgnoreCase))
|
if (videoCodec.Equals("libvpx", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
args = "-quality realtime -speed 0 -qmin 0 -qmax 30 -profile:v 0 -slices 8";
|
args = "-speed 16 -quality good -profile:v 0 -slices 8";
|
||||||
}
|
}
|
||||||
|
|
||||||
// asf/wmv
|
// asf/wmv
|
||||||
|
|
|
@ -22,8 +22,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// Gets or sets the users 0-10 rating
|
/// Gets or sets the users 0-10 rating
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The rating.</value>
|
/// <value>The rating.</value>
|
||||||
/// <exception cref="System.ArgumentOutOfRangeException">A 0-10 rating is required for UserItemData.</exception>
|
/// <exception cref="System.ArgumentOutOfRangeException">Rating;A 0 to 10 rating is required for UserItemData.</exception>
|
||||||
/// <exception cref="System.InvalidOperationException">A 0-10 rating is required for UserItemData.</exception>
|
|
||||||
public float? Rating
|
public float? Rating
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -36,7 +35,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
if (value.Value < 0 || value.Value > 10)
|
if (value.Value < 0 || value.Value > 10)
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException("A 0-10 rating is required for UserItemData.");
|
throw new ArgumentOutOfRangeException("value", "A 0 to 10 rating is required for UserItemData.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,8 +116,8 @@
|
||||||
<Compile Include="Providers\IProviderManager.cs" />
|
<Compile Include="Providers\IProviderManager.cs" />
|
||||||
<Compile Include="Providers\MediaInfo\MediaEncoderHelpers.cs" />
|
<Compile Include="Providers\MediaInfo\MediaEncoderHelpers.cs" />
|
||||||
<Compile Include="Providers\MetadataProviderPriority.cs" />
|
<Compile Include="Providers\MetadataProviderPriority.cs" />
|
||||||
|
<Compile Include="Providers\Movies\OpenMovieDatabaseProvider.cs" />
|
||||||
<Compile Include="Providers\Movies\RottenTomatoesMovieProvider.cs" />
|
<Compile Include="Providers\Movies\RottenTomatoesMovieProvider.cs" />
|
||||||
<Compile Include="Providers\Movies\RottenTomatoesMovieReviewsProvider.cs" />
|
|
||||||
<Compile Include="Providers\Music\FanArtArtistByNameProvider.cs" />
|
<Compile Include="Providers\Music\FanArtArtistByNameProvider.cs" />
|
||||||
<Compile Include="Providers\Music\LastfmAlbumProvider.cs" />
|
<Compile Include="Providers\Music\LastfmAlbumProvider.cs" />
|
||||||
<Compile Include="Providers\Music\FanArtAlbumProvider.cs" />
|
<Compile Include="Providers\Music\FanArtAlbumProvider.cs" />
|
||||||
|
|
|
@ -148,7 +148,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="val">The val.</param>
|
/// <param name="val">The val.</param>
|
||||||
/// <returns>System.String[][].</returns>
|
/// <returns>System.String[][].</returns>
|
||||||
private string[] Split(string val)
|
private IEnumerable<string> Split(string val)
|
||||||
{
|
{
|
||||||
// Only use the comma as a delimeter if there are no slashes or pipes.
|
// Only use the comma as a delimeter if there are no slashes or pipes.
|
||||||
// We want to be careful not to split names that have commas in them
|
// We want to be careful not to split names that have commas in them
|
||||||
|
|
|
@ -7,21 +7,15 @@ using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers.Movies
|
namespace MediaBrowser.Controller.Providers.Movies
|
||||||
{
|
{
|
||||||
/// <summary>
|
public class OpenMovieDatabaseProvider : BaseMetadataProvider
|
||||||
/// Class RottenTomatoesMovieProvider
|
|
||||||
/// </summary>
|
|
||||||
public class RottenTomatoesMovieReviewsProvider : BaseMetadataProvider
|
|
||||||
{
|
{
|
||||||
// http://developer.rottentomatoes.com/iodocs
|
private readonly SemaphoreSlim _resourcePool = new SemaphoreSlim(1, 1);
|
||||||
|
|
||||||
private const string MoviesReviews = @"movies/{1}/reviews.json?review_type=top_critic&page_limit=10&page=1&country=us&apikey={0}";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the json serializer.
|
/// Gets the json serializer.
|
||||||
|
@ -35,14 +29,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <value>The HTTP client.</value>
|
/// <value>The HTTP client.</value>
|
||||||
protected IHttpClient HttpClient { get; private set; }
|
protected IHttpClient HttpClient { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
public OpenMovieDatabaseProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IHttpClient httpClient)
|
||||||
/// Initializes a new instance of the <see cref="RottenTomatoesMovieProvider"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="logManager">The log manager.</param>
|
|
||||||
/// <param name="configurationManager">The configuration manager.</param>
|
|
||||||
/// <param name="jsonSerializer">The json serializer.</param>
|
|
||||||
/// <param name="httpClient">The HTTP client.</param>
|
|
||||||
public RottenTomatoesMovieReviewsProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IHttpClient httpClient)
|
|
||||||
: base(logManager, configurationManager)
|
: base(logManager, configurationManager)
|
||||||
{
|
{
|
||||||
JsonSerializer = jsonSerializer;
|
JsonSerializer = jsonSerializer;
|
||||||
|
@ -57,7 +44,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "5";
|
return "6";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,15 +79,14 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||||
public override bool Supports(BaseItem item)
|
public override bool Supports(BaseItem item)
|
||||||
{
|
{
|
||||||
return false;
|
|
||||||
var trailer = item as Trailer;
|
var trailer = item as Trailer;
|
||||||
|
|
||||||
|
// Don't support local trailers
|
||||||
if (trailer != null)
|
if (trailer != null)
|
||||||
{
|
{
|
||||||
return !trailer.IsLocalTrailer;
|
return !trailer.IsLocalTrailer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't support local trailers
|
|
||||||
return item is Movie;
|
return item is Movie;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +122,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
||||||
{
|
{
|
||||||
// Refresh if rt id has changed
|
// Refresh if rt id has changed
|
||||||
if (providerInfo.Data != GetComparisonData(item.GetProviderId(MetadataProviders.RottenTomatoes)))
|
if (providerInfo.Data != GetComparisonData(item.GetProviderId(MetadataProviders.Imdb)))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -144,13 +130,8 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
return base.NeedsRefreshInternal(item, providerInfo);
|
return base.NeedsRefreshInternal(item, providerInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||||
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="force">if set to <c>true</c> [force].</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <returns>Task{System.Boolean}.</returns>
|
|
||||||
public override async Task<bool> FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken)
|
public override async Task<bool> FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
BaseProviderInfo data;
|
BaseProviderInfo data;
|
||||||
|
@ -161,76 +142,85 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
item.ProviderData[Id] = data;
|
item.ProviderData[Id] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rottenTomatoesId = item.GetProviderId(MetadataProviders.RottenTomatoes);
|
var imdbId = item.GetProviderId(MetadataProviders.Imdb);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(imdbId))
|
||||||
if (string.IsNullOrEmpty(rottenTomatoesId))
|
|
||||||
{
|
{
|
||||||
data.Data = GetComparisonData(rottenTomatoesId);
|
data.Data = GetComparisonData(imdbId);
|
||||||
data.LastRefreshStatus = ProviderRefreshStatus.Success;
|
data.LastRefreshStatus = ProviderRefreshStatus.Success;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var imdbParam = imdbId.StartsWith("tt", StringComparison.OrdinalIgnoreCase) ? imdbId : "tt" + imdbId;
|
||||||
|
|
||||||
|
var url = string.Format("http://www.omdbapi.com/?i={0}&tomatoes=true", imdbParam);
|
||||||
|
|
||||||
using (var stream = await HttpClient.Get(new HttpRequestOptions
|
using (var stream = await HttpClient.Get(new HttpRequestOptions
|
||||||
{
|
{
|
||||||
Url = GetMovieReviewsUrl(rottenTomatoesId),
|
Url = url,
|
||||||
ResourcePool = RottenTomatoesMovieProvider.Current.RottenTomatoesResourcePool,
|
ResourcePool = _resourcePool,
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
EnableResponseCache = true
|
EnableResponseCache = true
|
||||||
|
|
||||||
}).ConfigureAwait(false))
|
}).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
|
var result = JsonSerializer.DeserializeFromStream<RootObject>(stream);
|
||||||
|
|
||||||
var result = JsonSerializer.DeserializeFromStream<RTReviewList>(stream);
|
int tomatoMeter;
|
||||||
|
|
||||||
item.CriticReviews = result.reviews.Select(rtReview => new ItemReview
|
if (!string.IsNullOrEmpty(result.tomatoMeter) && int.TryParse(result.tomatoMeter, NumberStyles.Integer, UsCulture, out tomatoMeter))
|
||||||
{
|
{
|
||||||
ReviewerName = rtReview.critic,
|
item.CriticRating = tomatoMeter;
|
||||||
Publisher = rtReview.publication,
|
}
|
||||||
Date = DateTime.Parse(rtReview.date).ToUniversalTime(),
|
|
||||||
Caption = rtReview.quote,
|
|
||||||
Url = rtReview.links.review,
|
|
||||||
Likes = string.Equals(rtReview.freshness, "fresh", StringComparison.OrdinalIgnoreCase)
|
|
||||||
|
|
||||||
}).ToList();
|
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.Data = GetComparisonData(rottenTomatoesId);
|
data.Data = GetComparisonData(item.GetProviderId(MetadataProviders.Imdb));
|
||||||
data.LastRefreshStatus = ProviderRefreshStatus.Success;
|
data.LastRefreshStatus = ProviderRefreshStatus.Success;
|
||||||
SetLastRefreshed(item, DateTime.UtcNow);
|
SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utility functions to get the URL of the API calls
|
|
||||||
|
|
||||||
private string GetMovieReviewsUrl(string rtId)
|
protected class RootObject
|
||||||
{
|
{
|
||||||
return RottenTomatoesMovieProvider.BasicUrl + string.Format(MoviesReviews, RottenTomatoesMovieProvider.ApiKey, rtId);
|
public string Title { get; set; }
|
||||||
}
|
public string Year { get; set; }
|
||||||
|
public string Rated { get; set; }
|
||||||
// Data contract classes for use with the Rotten Tomatoes API
|
public string Released { get; set; }
|
||||||
|
public string Runtime { get; set; }
|
||||||
protected class RTReviewList
|
public string Genre { get; set; }
|
||||||
{
|
public string Director { get; set; }
|
||||||
public int total { get; set; }
|
public string Writer { get; set; }
|
||||||
public List<RTReview> reviews { get; set; }
|
public string Actors { get; set; }
|
||||||
}
|
public string Plot { get; set; }
|
||||||
|
public string Poster { get; set; }
|
||||||
protected class RTReview
|
public string imdbRating { get; set; }
|
||||||
{
|
public string imdbVotes { get; set; }
|
||||||
public string critic { get; set; }
|
public string imdbID { get; set; }
|
||||||
public string date { get; set; }
|
public string Type { get; set; }
|
||||||
public string freshness { get; set; }
|
public string tomatoMeter { get; set; }
|
||||||
public string publication { get; set; }
|
public string tomatoImage { get; set; }
|
||||||
public string quote { get; set; }
|
public string tomatoRating { get; set; }
|
||||||
public RTReviewLink links { get; set; }
|
public string tomatoReviews { get; set; }
|
||||||
public string original_score { get; set; }
|
public string tomatoFresh { get; set; }
|
||||||
}
|
public string tomatoRotten { get; set; }
|
||||||
|
public string tomatoConsensus { get; set; }
|
||||||
protected class RTReviewLink
|
public string tomatoUserMeter { get; set; }
|
||||||
{
|
public string tomatoUserRating { get; set; }
|
||||||
public string review { get; set; }
|
public string tomatoUserReviews { get; set; }
|
||||||
|
public string DVD { get; set; }
|
||||||
|
public string BoxOffice { get; set; }
|
||||||
|
public string Production { get; set; }
|
||||||
|
public string Website { get; set; }
|
||||||
|
public string Response { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,23 +17,18 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class RottenTomatoesMovieProvider
|
/// Class RottenTomatoesMovieProvider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class RottenTomatoesMovieProvider : BaseMetadataProvider
|
public class RottenTomatoesProvider : BaseMetadataProvider
|
||||||
{
|
{
|
||||||
// http://developer.rottentomatoes.com/iodocs
|
// http://developer.rottentomatoes.com/iodocs
|
||||||
/// <summary>
|
|
||||||
/// The API key
|
|
||||||
/// </summary>
|
|
||||||
internal const string ApiKey = "x9wjnvv39ntjmt9zs95nm7bg";
|
|
||||||
|
|
||||||
internal const string BasicUrl = @"http://api.rottentomatoes.com/api/public/v1.0/";
|
private const string MoviesReviews = @"movies/{1}/reviews.json?review_type=top_critic&page_limit=10&page=1&country=us&apikey={0}";
|
||||||
|
|
||||||
|
private const string ApiKey = "x9wjnvv39ntjmt9zs95nm7bg";
|
||||||
|
|
||||||
|
private const string BasicUrl = @"http://api.rottentomatoes.com/api/public/v1.0/";
|
||||||
private const string MovieImdb = @"movie_alias.json?id={1}&type=imdb&apikey={0}";
|
private const string MovieImdb = @"movie_alias.json?id={1}&type=imdb&apikey={0}";
|
||||||
|
|
||||||
internal static RottenTomatoesMovieProvider Current { get; private set; }
|
private readonly SemaphoreSlim _rottenTomatoesResourcePool = new SemaphoreSlim(1, 1);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The _rotten tomatoes resource pool
|
|
||||||
/// </summary>
|
|
||||||
internal readonly SemaphoreSlim RottenTomatoesResourcePool = new SemaphoreSlim(1, 1);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the json serializer.
|
/// Gets the json serializer.
|
||||||
|
@ -54,12 +49,11 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <param name="configurationManager">The configuration manager.</param>
|
/// <param name="configurationManager">The configuration manager.</param>
|
||||||
/// <param name="jsonSerializer">The json serializer.</param>
|
/// <param name="jsonSerializer">The json serializer.</param>
|
||||||
/// <param name="httpClient">The HTTP client.</param>
|
/// <param name="httpClient">The HTTP client.</param>
|
||||||
public RottenTomatoesMovieProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IHttpClient httpClient)
|
public RottenTomatoesProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IHttpClient httpClient)
|
||||||
: base(logManager, configurationManager)
|
: base(logManager, configurationManager)
|
||||||
{
|
{
|
||||||
JsonSerializer = jsonSerializer;
|
JsonSerializer = jsonSerializer;
|
||||||
HttpClient = httpClient;
|
HttpClient = httpClient;
|
||||||
Current = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -136,7 +130,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// Run after moviedb and xml providers
|
// Run after moviedb and xml providers
|
||||||
return MetadataProviderPriority.Third;
|
return MetadataProviderPriority.Last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +142,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||||
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
||||||
{
|
{
|
||||||
// Refresh if imdb id has changed
|
// Refresh if rt id has changed
|
||||||
if (providerInfo.Data != GetComparisonData(item.GetProviderId(MetadataProviders.Imdb)))
|
if (providerInfo.Data != GetComparisonData(item.GetProviderId(MetadataProviders.Imdb)))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -175,7 +169,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
}
|
}
|
||||||
|
|
||||||
var imdbId = item.GetProviderId(MetadataProviders.Imdb);
|
var imdbId = item.GetProviderId(MetadataProviders.Imdb);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(imdbId))
|
if (string.IsNullOrEmpty(imdbId))
|
||||||
{
|
{
|
||||||
data.Data = GetComparisonData(imdbId);
|
data.Data = GetComparisonData(imdbId);
|
||||||
|
@ -183,11 +177,54 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await FetchRottenTomatoesId(item, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
using (var stream = await HttpClient.Get(new HttpRequestOptions
|
||||||
|
{
|
||||||
|
Url = GetMovieReviewsUrl(item.GetProviderId(MetadataProviders.RottenTomatoes)),
|
||||||
|
ResourcePool = _rottenTomatoesResourcePool,
|
||||||
|
CancellationToken = cancellationToken,
|
||||||
|
EnableResponseCache = true
|
||||||
|
|
||||||
|
}).ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
|
||||||
|
var result = JsonSerializer.DeserializeFromStream<RTReviewList>(stream);
|
||||||
|
|
||||||
|
item.CriticReviews = result.reviews.Select(rtReview => new ItemReview
|
||||||
|
{
|
||||||
|
ReviewerName = rtReview.critic,
|
||||||
|
Publisher = rtReview.publication,
|
||||||
|
Date = DateTime.Parse(rtReview.date).ToUniversalTime(),
|
||||||
|
Caption = rtReview.quote,
|
||||||
|
Url = rtReview.links.review,
|
||||||
|
Likes = string.Equals(rtReview.freshness, "fresh", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
data.Data = GetComparisonData(item.GetProviderId(MetadataProviders.Imdb));
|
||||||
|
data.LastRefreshStatus = ProviderRefreshStatus.Success;
|
||||||
|
SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetches the rotten tomatoes id.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The item.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
private async Task FetchRottenTomatoesId(BaseItem item, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var imdbId = item.GetProviderId(MetadataProviders.Imdb);
|
||||||
|
|
||||||
// Have IMDB Id
|
// Have IMDB Id
|
||||||
using (var stream = await HttpClient.Get(new HttpRequestOptions
|
using (var stream = await HttpClient.Get(new HttpRequestOptions
|
||||||
{
|
{
|
||||||
Url = GetMovieImdbUrl(imdbId),
|
Url = GetMovieImdbUrl(imdbId),
|
||||||
ResourcePool = RottenTomatoesResourcePool,
|
ResourcePool = _rottenTomatoesResourcePool,
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
EnableResponseCache = true
|
EnableResponseCache = true
|
||||||
|
|
||||||
|
@ -201,23 +238,18 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
item.CriticRatingSummary = hit.critics_consensus;
|
item.CriticRatingSummary = hit.critics_consensus;
|
||||||
item.CriticRating = float.Parse(hit.ratings.critics_score);
|
item.CriticRating = float.Parse(hit.ratings.critics_score);
|
||||||
|
|
||||||
data.Data = GetComparisonData(hit.alternate_ids.imdb);
|
|
||||||
|
|
||||||
item.SetProviderId(MetadataProviders.Imdb, hit.alternate_ids.imdb);
|
|
||||||
item.SetProviderId(MetadataProviders.RottenTomatoes, hit.id);
|
item.SetProviderId(MetadataProviders.RottenTomatoes, hit.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data.Data = GetComparisonData(imdbId);
|
|
||||||
data.LastRefreshStatus = ProviderRefreshStatus.Success;
|
|
||||||
|
|
||||||
SetLastRefreshed(item, DateTime.UtcNow);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Utility functions to get the URL of the API calls
|
// Utility functions to get the URL of the API calls
|
||||||
|
|
||||||
|
private string GetMovieReviewsUrl(string rtId)
|
||||||
|
{
|
||||||
|
return BasicUrl + string.Format(MoviesReviews, ApiKey, rtId);
|
||||||
|
}
|
||||||
private string GetMovieImdbUrl(string imdbId)
|
private string GetMovieImdbUrl(string imdbId)
|
||||||
{
|
{
|
||||||
return BasicUrl + string.Format(MovieImdb, ApiKey, imdbId.TrimStart('t'));
|
return BasicUrl + string.Format(MovieImdb, ApiKey, imdbId.TrimStart('t'));
|
||||||
|
@ -225,6 +257,28 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
|
|
||||||
// Data contract classes for use with the Rotten Tomatoes API
|
// Data contract classes for use with the Rotten Tomatoes API
|
||||||
|
|
||||||
|
protected class RTReviewList
|
||||||
|
{
|
||||||
|
public int total { get; set; }
|
||||||
|
public List<RTReview> reviews { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class RTReview
|
||||||
|
{
|
||||||
|
public string critic { get; set; }
|
||||||
|
public string date { get; set; }
|
||||||
|
public string freshness { get; set; }
|
||||||
|
public string publication { get; set; }
|
||||||
|
public string quote { get; set; }
|
||||||
|
public RTReviewLink links { get; set; }
|
||||||
|
public string original_score { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class RTReviewLink
|
||||||
|
{
|
||||||
|
public string review { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
protected class RTSearchResults
|
protected class RTSearchResults
|
||||||
{
|
{
|
||||||
public int total { get; set; }
|
public int total { get; set; }
|
||||||
|
@ -263,5 +317,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
{
|
{
|
||||||
public string imdb { get; set; }
|
public string imdb { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The meta file name
|
/// The meta file name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected const string MetaFileName = "mbperson.json";
|
protected const string MetaFileName = "tmdb3.json";
|
||||||
|
|
||||||
protected readonly IProviderManager ProviderManager;
|
protected readonly IProviderManager ProviderManager;
|
||||||
|
|
||||||
|
@ -66,6 +66,22 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
return item is Person;
|
return item is Person;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool RefreshOnVersionChange
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string ProviderVersion
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return "2";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Needses the refresh internal.
|
/// Needses the refresh internal.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -74,6 +90,11 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||||
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
||||||
{
|
{
|
||||||
|
if (RefreshOnVersionChange && !String.Equals(ProviderVersion, providerInfo.ProviderVersion))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//we fetch if either info or image needed and haven't already tried recently
|
//we fetch if either info or image needed and haven't already tried recently
|
||||||
return (string.IsNullOrEmpty(item.PrimaryImagePath) || !item.ResolveArgs.ContainsMetaFileByName(MetaFileName))
|
return (string.IsNullOrEmpty(item.PrimaryImagePath) || !item.ResolveArgs.ContainsMetaFileByName(MetaFileName))
|
||||||
&& DateTime.Today.Subtract(providerInfo.LastRefreshed).TotalDays > ConfigurationManager.Configuration.MetadataRefreshDays;
|
&& DateTime.Today.Subtract(providerInfo.LastRefreshed).TotalDays > ConfigurationManager.Configuration.MetadataRefreshDays;
|
||||||
|
@ -91,7 +112,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
var person = (Person)item;
|
var person = (Person)item;
|
||||||
var tasks = new List<Task>();
|
|
||||||
|
|
||||||
var id = person.GetProviderId(MetadataProviders.Tmdb);
|
var id = person.GetProviderId(MetadataProviders.Tmdb);
|
||||||
|
|
||||||
|
@ -105,20 +125,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(id))
|
if (!string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
//get info only if not already saved
|
await FetchInfo(person, id, cancellationToken).ConfigureAwait(false);
|
||||||
if (!item.ResolveArgs.ContainsMetaFileByName(MetaFileName))
|
|
||||||
{
|
|
||||||
tasks.Add(FetchInfo(person, id, cancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
//get image only if not already there
|
|
||||||
if (string.IsNullOrEmpty(item.PrimaryImagePath))
|
|
||||||
{
|
|
||||||
tasks.Add(FetchImages(person, id, cancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
//and wait for them to complete
|
|
||||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -150,6 +157,8 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the TMDB id.
|
/// Gets the TMDB id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -180,7 +189,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
return searchResult != null && searchResult.Total_Results > 0 ? searchResult.Results[0].Id.ToString() : null;
|
return searchResult != null && searchResult.Total_Results > 0 ? searchResult.Results[0].Id.ToString(UsCulture) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -192,12 +201,12 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
private async Task FetchInfo(Person person, string id, CancellationToken cancellationToken)
|
private async Task FetchInfo(Person person, string id, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
string url = string.Format(@"http://api.themoviedb.org/3/person/{1}?api_key={0}", MovieDbProvider.ApiKey, id);
|
string url = string.Format(@"http://api.themoviedb.org/3/person/{1}?api_key={0}&append_to_response=credits,images", MovieDbProvider.ApiKey, id);
|
||||||
PersonResult searchResult = null;
|
PersonResult searchResult = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Stream json = await HttpClient.Get(new HttpRequestOptions
|
using (var json = await HttpClient.Get(new HttpRequestOptions
|
||||||
{
|
{
|
||||||
Url = url,
|
Url = url,
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
|
@ -207,10 +216,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
|
|
||||||
}).ConfigureAwait(false))
|
}).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
if (json != null)
|
searchResult = JsonSerializer.DeserializeFromStream<PersonResult>(json);
|
||||||
{
|
|
||||||
searchResult = JsonSerializer.DeserializeFromStream<PersonResult>(json);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (HttpException)
|
catch (HttpException)
|
||||||
|
@ -219,7 +225,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
if (searchResult != null && searchResult.Biography != null)
|
if (searchResult != null)
|
||||||
{
|
{
|
||||||
ProcessInfo(person, searchResult);
|
ProcessInfo(person, searchResult);
|
||||||
|
|
||||||
|
@ -231,6 +237,8 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
await ProviderManager.SaveToLibraryFilesystem(person, Path.Combine(person.MetaLocation, MetaFileName), memoryStream, cancellationToken);
|
await ProviderManager.SaveToLibraryFilesystem(person, Path.Combine(person.MetaLocation, MetaFileName), memoryStream, cancellationToken);
|
||||||
|
|
||||||
Logger.Debug("TmdbPersonProvider downloaded and saved information for {0}", person.Name);
|
Logger.Debug("TmdbPersonProvider downloaded and saved information for {0}", person.Name);
|
||||||
|
|
||||||
|
await FetchImages(person, searchResult.images, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,99 +249,73 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <param name="searchResult">The search result.</param>
|
/// <param name="searchResult">The search result.</param>
|
||||||
protected void ProcessInfo(Person person, PersonResult searchResult)
|
protected void ProcessInfo(Person person, PersonResult searchResult)
|
||||||
{
|
{
|
||||||
person.Overview = searchResult.Biography;
|
person.Overview = searchResult.biography;
|
||||||
|
|
||||||
DateTime date;
|
DateTime date;
|
||||||
|
|
||||||
if (DateTime.TryParseExact(searchResult.Birthday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date))
|
if (DateTime.TryParseExact(searchResult.birthday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date))
|
||||||
{
|
{
|
||||||
person.PremiereDate = date.ToUniversalTime();
|
person.PremiereDate = date.ToUniversalTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DateTime.TryParseExact(searchResult.Deathday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date))
|
if (DateTime.TryParseExact(searchResult.deathday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date))
|
||||||
{
|
{
|
||||||
person.EndDate = date.ToUniversalTime();
|
person.EndDate = date.ToUniversalTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(searchResult.Homepage))
|
if (!string.IsNullOrEmpty(searchResult.homepage))
|
||||||
{
|
{
|
||||||
person.HomePageUrl = searchResult.Homepage;
|
person.HomePageUrl = searchResult.homepage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(searchResult.Place_Of_Birth))
|
if (!string.IsNullOrEmpty(searchResult.place_of_birth))
|
||||||
{
|
{
|
||||||
person.AddProductionLocation(searchResult.Place_Of_Birth);
|
person.AddProductionLocation(searchResult.place_of_birth);
|
||||||
}
|
}
|
||||||
|
|
||||||
person.SetProviderId(MetadataProviders.Tmdb, searchResult.Id.ToString());
|
person.SetProviderId(MetadataProviders.Tmdb, searchResult.id.ToString(UsCulture));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches the images.
|
/// Fetches the images.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="person">The person.</param>
|
/// <param name="person">The person.</param>
|
||||||
/// <param name="id">The id.</param>
|
/// <param name="searchResult">The search result.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
private async Task FetchImages(Person person, string id, CancellationToken cancellationToken)
|
private async Task FetchImages(Person person, Images searchResult, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
string url = string.Format(@"http://api.themoviedb.org/3/person/{1}/images?api_key={0}", MovieDbProvider.ApiKey, id);
|
if (searchResult != null && searchResult.profiles.Count > 0)
|
||||||
|
|
||||||
PersonImages searchResult = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (Stream json = await HttpClient.Get(new HttpRequestOptions
|
|
||||||
{
|
|
||||||
Url = url,
|
|
||||||
CancellationToken = cancellationToken,
|
|
||||||
ResourcePool = MovieDbProvider.Current.MovieDbResourcePool,
|
|
||||||
AcceptHeader = MovieDbProvider.AcceptHeader,
|
|
||||||
EnableResponseCache = true
|
|
||||||
|
|
||||||
}).ConfigureAwait(false))
|
|
||||||
{
|
|
||||||
if (json != null)
|
|
||||||
{
|
|
||||||
searchResult = JsonSerializer.DeserializeFromStream<PersonImages>(json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (HttpException)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
if (searchResult != null && searchResult.Profiles.Count > 0)
|
|
||||||
{
|
{
|
||||||
//get our language
|
//get our language
|
||||||
var profile =
|
var profile =
|
||||||
searchResult.Profiles.FirstOrDefault(
|
searchResult.profiles.FirstOrDefault(
|
||||||
p =>
|
p =>
|
||||||
!string.IsNullOrEmpty(p.Iso_639_1) &&
|
!string.IsNullOrEmpty(GetIso639(p)) &&
|
||||||
p.Iso_639_1.Equals(ConfigurationManager.Configuration.PreferredMetadataLanguage,
|
GetIso639(p).Equals(ConfigurationManager.Configuration.PreferredMetadataLanguage,
|
||||||
StringComparison.OrdinalIgnoreCase));
|
StringComparison.OrdinalIgnoreCase));
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
{
|
{
|
||||||
//didn't find our language - try first null one
|
//didn't find our language - try first null one
|
||||||
profile =
|
profile =
|
||||||
searchResult.Profiles.FirstOrDefault(
|
searchResult.profiles.FirstOrDefault(
|
||||||
p =>
|
p =>
|
||||||
!string.IsNullOrEmpty(p.Iso_639_1) &&
|
!string.IsNullOrEmpty(GetIso639(p)) &&
|
||||||
p.Iso_639_1.Equals(ConfigurationManager.Configuration.PreferredMetadataLanguage,
|
GetIso639(p).Equals(ConfigurationManager.Configuration.PreferredMetadataLanguage,
|
||||||
StringComparison.OrdinalIgnoreCase));
|
StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
}
|
}
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
{
|
{
|
||||||
//still nothing - just get first one
|
//still nothing - just get first one
|
||||||
profile = searchResult.Profiles[0];
|
profile = searchResult.profiles[0];
|
||||||
}
|
}
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
var tmdbSettings = await MovieDbProvider.Current.TmdbSettings.ConfigureAwait(false);
|
var tmdbSettings = await MovieDbProvider.Current.TmdbSettings.ConfigureAwait(false);
|
||||||
|
|
||||||
var img = await DownloadAndSaveImage(person, tmdbSettings.images.base_url + ConfigurationManager.Configuration.TmdbFetchedProfileSize + profile.File_Path,
|
var img = await DownloadAndSaveImage(person, tmdbSettings.images.base_url + ConfigurationManager.Configuration.TmdbFetchedProfileSize + profile.file_path,
|
||||||
"folder" + Path.GetExtension(profile.File_Path), cancellationToken).ConfigureAwait(false);
|
"folder" + Path.GetExtension(profile.file_path), cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(img))
|
if (!string.IsNullOrEmpty(img))
|
||||||
{
|
{
|
||||||
|
@ -343,6 +325,11 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetIso639(Profile p)
|
||||||
|
{
|
||||||
|
return p.iso_639_1 == null ? string.Empty : p.iso_639_1.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Downloads the and save image.
|
/// Downloads the and save image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -373,7 +360,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class PersonSearchResult
|
/// Class PersonSearchResult
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PersonSearchResult
|
protected class PersonSearchResult
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether this <see cref="PersonSearchResult" /> is adult.
|
/// Gets or sets a value indicating whether this <see cref="PersonSearchResult" /> is adult.
|
||||||
|
@ -400,7 +387,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class PersonSearchResults
|
/// Class PersonSearchResults
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PersonSearchResults
|
protected class PersonSearchResults
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the page.
|
/// Gets or sets the page.
|
||||||
|
@ -424,110 +411,65 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
public int Total_Results { get; set; }
|
public int Total_Results { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected class Cast
|
||||||
/// Class PersonResult
|
|
||||||
/// </summary>
|
|
||||||
public class PersonResult
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
public int id { get; set; }
|
||||||
/// Gets or sets a value indicating whether this <see cref="PersonResult" /> is adult.
|
public string title { get; set; }
|
||||||
/// </summary>
|
public string character { get; set; }
|
||||||
/// <value><c>true</c> if adult; otherwise, <c>false</c>.</value>
|
public string original_title { get; set; }
|
||||||
public bool Adult { get; set; }
|
public string poster_path { get; set; }
|
||||||
/// <summary>
|
public string release_date { get; set; }
|
||||||
/// Gets or sets the also_ known_ as.
|
public bool adult { get; set; }
|
||||||
/// </summary>
|
|
||||||
/// <value>The also_ known_ as.</value>
|
|
||||||
public List<object> Also_Known_As { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the biography.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The biography.</value>
|
|
||||||
public string Biography { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the birthday.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The birthday.</value>
|
|
||||||
public string Birthday { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the deathday.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The deathday.</value>
|
|
||||||
public string Deathday { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the homepage.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The homepage.</value>
|
|
||||||
public string Homepage { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the id.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The id.</value>
|
|
||||||
public int Id { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the name.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The name.</value>
|
|
||||||
public string Name { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the place_ of_ birth.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The place_ of_ birth.</value>
|
|
||||||
public string Place_Of_Birth { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the profile_ path.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The profile_ path.</value>
|
|
||||||
public string Profile_Path { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected class Crew
|
||||||
/// Class PersonProfile
|
|
||||||
/// </summary>
|
|
||||||
public class PersonProfile
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
public int id { get; set; }
|
||||||
/// Gets or sets the aspect_ ratio.
|
public string title { get; set; }
|
||||||
/// </summary>
|
public string original_title { get; set; }
|
||||||
/// <value>The aspect_ ratio.</value>
|
public string department { get; set; }
|
||||||
public double Aspect_Ratio { get; set; }
|
public string job { get; set; }
|
||||||
/// <summary>
|
public string poster_path { get; set; }
|
||||||
/// Gets or sets the file_ path.
|
public string release_date { get; set; }
|
||||||
/// </summary>
|
public bool adult { get; set; }
|
||||||
/// <value>The file_ path.</value>
|
|
||||||
public string File_Path { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the height.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The height.</value>
|
|
||||||
public int Height { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the iso_639_1.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The iso_639_1.</value>
|
|
||||||
public string Iso_639_1 { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the width.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The width.</value>
|
|
||||||
public int Width { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected class Credits
|
||||||
/// Class PersonImages
|
|
||||||
/// </summary>
|
|
||||||
public class PersonImages
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
public List<Cast> cast { get; set; }
|
||||||
/// Gets or sets the id.
|
public List<Crew> crew { get; set; }
|
||||||
/// </summary>
|
}
|
||||||
/// <value>The id.</value>
|
|
||||||
public int Id { get; set; }
|
protected class Profile
|
||||||
/// <summary>
|
{
|
||||||
/// Gets or sets the profiles.
|
public string file_path { get; set; }
|
||||||
/// </summary>
|
public int width { get; set; }
|
||||||
/// <value>The profiles.</value>
|
public int height { get; set; }
|
||||||
public List<PersonProfile> Profiles { get; set; }
|
public object iso_639_1 { get; set; }
|
||||||
|
public double aspect_ratio { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class Images
|
||||||
|
{
|
||||||
|
public List<Profile> profiles { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class PersonResult
|
||||||
|
{
|
||||||
|
public bool adult { get; set; }
|
||||||
|
public List<object> also_known_as { get; set; }
|
||||||
|
public string biography { get; set; }
|
||||||
|
public string birthday { get; set; }
|
||||||
|
public string deathday { get; set; }
|
||||||
|
public string homepage { get; set; }
|
||||||
|
public int id { get; set; }
|
||||||
|
public string imdb_id { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public string place_of_birth { get; set; }
|
||||||
|
public double popularity { get; set; }
|
||||||
|
public string profile_path { get; set; }
|
||||||
|
public Credits credits { get; set; }
|
||||||
|
public Images images { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Common.Net;
|
using System.Globalization;
|
||||||
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
|
@ -99,6 +100,8 @@ namespace MediaBrowser.Controller.Providers.Music
|
||||||
return base.NeedsRefreshInternal(item, providerInfo);
|
return base.NeedsRefreshInternal(item, providerInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
|
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -178,7 +181,7 @@ namespace MediaBrowser.Controller.Providers.Music
|
||||||
Logger.Debug("FanArtProvider getting Backdrop for " + item.Name);
|
Logger.Debug("FanArtProvider getting Backdrop for " + item.Name);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
item.BackdropImagePaths.Add(await _providerManager.DownloadAndSaveImage(item, path, ("Backdrop" + (numBackdrops > 0 ? numBackdrops.ToString() : "") + ".jpg"), SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
item.BackdropImagePaths.Add(await _providerManager.DownloadAndSaveImage(item, path, ("Backdrop" + (numBackdrops > 0 ? numBackdrops.ToString(UsCulture) : "") + ".jpg"), SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||||
numBackdrops++;
|
numBackdrops++;
|
||||||
if (numBackdrops >= ConfigurationManager.Configuration.MaxBackdrops) break;
|
if (numBackdrops >= ConfigurationManager.Configuration.MaxBackdrops) break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using System.Globalization;
|
||||||
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
|
@ -364,6 +365,8 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches the images.
|
/// Fetches the images.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -455,7 +458,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||||
var p = b.SelectSingleNode("./BannerPath");
|
var p = b.SelectSingleNode("./BannerPath");
|
||||||
if (p != null)
|
if (p != null)
|
||||||
{
|
{
|
||||||
var bdName = "backdrop" + (bdNo > 0 ? bdNo.ToString() : "");
|
var bdName = "backdrop" + (bdNo > 0 ? bdNo.ToString(UsCulture) : "");
|
||||||
if (ConfigurationManager.Configuration.RefreshItemImages || !series.HasLocalImage(bdName))
|
if (ConfigurationManager.Configuration.RefreshItemImages || !series.HasLocalImage(bdName))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in New Issue
Block a user