From 6844b2a457bfdaeb85ec035657dd99d9003b3f55 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 5 Apr 2016 15:34:09 -0400 Subject: [PATCH 1/7] update dlna images --- MediaBrowser.Dlna/Didl/DidlBuilder.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Dlna/Didl/DidlBuilder.cs b/MediaBrowser.Dlna/Didl/DidlBuilder.cs index 728b397de..ba42a06e2 100644 --- a/MediaBrowser.Dlna/Didl/DidlBuilder.cs +++ b/MediaBrowser.Dlna/Didl/DidlBuilder.cs @@ -979,7 +979,10 @@ namespace MediaBrowser.Dlna.Didl if (item != null) { - return GetImageInfo(item, ImageType.Primary); + if (item.HasImage(ImageType.Primary)) + { + return GetImageInfo(item, ImageType.Primary); + } } return null; From f15e534d41a1f34bb7492671c4590f11303ed39a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 5 Apr 2016 15:34:27 -0400 Subject: [PATCH 2/7] update initial user permissions --- MediaBrowser.Server.Implementations/Library/UserManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index c1807efe9..5ba83d6c7 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -352,6 +352,7 @@ namespace MediaBrowser.Server.Implementations.Library users.Add(user); user.Policy.IsAdministrator = true; + user.Policy.EnableContentDeletion = true; user.Policy.EnableRemoteControlOfOtherUsers = true; await UpdateUserPolicy(user, user.Policy, false).ConfigureAwait(false); } From 3ac2002759c324aef82c62fcf6cf54ab30ca8dcf Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 5 Apr 2016 15:34:45 -0400 Subject: [PATCH 3/7] normalize user specified external address --- .../Connect/ConnectManager.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs index 9ed67f77e..e308acef0 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs @@ -62,6 +62,17 @@ namespace MediaBrowser.Server.Implementations.Connect { var address = _config.Configuration.WanDdns; + if (!string.IsNullOrWhiteSpace(address)) + { + try + { + address = new Uri(address).Host; + } + catch + { + } + } + if (string.IsNullOrWhiteSpace(address) && DiscoveredWanIpAddress != null) { if (DiscoveredWanIpAddress.AddressFamily == AddressFamily.InterNetworkV6) @@ -237,8 +248,8 @@ namespace MediaBrowser.Server.Implementations.Connect var postData = new Dictionary { - {"name", _appHost.FriendlyName}, - {"url", wanApiAddress}, + {"name", _appHost.FriendlyName}, + {"url", wanApiAddress}, {"systemId", _appHost.SystemId} }; From 2ca59daba71fdc213d7cde76ffc75d6702715fae Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 5 Apr 2016 15:35:00 -0400 Subject: [PATCH 4/7] update channel media info --- MediaBrowser.Controller/Channels/ChannelMediaInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs b/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs index 1672b75fa..9424568b4 100644 --- a/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs +++ b/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs @@ -65,7 +65,7 @@ namespace MediaBrowser.Controller.Channels Name = id, Id = id, ReadAtNativeFramerate = ReadAtNativeFramerate, - SupportsDirectStream = Protocol == MediaProtocol.File || Protocol == MediaProtocol.Http, + SupportsDirectStream = Protocol == MediaProtocol.File, SupportsDirectPlay = SupportsDirectPlay }; From d5396828fbf332d0f744069e3dda9684f3a6384b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 5 Apr 2016 15:35:08 -0400 Subject: [PATCH 5/7] update components --- MediaBrowser.Providers/People/MovieDbPersonProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MediaBrowser.Providers/People/MovieDbPersonProvider.cs b/MediaBrowser.Providers/People/MovieDbPersonProvider.cs index 24f44fea1..2b37d0462 100644 --- a/MediaBrowser.Providers/People/MovieDbPersonProvider.cs +++ b/MediaBrowser.Providers/People/MovieDbPersonProvider.cs @@ -97,7 +97,7 @@ namespace MediaBrowser.Providers.People var requestCount = _requestCount; - if (requestCount >= 20) + if (requestCount >= 30) { //_logger.Debug("Throttling Tmdb people"); From 1cea5bcbd8360fa7c5c9bfd273f27f472809a178 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 5 Apr 2016 22:18:56 -0400 Subject: [PATCH 6/7] improve identify feature --- MediaBrowser.Api/ItemLookupService.cs | 17 +++++++++----- .../Providers/MetadataRefreshOptions.cs | 3 +++ .../Manager/MetadataService.cs | 13 +++++++++++ .../Omdb/OmdbItemProvider.cs | 6 ++--- .../HttpServer/HttpListenerHost.cs | 23 +++++++++++-------- .../TunerHosts/HdHomerun/HdHomerunHost.cs | 2 +- 6 files changed, 43 insertions(+), 21 deletions(-) diff --git a/MediaBrowser.Api/ItemLookupService.cs b/MediaBrowser.Api/ItemLookupService.cs index 8be37e210..41bfd9da2 100644 --- a/MediaBrowser.Api/ItemLookupService.cs +++ b/MediaBrowser.Api/ItemLookupService.cs @@ -202,14 +202,19 @@ namespace MediaBrowser.Api // } //} Logger.Info("Setting provider id's to item {0}-{1}: {2}", item.Id, item.Name, _json.SerializeToString(request.ProviderIds)); - item.ProviderIds = request.ProviderIds; - var task = _providerManager.RefreshFullItem(item, new MetadataRefreshOptions(_fileSystem) + // Since the refresh process won't erase provider Ids, we need to set this explicitly now. + item.ProviderIds = request.ProviderIds; + //item.ProductionYear = request.ProductionYear; + //item.Name = request.Name; + + var task = _providerManager.RefreshFullItem(item, new MetadataRefreshOptions(_fileSystem) { MetadataRefreshMode = MetadataRefreshMode.FullRefresh, ImageRefreshMode = ImageRefreshMode.FullRefresh, ReplaceAllMetadata = true, - ReplaceAllImages = request.ReplaceAllImages + ReplaceAllImages = request.ReplaceAllImages, + SearchResult = request }, CancellationToken.None); Task.WaitAll(task); @@ -234,7 +239,7 @@ namespace MediaBrowser.Api contentPath = await reader.ReadToEndAsync().ConfigureAwait(false); } - if (_fileSystem.FileExists(contentPath)) + if (_fileSystem.FileExists(contentPath)) { return ToStaticFileResult(contentPath); } @@ -275,7 +280,7 @@ namespace MediaBrowser.Api var fullCachePath = GetFullCachePath(urlHash + "." + ext); - _fileSystem.CreateDirectory(Path.GetDirectoryName(fullCachePath)); + _fileSystem.CreateDirectory(Path.GetDirectoryName(fullCachePath)); using (var stream = result.Content) { using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileMode.Create, FileAccess.Write, FileShare.Read, true)) @@ -284,7 +289,7 @@ namespace MediaBrowser.Api } } - _fileSystem.CreateDirectory(Path.GetDirectoryName(pointerCachePath)); + _fileSystem.CreateDirectory(Path.GetDirectoryName(pointerCachePath)); using (var writer = new StreamWriter(pointerCachePath)) { await writer.WriteAsync(fullCachePath).ConfigureAwait(false); diff --git a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs index 29f4feb3d..9427b2afd 100644 --- a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs +++ b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs @@ -1,5 +1,6 @@ using System.Linq; using CommonIO; +using MediaBrowser.Model.Providers; namespace MediaBrowser.Controller.Providers { @@ -13,6 +14,7 @@ namespace MediaBrowser.Controller.Providers public bool IsPostRecursiveRefresh { get; set; } public MetadataRefreshMode MetadataRefreshMode { get; set; } + public RemoteSearchResult SearchResult { get; set; } public bool ForceSave { get; set; } @@ -37,6 +39,7 @@ namespace MediaBrowser.Controller.Providers ImageRefreshMode = copy.ImageRefreshMode; ReplaceAllImages = copy.ReplaceAllImages; ReplaceImages = copy.ReplaceImages.ToList(); + SearchResult = copy.SearchResult; } } } diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index c1ae43124..8f7c93f32 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -13,6 +13,7 @@ using System.Threading.Tasks; using CommonIO; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.Movies; +using MediaBrowser.Model.Providers; namespace MediaBrowser.Providers.Manager { @@ -136,6 +137,11 @@ namespace MediaBrowser.Providers.Manager { var id = itemOfType.GetLookupInfo(); + if (refreshOptions.SearchResult != null) + { + ApplySearchResult(id, refreshOptions.SearchResult); + } + //await FindIdentities(id, cancellationToken).ConfigureAwait(false); id.IsAutomated = refreshOptions.IsAutomated; @@ -207,6 +213,13 @@ namespace MediaBrowser.Providers.Manager return updateType; } + private void ApplySearchResult(ItemLookupInfo lookupInfo, RemoteSearchResult result) + { + lookupInfo.ProviderIds = result.ProviderIds; + lookupInfo.Name = result.Name; + lookupInfo.Year = result.ProductionYear; + } + private async Task FindIdentities(TIdType id, CancellationToken cancellationToken) { try diff --git a/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs b/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs index 75bec7b65..894750c81 100644 --- a/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs @@ -60,9 +60,8 @@ namespace MediaBrowser.Providers.Omdb return GetSearchResultsInternal(searchInfo, type, true, cancellationToken); } - private async Task> GetSearchResultsInternal(ItemLookupInfo searchInfo, string type, bool enableMultipleResults, CancellationToken cancellationToken) + private async Task> GetSearchResultsInternal(ItemLookupInfo searchInfo, string type, bool isSearch, CancellationToken cancellationToken) { - bool isSearch = false; var episodeSearchInfo = searchInfo as EpisodeInfo; var list = new List(); @@ -95,10 +94,9 @@ namespace MediaBrowser.Providers.Omdb } // &s means search and returns a list of results as opposed to t - if (enableMultipleResults) + if (isSearch) { url += "&s=" + WebUtility.UrlEncode(name); - isSearch = true; } else { diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs index 3e4f4a70c..25463b660 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -344,6 +344,19 @@ namespace MediaBrowser.Server.Implementations.HttpServer LoggerUtils.LogRequest(_logger, urlToLog, httpReq.HttpMethod, httpReq.UserAgent); } + if (string.Equals(localPath, "/emby/", StringComparison.OrdinalIgnoreCase) || + string.Equals(localPath, "/mediabrowser/", StringComparison.OrdinalIgnoreCase)) + { + httpRes.RedirectToUrl(DefaultRedirectPath); + return Task.FromResult(true); + } + if (string.Equals(localPath, "/emby", StringComparison.OrdinalIgnoreCase) || + string.Equals(localPath, "/mediabrowser", StringComparison.OrdinalIgnoreCase)) + { + httpRes.RedirectToUrl("emby/" + DefaultRedirectPath); + return Task.FromResult(true); + } + if (string.Equals(localPath, "/mediabrowser/", StringComparison.OrdinalIgnoreCase) || string.Equals(localPath, "/mediabrowser", StringComparison.OrdinalIgnoreCase) || localPath.IndexOf("mediabrowser/web", StringComparison.OrdinalIgnoreCase) != -1 || @@ -363,16 +376,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer } } - if (string.Equals(localPath, "/emby/", StringComparison.OrdinalIgnoreCase)) - { - httpRes.RedirectToUrl(DefaultRedirectPath); - return Task.FromResult(true); - } - if (string.Equals(localPath, "/emby", StringComparison.OrdinalIgnoreCase)) - { - httpRes.RedirectToUrl("emby/" + DefaultRedirectPath); - return Task.FromResult(true); - } if (string.Equals(localPath, "/web", StringComparison.OrdinalIgnoreCase)) { httpRes.RedirectToUrl(DefaultRedirectPath); diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index ef8efbe98..7fc54819d 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -75,7 +75,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun lineup = lineup.Where(i => i.Favorite).ToList(); } - return lineup; + return lineup.Where(i => !i.DRM).ToList(); } } From 0e0398026232dac5b7fe71f0dfac1df854c10282 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 5 Apr 2016 23:14:39 -0400 Subject: [PATCH 7/7] fix query case sensitivity --- .../Persistence/SqliteItemRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 71c338fdb..b6699d164 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -2283,7 +2283,7 @@ namespace MediaBrowser.Server.Implementations.Persistence private static Dictionary GetTypeMapDictionary() { - var dict = new Dictionary(); + var dict = new Dictionary(StringComparer.OrdinalIgnoreCase); foreach (var t in KnownTypes) {