mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-23 15:30:56 -04:00
Removed culture-specific procesing. tmdb appears to have unified their vote average format. #133
This commit is contained in:
parent
d1ea7c63dc
commit
8aa9a5ec63
@ -33,6 +33,8 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MovieDbProvider : BaseMetadataProvider, IDisposable
|
public class MovieDbProvider : BaseMetadataProvider, IDisposable
|
||||||
{
|
{
|
||||||
|
protected static CultureInfo EnUs = new CultureInfo("en-US");
|
||||||
|
|
||||||
protected readonly IProviderManager ProviderManager;
|
protected readonly IProviderManager ProviderManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -551,7 +553,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||||||
foreach (var possible in searchResult.results)
|
foreach (var possible in searchResult.results)
|
||||||
{
|
{
|
||||||
string matchedName = null;
|
string matchedName = null;
|
||||||
string id = possible.id.ToString();
|
string id = possible.id.ToString(CultureInfo.InvariantCulture);
|
||||||
string n = possible.title;
|
string n = possible.title;
|
||||||
if (GetComparableName(n, Logger) == compName)
|
if (GetComparableName(n, Logger) == compName)
|
||||||
{
|
{
|
||||||
@ -609,7 +611,8 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||||||
{
|
{
|
||||||
DateTime r;
|
DateTime r;
|
||||||
|
|
||||||
if (DateTime.TryParse(possible.release_date, out r))
|
//These dates are always in this exact format
|
||||||
|
if (DateTime.TryParseExact(possible.release_date, "yyyy-MM-dd", EnUs, DateTimeStyles.None, out r))
|
||||||
{
|
{
|
||||||
if (Math.Abs(r.Year - year.Value) > 1) // allow a 1 year tolerance on release date
|
if (Math.Abs(r.Year - year.Value) > 1) // allow a 1 year tolerance on release date
|
||||||
{
|
{
|
||||||
@ -912,19 +915,10 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||||||
if (!string.IsNullOrEmpty(movieData.tagline)) movie.AddTagline(movieData.tagline);
|
if (!string.IsNullOrEmpty(movieData.tagline)) movie.AddTagline(movieData.tagline);
|
||||||
movie.SetProviderId(MetadataProviders.Imdb, movieData.imdb_id);
|
movie.SetProviderId(MetadataProviders.Imdb, movieData.imdb_id);
|
||||||
float rating;
|
float rating;
|
||||||
string voteAvg = movieData.vote_average.ToString();
|
string voteAvg = movieData.vote_average.ToString(CultureInfo.InvariantCulture);
|
||||||
string cultureStr = ConfigurationManager.Configuration.PreferredMetadataLanguage + "-" + ConfigurationManager.Configuration.MetadataCountryCode;
|
//tmdb appears to have unified their numbers to always report "7.3" regardless of country
|
||||||
CultureInfo culture;
|
// so I removed the culture-specific processing here because it was not working for other countries -ebr
|
||||||
try
|
if (float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out rating))
|
||||||
{
|
|
||||||
culture = new CultureInfo(cultureStr);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
culture = CultureInfo.CurrentCulture; //default to windows settings if other was invalid
|
|
||||||
}
|
|
||||||
Logger.Debug("Culture for numeric conversion is: " + culture.Name);
|
|
||||||
if (float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, culture, out rating))
|
|
||||||
movie.CommunityRating = rating;
|
movie.CommunityRating = rating;
|
||||||
|
|
||||||
//release date and certification are retrieved based on configured country and we fall back on US if not there
|
//release date and certification are retrieved based on configured country and we fall back on US if not there
|
||||||
@ -1060,7 +1054,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||||||
var numToFetch = Math.Min(ConfigurationManager.Configuration.MaxBackdrops, images.backdrops.Count);
|
var numToFetch = Math.Min(ConfigurationManager.Configuration.MaxBackdrops, images.backdrops.Count);
|
||||||
for (var i = 0; i < numToFetch; i++)
|
for (var i = 0; i < numToFetch; i++)
|
||||||
{
|
{
|
||||||
var bdName = "backdrop" + (i == 0 ? "" : i.ToString());
|
var bdName = "backdrop" + (i == 0 ? "" : i.ToString(CultureInfo.InvariantCulture));
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.RefreshItemImages || !item.HasLocalImage(bdName))
|
if (ConfigurationManager.Configuration.RefreshItemImages || !item.HasLocalImage(bdName))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user