diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index c7f470427..26d3c6200 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -331,7 +331,6 @@ namespace MediaBrowser.Api return; } - // TODO: Lower this hls timeout var timerDuration = job.Type == TranscodingJobType.Progressive ? 1000 : 1800000; diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index 1aa8d7f1f..87378fd5a 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -488,6 +488,9 @@ Dto\ItemIndex.cs + + Dto\ItemLayout.cs + Dto\MediaSourceInfo.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index 5d4633f50..61057e5bb 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -453,6 +453,9 @@ Dto\ItemIndex.cs + + Dto\ItemLayout.cs + Dto\MediaSourceInfo.cs diff --git a/MediaBrowser.Model/ApiClient/ServerCredentials.cs b/MediaBrowser.Model/ApiClient/ServerCredentials.cs index 6ba2a80c8..b5a1a7b49 100644 --- a/MediaBrowser.Model/ApiClient/ServerCredentials.cs +++ b/MediaBrowser.Model/ApiClient/ServerCredentials.cs @@ -98,7 +98,7 @@ namespace MediaBrowser.Model.ApiClient { var index = 0; - foreach (var server in servers) + foreach (ServerInfo server in servers) { if (StringHelper.EqualsIgnoreCase(id, server.Id)) { @@ -110,5 +110,18 @@ namespace MediaBrowser.Model.ApiClient return -1; } + + public ServerInfo GetServer(string id) + { + foreach (ServerInfo server in Servers) + { + if (StringHelper.EqualsIgnoreCase(id, server.Id)) + { + return server; + } + } + + return null; + } } } diff --git a/MediaBrowser.Model/Dto/ItemLayout.cs b/MediaBrowser.Model/Dto/ItemLayout.cs new file mode 100644 index 000000000..c85818390 --- /dev/null +++ b/MediaBrowser.Model/Dto/ItemLayout.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Model.Dto +{ + public static class ItemLayout + { + public static double? GetDisplayAspectRatio(BaseItemDto item) + { + List items = new List(); + items.Add(item); + return GetDisplayAspectRatio(items); + } + + public static double? GetDisplayAspectRatio(List items) + { + List values = new List(); + + foreach (BaseItemDto item in items) + { + if (item.PrimaryImageAspectRatio.HasValue) + { + values.Add(item.PrimaryImageAspectRatio.Value); + } + } + + if (values.Count == 0) + { + return null; + } + + values.Sort(); + + double halfDouble = values.Count; + halfDouble /= 2; + int half = Convert.ToInt32(Math.Floor(halfDouble)); + + double result; + + if (values.Count % 2 > 0) + result = values[half]; + else + result = (values[half - 1] + values[half]) / 2.0; + + // If really close to 2:3 (poster image), just return 2:3 + if (Math.Abs(0.66666666667 - result) <= .15) + { + return 0.66666666667; + } + + // If really close to 16:9 (episode image), just return 16:9 + if (Math.Abs(1.777777778 - result) <= .2) + { + return 1.777777778; + } + + // If really close to 1 (square image), just return 1 + if (Math.Abs(1 - result) <= .15) + { + return 1.0; + } + + // If really close to 4:3 (poster image), just return 2:3 + if (Math.Abs(1.33333333333 - result) <= .15) + { + return 1.33333333333; + } + + return result; + } + } +} diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index eb36712c2..af0cbb166 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -139,6 +139,7 @@ + diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 3cfecdeaf..334e14850 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -482,6 +482,11 @@ namespace MediaBrowser.Providers.Manager protected virtual bool IsFullLocalMetadata(TItemType item) { + if (string.IsNullOrWhiteSpace(item.Name)) + { + return false; + } + return true; } diff --git a/MediaBrowser.Providers/Movies/MovieMetadataService.cs b/MediaBrowser.Providers/Movies/MovieMetadataService.cs index 172ae6814..f886deb00 100644 --- a/MediaBrowser.Providers/Movies/MovieMetadataService.cs +++ b/MediaBrowser.Providers/Movies/MovieMetadataService.cs @@ -36,10 +36,6 @@ namespace MediaBrowser.Providers.Movies protected override bool IsFullLocalMetadata(Movie item) { - if (string.IsNullOrWhiteSpace(item.Name)) - { - return false; - } if (string.IsNullOrWhiteSpace(item.Overview)) { return false; diff --git a/MediaBrowser.Providers/TV/SeriesMetadataService.cs b/MediaBrowser.Providers/TV/SeriesMetadataService.cs index a5959f0b7..b0cd7382a 100644 --- a/MediaBrowser.Providers/TV/SeriesMetadataService.cs +++ b/MediaBrowser.Providers/TV/SeriesMetadataService.cs @@ -77,10 +77,6 @@ namespace MediaBrowser.Providers.TV protected override bool IsFullLocalMetadata(Series item) { - if (string.IsNullOrWhiteSpace(item.Name)) - { - return false; - } if (string.IsNullOrWhiteSpace(item.Overview)) { return false; diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 313985d9d..e99d01d54 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -1723,7 +1723,7 @@ namespace MediaBrowser.Server.Implementations.Library await item.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false); } - var refresh = isNew || (DateTime.UtcNow - item.DateLastSaved).TotalHours >= 12; + var refresh = isNew || (DateTime.UtcNow - item.DateLastSaved).TotalHours >= 24; if (refresh) {