From bfc29c13b307168db2239b763d9d4762ae6e8376 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 6 Jan 2016 17:47:32 -0500 Subject: [PATCH 01/11] override buffer size only for windows --- MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs index e107ea9f13..97f082295e 100644 --- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs +++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs @@ -275,10 +275,14 @@ namespace MediaBrowser.Server.Implementations.IO { var newWatcher = new FileSystemWatcher(path, "*") { - IncludeSubdirectories = true, - InternalBufferSize = 32767 + IncludeSubdirectories = true }; + if (Environment.OSVersion.Platform == PlatformID.Win32NT) + { + newWatcher.InternalBufferSize = 32767; + } + newWatcher.NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.DirectoryName | NotifyFilters.FileName | From 0c6edf97739d6853da243684d1dd490c5f439170 Mon Sep 17 00:00:00 2001 From: Shaun Date: Thu, 7 Jan 2016 17:21:13 +1100 Subject: [PATCH 02/11] add Not Favorite to filters --- MediaBrowser.Api/Reports/ReportsService.cs | 3 +++ MediaBrowser.Model/Querying/ItemFilter.cs | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Api/Reports/ReportsService.cs b/MediaBrowser.Api/Reports/ReportsService.cs index 6c2886f5be..cb15986f73 100644 --- a/MediaBrowser.Api/Reports/ReportsService.cs +++ b/MediaBrowser.Api/Reports/ReportsService.cs @@ -275,6 +275,9 @@ namespace MediaBrowser.Api.Reports case ItemFilter.IsFavorite: query.IsFavorite = true; break; + case ItemFilter.IsNotFavorite: + query.IsFavorite = false; + break; case ItemFilter.IsFavoriteOrLikes: query.IsFavoriteOrLiked = true; break; diff --git a/MediaBrowser.Model/Querying/ItemFilter.cs b/MediaBrowser.Model/Querying/ItemFilter.cs index 83d61ae514..3a1786a156 100644 --- a/MediaBrowser.Model/Querying/ItemFilter.cs +++ b/MediaBrowser.Model/Querying/ItemFilter.cs @@ -45,6 +45,10 @@ namespace MediaBrowser.Model.Querying /// /// The is favorite or likes /// - IsFavoriteOrLikes = 10 + IsFavoriteOrLikes = 10, + /// + /// The item is not a favorite + /// + IsNotFavorite = 11 } } From cb751893a802f7b144bd9ccab5357c9053b90d54 Mon Sep 17 00:00:00 2001 From: Shaun Date: Thu, 7 Jan 2016 18:38:40 +1100 Subject: [PATCH 03/11] if HasQueryLimit is false then set start and limit to null so it includes all results --- MediaBrowser.Api/Reports/ReportsService.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Api/Reports/ReportsService.cs b/MediaBrowser.Api/Reports/ReportsService.cs index cb15986f73..b8709a499e 100644 --- a/MediaBrowser.Api/Reports/ReportsService.cs +++ b/MediaBrowser.Api/Reports/ReportsService.cs @@ -304,8 +304,11 @@ namespace MediaBrowser.Api.Reports } } - if (request.HasQueryLimit) - query.Limit = request.Limit; + if (request.HasQueryLimit == false) + { + query.StartIndex = null; + query.Limit = null; + } return query; } From 2073258072bf57615ff21afcf6f5af1453dbe296 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 8 Jan 2016 20:51:11 -0500 Subject: [PATCH 04/11] encode ass subs --- .../Library/MediaSourceManager.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs index 6bc1af5916..b132eedec6 100644 --- a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs +++ b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs @@ -68,6 +68,10 @@ namespace MediaBrowser.Server.Implementations.Library if (stream.IsTextSubtitleStream) { + if (string.Equals(stream.Codec, "ass", StringComparison.OrdinalIgnoreCase)) + { + return false; + } return true; } From 5a94f60ea0394c0ce7df6954ef4ab883e540bc63 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 8 Jan 2016 20:51:31 -0500 Subject: [PATCH 05/11] update connect entry point --- .../Connect/ConnectEntryPoint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs index af81b4eeaf..c9ab7735f5 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Server.Implementations.Connect { Task.Run(() => LoadCachedAddress()); - _timer = new Timer(TimerCallback, null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(3)); + _timer = new Timer(TimerCallback, null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(2)); } private readonly string[] _ipLookups = { "http://bot.whatismyipaddress.com", "https://connect.emby.media/service/ip" }; From 8e96c5b868a7e3157c79779b9f63e98df166beb8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 8 Jan 2016 20:52:11 -0500 Subject: [PATCH 06/11] update connect entry point --- .../Connect/ConnectEntryPoint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs index c9ab7735f5..af81b4eeaf 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Server.Implementations.Connect { Task.Run(() => LoadCachedAddress()); - _timer = new Timer(TimerCallback, null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(2)); + _timer = new Timer(TimerCallback, null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(3)); } private readonly string[] _ipLookups = { "http://bot.whatismyipaddress.com", "https://connect.emby.media/service/ip" }; From 7ffaa79c7aa3e3d7501076ca791a10ad5f3d10a1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 8 Jan 2016 23:27:38 -0500 Subject: [PATCH 07/11] update tmdb throttle --- MediaBrowser.Providers/Movies/MovieDbProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index 6b21fdfb81..cc26d6ddfa 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -367,7 +367,7 @@ namespace MediaBrowser.Providers.Movies } private static long _lastRequestTicks; - private static int requestIntervalMs = 200; + private static int requestIntervalMs = 250; /// /// Gets the movie db response. From 3790eff69eea645ada6afadd56213281aa8d3f2e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 8 Jan 2016 23:27:58 -0500 Subject: [PATCH 08/11] update transcoding throttle --- MediaBrowser.Api/Playback/TranscodingThrottler.cs | 2 +- MediaBrowser.Model/Configuration/EncodingOptions.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Api/Playback/TranscodingThrottler.cs b/MediaBrowser.Api/Playback/TranscodingThrottler.cs index ece4550095..a7d53cd447 100644 --- a/MediaBrowser.Api/Playback/TranscodingThrottler.cs +++ b/MediaBrowser.Api/Playback/TranscodingThrottler.cs @@ -42,7 +42,7 @@ namespace MediaBrowser.Api.Playback var options = GetOptions(); - if (options.EnableThrottling && IsThrottleAllowed(_job, options.ThrottleThresholdSeconds)) + if (options.EnableThrottling && IsThrottleAllowed(_job, options.ThrottleDelaySeconds)) { PauseTranscoding(); } diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs index b41ad7eb0c..516d00ee6d 100644 --- a/MediaBrowser.Model/Configuration/EncodingOptions.cs +++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs @@ -8,14 +8,14 @@ namespace MediaBrowser.Model.Configuration public double DownMixAudioBoost { get; set; } public bool EnableDebugLogging { get; set; } public bool EnableThrottling { get; set; } - public int ThrottleThresholdSeconds { get; set; } + public int ThrottleDelaySeconds { get; set; } public string HardwareAccelerationType { get; set; } public EncodingOptions() { DownMixAudioBoost = 2; EnableThrottling = true; - ThrottleThresholdSeconds = 110; + ThrottleDelaySeconds = 180; EncodingThreadCount = -1; } } From 61c204855591d1b793f260ccba5f2741261c81bf Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 9 Jan 2016 12:12:09 -0500 Subject: [PATCH 09/11] reduce excess logging --- MediaBrowser.Api/ApiEntryPoint.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index 1abbce4084..818b40b207 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -540,13 +540,13 @@ namespace MediaBrowser.Api } catch (IOException ex) { - Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path); + //Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path); DeletePartialStreamFiles(path, jobType, retryCount + 1, 500); } catch (Exception ex) { - Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path); + //Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path); } } @@ -578,7 +578,7 @@ namespace MediaBrowser.Api { try { - Logger.Debug("Deleting HLS file {0}", file); + //Logger.Debug("Deleting HLS file {0}", file); _fileSystem.DeleteFile(file); } catch (DirectoryNotFoundException) @@ -592,7 +592,7 @@ namespace MediaBrowser.Api catch (IOException ex) { e = ex; - Logger.ErrorException("Error deleting HLS file {0}", ex, file); + //Logger.ErrorException("Error deleting HLS file {0}", ex, file); } } From 396086fd54f928da322f91f0ba27919e277ae2ef Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 9 Jan 2016 12:57:12 -0500 Subject: [PATCH 10/11] update tmdb throttle --- MediaBrowser.Providers/Movies/MovieDbProvider.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index cc26d6ddfa..b7530ebb45 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -367,7 +367,8 @@ namespace MediaBrowser.Providers.Movies } private static long _lastRequestTicks; - private static int requestIntervalMs = 250; + // The limit is 40 requests per 10 seconds + private static int requestIntervalMs = 300; /// /// Gets the movie db response. From 9eaf22e54ef03e9df56fcff87f0685ddd8ecf4ac Mon Sep 17 00:00:00 2001 From: Shaun Date: Tue, 12 Jan 2016 13:22:52 +1100 Subject: [PATCH 11/11] add a new endpoint param IsFavorite and use it for reports --- MediaBrowser.Api/Reports/ReportsService.cs | 4 +--- MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs | 7 +++++++ MediaBrowser.Api/UserLibrary/ItemsService.cs | 1 + MediaBrowser.Model/Querying/ItemFilter.cs | 6 +----- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/MediaBrowser.Api/Reports/ReportsService.cs b/MediaBrowser.Api/Reports/ReportsService.cs index b8709a499e..6cbe2fd892 100644 --- a/MediaBrowser.Api/Reports/ReportsService.cs +++ b/MediaBrowser.Api/Reports/ReportsService.cs @@ -215,6 +215,7 @@ namespace MediaBrowser.Api.Reports Filter = i => ApplyAdditionalFilters(request, i, user, _libraryManager), + IsFavorite = request.IsFavorite, Limit = request.Limit, StartIndex = request.StartIndex, IsMissing = request.IsMissing, @@ -275,9 +276,6 @@ namespace MediaBrowser.Api.Reports case ItemFilter.IsFavorite: query.IsFavorite = true; break; - case ItemFilter.IsNotFavorite: - query.IsFavorite = false; - break; case ItemFilter.IsFavoriteOrLikes: query.IsFavoriteOrLiked = true; break; diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs index 4d844e6cbe..23d4da60c3 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs @@ -168,6 +168,13 @@ namespace MediaBrowser.Api.UserLibrary [ApiMember(Name = "Filters", Description = "Optional. Specify additional filters to apply. This allows multiple, comma delimeted. Options: IsFolder, IsNotFolder, IsUnplayed, IsPlayed, IsFavorite, IsResumable, Likes, Dislikes", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string Filters { get; set; } + /// + /// Gets or sets the Isfavorite option + /// + /// IsFavorite + [ApiMember(Name = "IsFavorite", Description = "Optional filter by items that are marked as favorite, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] + public bool? IsFavorite { get; set; } + /// /// Gets or sets the media types. /// diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index f1168ab7f4..97d0ad7ab0 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -181,6 +181,7 @@ namespace MediaBrowser.Api.UserLibrary Filter = i => ApplyAdditionalFilters(request, i, user, _libraryManager), + IsFavorite = request.IsFavorite, Limit = request.Limit, StartIndex = request.StartIndex, IsMissing = request.IsMissing, diff --git a/MediaBrowser.Model/Querying/ItemFilter.cs b/MediaBrowser.Model/Querying/ItemFilter.cs index 3a1786a156..83d61ae514 100644 --- a/MediaBrowser.Model/Querying/ItemFilter.cs +++ b/MediaBrowser.Model/Querying/ItemFilter.cs @@ -45,10 +45,6 @@ namespace MediaBrowser.Model.Querying /// /// The is favorite or likes /// - IsFavoriteOrLikes = 10, - /// - /// The item is not a favorite - /// - IsNotFavorite = 11 + IsFavoriteOrLikes = 10 } }