fixed users without playback access being able to click play chapters

pull/702/head
Luke Pulverenti 11 years ago
parent 1a9e2dfd83
commit cf4ae16f18

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

Loading…
Cancel
Save