diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index d664d0bba5..82c385522f 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -374,6 +374,13 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager /// /// public async Task GetTempFile(HttpRequestOptions options) + { + var response = await GetTempFileResponse(options).ConfigureAwait(false); + + return response.TempFilePath; + } + + public async Task GetTempFileResponse(HttpRequestOptions options) { ValidateParams(options.Url, options.CancellationToken); @@ -433,13 +440,20 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager options.Progress.Report(100); - options.CancellationToken.ThrowIfCancellationRequested(); + return new HttpResponseInfo + { + TempFilePath = tempFile, + + StatusCode = response.StatusCode, + + ContentType = response.Content.Headers.ContentType.MediaType + }; } } } catch (Exception ex) { - HandleTempFileException(ex, options, tempFile); + throw GetTempFileException(ex, options, tempFile); } finally { @@ -448,8 +462,6 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager options.ResourcePool.Release(); } } - - return tempFile; } /// @@ -501,7 +513,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager /// The temp file. /// Task. /// - private void HandleTempFileException(Exception ex, HttpRequestOptions options, string tempFile) + private Exception GetTempFileException(Exception ex, HttpRequestOptions options, string tempFile) { var operationCanceledException = ex as OperationCanceledException; @@ -513,7 +525,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager File.Delete(tempFile); } - throw GetCancellationException(options.Url, options.CancellationToken, operationCanceledException); + return GetCancellationException(options.Url, options.CancellationToken, operationCanceledException); } _logger.ErrorException("Error getting response from " + options.Url, ex); @@ -528,10 +540,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager if (httpRequestException != null) { - throw new HttpException(ex.Message, ex); + return new HttpException(ex.Message, ex); } - throw ex; + return ex; } /// diff --git a/MediaBrowser.Common/Net/HttpResponseInfo.cs b/MediaBrowser.Common/Net/HttpResponseInfo.cs index 558218ed16..3199dcc1c4 100644 --- a/MediaBrowser.Common/Net/HttpResponseInfo.cs +++ b/MediaBrowser.Common/Net/HttpResponseInfo.cs @@ -25,5 +25,11 @@ namespace MediaBrowser.Common.Net /// /// The status code. public HttpStatusCode StatusCode { get; set; } + + /// + /// Gets or sets the temp file path. + /// + /// The temp file path. + public string TempFilePath { get; set; } } } diff --git a/MediaBrowser.Common/Net/IHttpClient.cs b/MediaBrowser.Common/Net/IHttpClient.cs index 6068d4e8c8..93348d4ca0 100644 --- a/MediaBrowser.Common/Net/IHttpClient.cs +++ b/MediaBrowser.Common/Net/IHttpClient.cs @@ -72,5 +72,7 @@ namespace MediaBrowser.Common.Net /// progress /// Task GetTempFile(HttpRequestOptions options); + + Task GetTempFileResponse(HttpRequestOptions options); } } \ No newline at end of file diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index 953c99fbb1..fde44eee98 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -445,6 +445,7 @@ namespace MediaBrowser.Controller.Providers break; } + case "BirthDate": case "PremiereDate": case "FirstAired": { diff --git a/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs b/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs index cc04f8f02b..7617181c2f 100644 --- a/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs +++ b/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs @@ -198,9 +198,16 @@ namespace MediaBrowser.Providers.Savers builder.Append("" + SecurityElement.Escape(item.ForcedSortName) + ""); } - if (item.PremiereDate.HasValue && !(item is Episode)) + if (item.PremiereDate.HasValue) { - builder.Append("" + SecurityElement.Escape(item.PremiereDate.Value.ToString("yyyy-MM-dd")) + ""); + if (item is Person) + { + builder.Append("" + SecurityElement.Escape(item.PremiereDate.Value.ToString("yyyy-MM-dd")) + ""); + } + else if (!(item is Episode)) + { + builder.Append("" + SecurityElement.Escape(item.PremiereDate.Value.ToString("yyyy-MM-dd")) + ""); + } } if (item.RemoteTrailers.Count > 0) diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index dba38350c9..61b5819aec 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.150 + 3.0.151 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index f91f22dc5a..aa99d6a1d5 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.150 + 3.0.151 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index f5765fa224..c97a381e69 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.150 + 3.0.151 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +