|
@@ -1,8 +1,10 @@
|
|
|
-using MediaBrowser.Common.Configuration;
|
|
|
+using System.Linq;
|
|
|
+using MediaBrowser.Common.Configuration;
|
|
|
using MediaBrowser.Common.IO;
|
|
|
using MediaBrowser.Common.Net;
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
using MediaBrowser.Controller.Entities.Movies;
|
|
|
+using MediaBrowser.Controller.Localization;
|
|
|
using MediaBrowser.Controller.Providers;
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
using MediaBrowser.Model.Logging;
|
|
@@ -28,13 +30,15 @@ namespace MediaBrowser.Providers.BoxSets
|
|
|
private readonly IJsonSerializer _json;
|
|
|
private readonly IServerConfigurationManager _config;
|
|
|
private readonly IFileSystem _fileSystem;
|
|
|
+ private readonly ILocalizationManager _localization;
|
|
|
|
|
|
- public MovieDbBoxSetProvider(ILogger logger, IJsonSerializer json, IServerConfigurationManager config, IFileSystem fileSystem)
|
|
|
+ public MovieDbBoxSetProvider(ILogger logger, IJsonSerializer json, IServerConfigurationManager config, IFileSystem fileSystem, ILocalizationManager localization)
|
|
|
{
|
|
|
_logger = logger;
|
|
|
_json = json;
|
|
|
_config = config;
|
|
|
_fileSystem = fileSystem;
|
|
|
+ _localization = localization;
|
|
|
Current = this;
|
|
|
}
|
|
|
|
|
@@ -116,22 +120,29 @@ namespace MediaBrowser.Providers.BoxSets
|
|
|
|
|
|
private async Task<RootObject> FetchMainResult(string id, string language, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- var url = string.Format(GetCollectionInfo3, id, MovieDbSearch.ApiKey);
|
|
|
+ var url = string.Format(GetCollectionInfo3, id, MovieDbProvider.ApiKey);
|
|
|
|
|
|
- // Get images in english and with no language
|
|
|
- url += "&include_image_language=en,null";
|
|
|
+ var imageLanguages = _localization.GetCultures()
|
|
|
+ .Select(i => i.TwoLetterISOLanguageName)
|
|
|
+ .Distinct(StringComparer.OrdinalIgnoreCase)
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ imageLanguages.Add("null");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(language))
|
|
|
{
|
|
|
// If preferred language isn't english, get those images too
|
|
|
- if (!string.Equals(language, "en", StringComparison.OrdinalIgnoreCase))
|
|
|
+ if (imageLanguages.Contains(language, StringComparer.OrdinalIgnoreCase))
|
|
|
{
|
|
|
- url += string.Format(",{0}", language);
|
|
|
+ imageLanguages.Add(language);
|
|
|
}
|
|
|
|
|
|
url += string.Format("&language={0}", language);
|
|
|
}
|
|
|
|
|
|
+ // Get images in english and with no language
|
|
|
+ url += "&include_image_language=" + string.Join(",", imageLanguages.ToArray());
|
|
|
+
|
|
|
cancellationToken.ThrowIfCancellationRequested();
|
|
|
|
|
|
RootObject mainResult = null;
|