Merge pull request #2913 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-09-24 16:24:37 -04:00 committed by GitHub
commit 1443dd1aee
10 changed files with 23 additions and 81 deletions

View File

@ -579,7 +579,13 @@ namespace Emby.Server.Implementations.HttpServer
catch (Exception ex) catch (Exception ex)
{ {
ErrorHandler(ex, httpReq, !string.Equals(ex.GetType().Name, "SocketException", StringComparison.OrdinalIgnoreCase)); var logException = !string.Equals(ex.GetType().Name, "SocketException", StringComparison.OrdinalIgnoreCase);
#if DEBUG
logException = true;
#endif
ErrorHandler(ex, httpReq, logException);
} }
finally finally
{ {

View File

@ -424,16 +424,6 @@ namespace Emby.Server.Implementations.HttpServer
options.ResponseHeaders = options.ResponseHeaders ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); options.ResponseHeaders = options.ResponseHeaders ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
if (!options.ResponseHeaders.ContainsKey("Content-Disposition"))
{
// Quotes are valid in linux. They'll possibly cause issues here
var filename = (Path.GetFileName(path) ?? string.Empty).Replace("\"", string.Empty);
if (!string.IsNullOrWhiteSpace(filename))
{
options.ResponseHeaders["Content-Disposition"] = "inline; filename=\"" + filename + "\"";
}
}
return GetStaticResult(requestContext, options); return GetStaticResult(requestContext, options);
} }
@ -490,7 +480,8 @@ namespace Emby.Server.Implementations.HttpServer
return result; return result;
} }
var isHeadRequest = options.IsHeadRequest; // TODO: We don't really need the option value
var isHeadRequest = options.IsHeadRequest || string.Equals(requestContext.Verb, "HEAD", StringComparison.OrdinalIgnoreCase);
var factoryFn = options.ContentFactory; var factoryFn = options.ContentFactory;
var responseHeaders = options.ResponseHeaders; var responseHeaders = options.ResponseHeaders;

View File

@ -247,11 +247,6 @@ namespace Emby.Server.Implementations.Library
} }
} }
/// <summary>
/// The _season zero display name
/// </summary>
private string _seasonZeroDisplayName;
private bool _wizardCompleted; private bool _wizardCompleted;
/// <summary> /// <summary>
/// Records the configuration values. /// Records the configuration values.
@ -259,7 +254,6 @@ namespace Emby.Server.Implementations.Library
/// <param name="configuration">The configuration.</param> /// <param name="configuration">The configuration.</param>
private void RecordConfigurationValues(ServerConfiguration configuration) private void RecordConfigurationValues(ServerConfiguration configuration)
{ {
_seasonZeroDisplayName = configuration.SeasonZeroDisplayName;
_wizardCompleted = configuration.IsStartupWizardCompleted; _wizardCompleted = configuration.IsStartupWizardCompleted;
} }
@ -272,59 +266,14 @@ namespace Emby.Server.Implementations.Library
{ {
var config = ConfigurationManager.Configuration; var config = ConfigurationManager.Configuration;
var newSeasonZeroName = ConfigurationManager.Configuration.SeasonZeroDisplayName;
var seasonZeroNameChanged = !string.Equals(_seasonZeroDisplayName, newSeasonZeroName, StringComparison.Ordinal);
var wizardChanged = config.IsStartupWizardCompleted != _wizardCompleted; var wizardChanged = config.IsStartupWizardCompleted != _wizardCompleted;
RecordConfigurationValues(config); RecordConfigurationValues(config);
if (seasonZeroNameChanged || wizardChanged) if (wizardChanged)
{ {
_taskManager.CancelIfRunningAndQueue<RefreshMediaLibraryTask>(); _taskManager.CancelIfRunningAndQueue<RefreshMediaLibraryTask>();
} }
if (seasonZeroNameChanged)
{
Task.Run(async () =>
{
await UpdateSeasonZeroNames(newSeasonZeroName, CancellationToken.None).ConfigureAwait(false);
});
}
}
/// <summary>
/// Updates the season zero names.
/// </summary>
/// <param name="newName">The new name.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
private async Task UpdateSeasonZeroNames(string newName, CancellationToken cancellationToken)
{
var seasons = GetItemList(new InternalItemsQuery
{
IncludeItemTypes = new[] { typeof(Season).Name },
Recursive = true,
IndexNumber = 0,
DtoOptions = new DtoOptions(true)
}).Cast<Season>()
.Where(i => !string.Equals(i.Name, newName, StringComparison.Ordinal))
.ToList();
foreach (var season in seasons)
{
season.Name = newName;
try
{
await UpdateItem(season, ItemUpdateType.MetadataDownload, cancellationToken).ConfigureAwait(false);
}
catch (Exception ex)
{
_logger.ErrorException("Error saving {0}", ex, season.Path);
}
}
} }
public void RegisterItem(BaseItem item) public void RegisterItem(BaseItem item)

View File

@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
var seasonNumber = season.IndexNumber.Value; var seasonNumber = season.IndexNumber.Value;
season.Name = seasonNumber == 0 ? season.Name = seasonNumber == 0 ?
_config.Configuration.SeasonZeroDisplayName : args.LibraryOptions.SeasonZeroDisplayName :
string.Format(_localization.GetLocalizedString("NameSeasonNumber"), seasonNumber.ToString(UsCulture)); string.Format(_localization.GetLocalizedString("NameSeasonNumber"), seasonNumber.ToString(UsCulture));
} }

View File

@ -30,6 +30,8 @@
/// <value>The metadata country code.</value> /// <value>The metadata country code.</value>
public string MetadataCountryCode { get; set; } public string MetadataCountryCode { get; set; }
public string SeasonZeroDisplayName { get; set; }
public LibraryOptions() public LibraryOptions()
{ {
EnablePhotos = true; EnablePhotos = true;
@ -37,6 +39,7 @@
PathInfos = new MediaPathInfo[] { }; PathInfos = new MediaPathInfo[] { };
EnableInternetProviders = true; EnableInternetProviders = true;
EnableAutomaticSeriesGrouping = true; EnableAutomaticSeriesGrouping = true;
SeasonZeroDisplayName = "Specials";
} }
} }

View File

@ -77,12 +77,6 @@ namespace MediaBrowser.Model.Configuration
public string MetadataPath { get; set; } public string MetadataPath { get; set; }
public string MetadataNetworkPath { get; set; } public string MetadataNetworkPath { get; set; }
/// <summary>
/// Gets or sets the display name of the season zero.
/// </summary>
/// <value>The display name of the season zero.</value>
public string SeasonZeroDisplayName { get; set; }
/// <summary> /// <summary>
/// Gets or sets the preferred metadata language. /// Gets or sets the preferred metadata language.
/// </summary> /// </summary>
@ -239,8 +233,6 @@ namespace MediaBrowser.Model.Configuration
SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" }; SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" };
SortRemoveWords = new[] { "the", "a", "an" }; SortRemoveWords = new[] { "the", "a", "an" };
SeasonZeroDisplayName = "Specials";
UICulture = "en-us"; UICulture = "en-us";
MetadataOptions = new[] MetadataOptions = new[]

View File

@ -794,7 +794,8 @@ namespace MediaBrowser.Model.Dlna
if (applyConditions) if (applyConditions)
{ {
foreach (var transcodingVideoCodec in ContainerProfile.SplitValue(transcodingProfile.VideoCodec)) var transcodingVideoCodecs = ContainerProfile.SplitValue(transcodingProfile.VideoCodec);
foreach (var transcodingVideoCodec in transcodingVideoCodecs)
{ {
if (i.ContainsCodec(transcodingVideoCodec, transcodingProfile.Container)) if (i.ContainsCodec(transcodingVideoCodec, transcodingProfile.Container))
{ {

View File

@ -113,7 +113,7 @@ namespace MediaBrowser.Providers.TV
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var seasonName = seasonNumber == 0 ? var seasonName = seasonNumber == 0 ?
_config.Configuration.SeasonZeroDisplayName : _libraryManager.GetLibraryOptions(series).SeasonZeroDisplayName :
(seasonNumber.HasValue ? string.Format(_localization.GetLocalizedString("NameSeasonNumber"), seasonNumber.Value.ToString(_usCulture)) : _localization.GetLocalizedString("NameSeasonUnknown")); (seasonNumber.HasValue ? string.Format(_localization.GetLocalizedString("NameSeasonNumber"), seasonNumber.Value.ToString(_usCulture)) : _localization.GetLocalizedString("NameSeasonUnknown"));
_logger.Info("Creating Season {0} entry for {1}", seasonName, series.Name); _logger.Info("Creating Season {0} entry for {1}", seasonName, series.Name);

View File

@ -8,9 +8,7 @@ using MediaBrowser.Providers.Manager;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
namespace MediaBrowser.Providers.TV namespace MediaBrowser.Providers.TV
@ -23,9 +21,11 @@ namespace MediaBrowser.Providers.TV
if (item.IndexNumber.HasValue && item.IndexNumber.Value == 0) if (item.IndexNumber.HasValue && item.IndexNumber.Value == 0)
{ {
if (!string.Equals(item.Name, ServerConfigurationManager.Configuration.SeasonZeroDisplayName, StringComparison.OrdinalIgnoreCase)) var seasonZeroDisplayName = LibraryManager.GetLibraryOptions(item).SeasonZeroDisplayName;
if (!string.Equals(item.Name, seasonZeroDisplayName, StringComparison.OrdinalIgnoreCase))
{ {
item.Name = ServerConfigurationManager.Configuration.SeasonZeroDisplayName; item.Name = seasonZeroDisplayName;
updateType = updateType | ItemUpdateType.MetadataEdit; updateType = updateType | ItemUpdateType.MetadataEdit;
} }
} }

View File

@ -1,3 +1,3 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("3.2.32.4")] [assembly: AssemblyVersion("3.2.32.5")]