mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 10:29:01 -07:00
Merge branch 'dev' of https://github.com/MediaBrowser/Emby into dev
This commit is contained in:
commit
f8dedb3fe8
@ -83,7 +83,7 @@ namespace MediaBrowser.Providers.BoxSets
|
||||
VoteCount = i.vote_count,
|
||||
Width = i.width,
|
||||
Height = i.height,
|
||||
Language = i.iso_639_1,
|
||||
Language = MovieDbProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||
ProviderName = Name,
|
||||
Type = ImageType.Primary,
|
||||
RatingType = RatingType.Score
|
||||
|
@ -63,6 +63,8 @@ namespace MediaBrowser.Providers.Movies
|
||||
{
|
||||
var list = new List<RemoteImageInfo>();
|
||||
|
||||
var language = item.GetPreferredMetadataLanguage();
|
||||
|
||||
var results = await FetchImages((BaseItem)item, null, _jsonSerializer, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (results == null)
|
||||
@ -85,7 +87,7 @@ namespace MediaBrowser.Providers.Movies
|
||||
VoteCount = i.vote_count,
|
||||
Width = i.width,
|
||||
Height = i.height,
|
||||
Language = i.iso_639_1,
|
||||
Language = MovieDbProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||
ProviderName = Name,
|
||||
Type = ImageType.Primary,
|
||||
RatingType = RatingType.Score
|
||||
@ -107,8 +109,6 @@ namespace MediaBrowser.Providers.Movies
|
||||
}));
|
||||
}
|
||||
|
||||
var language = item.GetPreferredMetadataLanguage();
|
||||
|
||||
var isLanguageEn = string.Equals(language, "en", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
return list.OrderByDescending(i =>
|
||||
|
@ -267,9 +267,21 @@ namespace MediaBrowser.Providers.Movies
|
||||
|
||||
if (!string.IsNullOrEmpty(preferredLanguage))
|
||||
{
|
||||
preferredLanguage = NormalizeLanguage(preferredLanguage);
|
||||
|
||||
languages.Add(preferredLanguage);
|
||||
|
||||
if (preferredLanguage.Length == 5) // like en-US
|
||||
{
|
||||
// Currenty, TMDB supports 2-letter language codes only
|
||||
// They are planning to change this in the future, thus we're
|
||||
// supplying both codes if we're having a 5-letter code.
|
||||
languages.Add(preferredLanguage.Substring(0, 2));
|
||||
}
|
||||
}
|
||||
|
||||
languages.Add("null");
|
||||
|
||||
if (!string.Equals(preferredLanguage, "en", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
languages.Add("en");
|
||||
@ -280,18 +292,35 @@ namespace MediaBrowser.Providers.Movies
|
||||
|
||||
public static string NormalizeLanguage(string language)
|
||||
{
|
||||
// They require this to be uppercase
|
||||
// https://emby.media/community/index.php?/topic/32454-fr-follow-tmdbs-new-language-api-update/?p=311148
|
||||
var parts = language.Split('-');
|
||||
|
||||
if (parts.Length == 2)
|
||||
if (!string.IsNullOrEmpty(language))
|
||||
{
|
||||
language = parts[0] + "-" + parts[1].ToUpper();
|
||||
// They require this to be uppercase
|
||||
// https://emby.media/community/index.php?/topic/32454-fr-follow-tmdbs-new-language-api-update/?p=311148
|
||||
var parts = language.Split('-');
|
||||
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
language = parts[0] + "-" + parts[1].ToUpper();
|
||||
}
|
||||
}
|
||||
|
||||
return language;
|
||||
}
|
||||
|
||||
public static string AdjustImageLanguage(string imageLanguage, string requestLanguage)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(imageLanguage)
|
||||
&& !string.IsNullOrEmpty(requestLanguage)
|
||||
&& requestLanguage.Length > 2
|
||||
&& imageLanguage.Length == 2
|
||||
&& requestLanguage.StartsWith(imageLanguage, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return requestLanguage;
|
||||
}
|
||||
|
||||
return imageLanguage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches the main result.
|
||||
/// </summary>
|
||||
|
@ -57,8 +57,10 @@ namespace MediaBrowser.Providers.TV
|
||||
return list;
|
||||
}
|
||||
|
||||
var language = item.GetPreferredMetadataLanguage();
|
||||
|
||||
var response = await GetEpisodeInfo(seriesId, seasonNumber.Value, episodeNumber.Value,
|
||||
item.GetPreferredMetadataLanguage(), cancellationToken).ConfigureAwait(false);
|
||||
language, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@ -71,12 +73,12 @@ namespace MediaBrowser.Providers.TV
|
||||
VoteCount = i.vote_count,
|
||||
Width = i.width,
|
||||
Height = i.height,
|
||||
Language = MovieDbProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||
ProviderName = Name,
|
||||
Type = ImageType.Primary,
|
||||
RatingType = RatingType.Score
|
||||
}));
|
||||
|
||||
var language = item.GetPreferredMetadataLanguage();
|
||||
|
||||
var isLanguageEn = string.Equals(language, "en", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
|
@ -151,7 +151,7 @@ namespace MediaBrowser.Providers.TV
|
||||
public string file_path { get; set; }
|
||||
public int height { get; set; }
|
||||
public string id { get; set; }
|
||||
public object iso_639_1 { get; set; }
|
||||
public string iso_639_1 { get; set; }
|
||||
public double vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
public int width { get; set; }
|
||||
|
@ -66,6 +66,8 @@ namespace MediaBrowser.Providers.TV
|
||||
|
||||
var tmdbImageUrl = tmdbSettings.images.secure_base_url + "original";
|
||||
|
||||
var language = item.GetPreferredMetadataLanguage();
|
||||
|
||||
list.AddRange(GetPosters(results).Select(i => new RemoteImageInfo
|
||||
{
|
||||
Url = tmdbImageUrl + i.file_path,
|
||||
@ -73,7 +75,7 @@ namespace MediaBrowser.Providers.TV
|
||||
VoteCount = i.vote_count,
|
||||
Width = i.width,
|
||||
Height = i.height,
|
||||
Language = i.iso_639_1,
|
||||
Language = MovieDbProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||
ProviderName = Name,
|
||||
Type = ImageType.Primary,
|
||||
RatingType = RatingType.Score
|
||||
@ -91,8 +93,6 @@ namespace MediaBrowser.Providers.TV
|
||||
RatingType = RatingType.Score
|
||||
}));
|
||||
|
||||
var language = item.GetPreferredMetadataLanguage();
|
||||
|
||||
var isLanguageEn = string.Equals(language, "en", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
return list.OrderByDescending(i =>
|
||||
|
@ -1320,20 +1320,14 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
item.Tags = info.Tags;
|
||||
item.HomePageUrl = info.HomePageUrl;
|
||||
}
|
||||
else
|
||||
else if (info.Type == ChannelItemType.Folder && info.FolderType == ChannelFolderType.Container)
|
||||
{
|
||||
// Can't do this right now due to channels that utilize the server's metadata services
|
||||
//if (item.Name != info.Name)
|
||||
//{
|
||||
// item.Name = info.Name;
|
||||
// forceUpdate = true;
|
||||
//}
|
||||
|
||||
//if (item.CommunityRating != info.CommunityRating)
|
||||
//{
|
||||
// item.CommunityRating = info.CommunityRating;
|
||||
// forceUpdate = true;
|
||||
//}
|
||||
// At least update names of container folders
|
||||
if (item.Name != info.Name)
|
||||
{
|
||||
item.Name = info.Name;
|
||||
forceUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
var hasArtists = item as IHasArtist;
|
||||
|
Loading…
Reference in New Issue
Block a user