From f1a48321755b8015aa121a64afd48818dfcf53ce Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 3 Jan 2014 23:53:49 -0500 Subject: [PATCH] added cast icon to now playing bar to send current media to another client --- MediaBrowser.Api/SearchService.cs | 4 +-- MediaBrowser.Api/UserLibrary/ItemsService.cs | 31 ++----------------- ...ibrarySearchEngine.cs => ISearchEngine.cs} | 11 +------ .../MediaBrowser.Controller.csproj | 2 +- .../Library/LuceneSearchEngine.cs | 14 +-------- .../ApplicationHost.cs | 2 +- 6 files changed, 8 insertions(+), 56 deletions(-) rename MediaBrowser.Controller/Library/{ILibrarySearchEngine.cs => ISearchEngine.cs} (55%) diff --git a/MediaBrowser.Api/SearchService.cs b/MediaBrowser.Api/SearchService.cs index 78ff1bc07..a497ba001 100644 --- a/MediaBrowser.Api/SearchService.cs +++ b/MediaBrowser.Api/SearchService.cs @@ -64,7 +64,7 @@ namespace MediaBrowser.Api /// /// The _search engine /// - private readonly ILibrarySearchEngine _searchEngine; + private readonly ISearchEngine _searchEngine; private readonly ILibraryManager _libraryManager; private readonly IDtoService _dtoService; private readonly IImageProcessor _imageProcessor; @@ -75,7 +75,7 @@ namespace MediaBrowser.Api /// The user manager. /// The search engine. /// The library manager. - public SearchService(IUserManager userManager, ILibrarySearchEngine searchEngine, ILibraryManager libraryManager, IDtoService dtoService, IImageProcessor imageProcessor) + public SearchService(IUserManager userManager, ISearchEngine searchEngine, ILibraryManager libraryManager, IDtoService dtoService, IImageProcessor imageProcessor) { _userManager = userManager; _searchEngine = searchEngine; diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 8ea225186..a7f76b2f2 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -45,13 +45,6 @@ namespace MediaBrowser.Api.UserLibrary [ApiMember(Name = "PersonTypes", Description = "Optional. If specified, along with Person, results will be filtered to include only those containing the specified person and PersonType. Allows multiple, comma-delimited", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string PersonTypes { get; set; } - /// - /// Search characters used to find items - /// - /// The index by. - [ApiMember(Name = "SearchTerm", Description = "Optional. If specified, results will be filtered based on a search term.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public string SearchTerm { get; set; } - /// /// Limit results to items containing specific genres /// @@ -240,7 +233,7 @@ namespace MediaBrowser.Api.UserLibrary /// The _library manager /// private readonly ILibraryManager _libraryManager; - private readonly ILibrarySearchEngine _searchEngine; + private readonly ISearchEngine _searchEngine; private readonly ILocalizationManager _localization; private readonly IDtoService _dtoService; @@ -252,7 +245,7 @@ namespace MediaBrowser.Api.UserLibrary /// The library manager. /// The search engine. /// The user data repository. - public ItemsService(IUserManager userManager, ILibraryManager libraryManager, ILibrarySearchEngine searchEngine, IUserDataManager userDataRepository, ILocalizationManager localization, IDtoService dtoService) + public ItemsService(IUserManager userManager, ILibraryManager libraryManager, ISearchEngine searchEngine, IUserDataManager userDataRepository, ILocalizationManager localization, IDtoService dtoService) { _userManager = userManager; _libraryManager = libraryManager; @@ -300,8 +293,6 @@ namespace MediaBrowser.Api.UserLibrary items = items.AsEnumerable(); - items = ApplySearchTerm(request, items); - items = ApplySortOrder(request, items, user, _libraryManager); // This must be the last filter @@ -1189,24 +1180,6 @@ namespace MediaBrowser.Api.UserLibrary return item.HasImage(imageType); } - /// - /// Applies the search term. - /// - /// The request. - /// The items. - /// IEnumerable{BaseItem}. - private IEnumerable ApplySearchTerm(GetItems request, IEnumerable items) - { - var term = request.SearchTerm; - - if (!string.IsNullOrEmpty(term)) - { - items = _searchEngine.Search(items, request.SearchTerm); - } - - return items; - } - /// /// Applies the paging. /// diff --git a/MediaBrowser.Controller/Library/ILibrarySearchEngine.cs b/MediaBrowser.Controller/Library/ISearchEngine.cs similarity index 55% rename from MediaBrowser.Controller/Library/ILibrarySearchEngine.cs rename to MediaBrowser.Controller/Library/ISearchEngine.cs index ff4dcbe5b..807d21302 100644 --- a/MediaBrowser.Controller/Library/ILibrarySearchEngine.cs +++ b/MediaBrowser.Controller/Library/ISearchEngine.cs @@ -7,17 +7,8 @@ namespace MediaBrowser.Controller.Library /// /// Interface ILibrarySearchEngine /// - public interface ILibrarySearchEngine + public interface ISearchEngine { - /// - /// Searches items and returns them in order of relevance. - /// - /// The items. - /// The search term. - /// IEnumerable{BaseItem}. - /// searchTerm - IEnumerable Search(IEnumerable items, string searchTerm); - /// /// Gets the search hints. /// diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 707997141..61de32e41 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -150,7 +150,7 @@ - + diff --git a/MediaBrowser.Server.Implementations/Library/LuceneSearchEngine.cs b/MediaBrowser.Server.Implementations/Library/LuceneSearchEngine.cs index 34156b509..2a3a4cdfd 100644 --- a/MediaBrowser.Server.Implementations/Library/LuceneSearchEngine.cs +++ b/MediaBrowser.Server.Implementations/Library/LuceneSearchEngine.cs @@ -14,7 +14,7 @@ namespace MediaBrowser.Server.Implementations.Library /// Class LuceneSearchEngine /// http://www.codeproject.com/Articles/320219/Lucene-Net-ultra-fast-search-for-MVC-or-WebForms /// - public class LuceneSearchEngine : ILibrarySearchEngine, IDisposable + public class LuceneSearchEngine : ISearchEngine, IDisposable { private readonly ILibraryManager _libraryManager; private readonly ILogger _logger; @@ -26,18 +26,6 @@ namespace MediaBrowser.Server.Implementations.Library _logger = logManager.GetLogger("Lucene"); } - /// - /// Searches items and returns them in order of relevance. - /// - /// The items. - /// The search term. - /// IEnumerable{BaseItem}. - /// searchTerm - public IEnumerable Search(IEnumerable items, string searchTerm) - { - return items; - } - public void Dispose() { } diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index f47ec6a81..c703cf18e 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -252,7 +252,7 @@ namespace MediaBrowser.ServerApplication ProviderManager = new ProviderManager(HttpClient, ServerConfigurationManager, DirectoryWatchers, LogManager, FileSystemManager, ItemRepository); RegisterSingleInstance(ProviderManager); - RegisterSingleInstance(() => new LuceneSearchEngine(ApplicationPaths, LogManager, LibraryManager)); + RegisterSingleInstance(() => new LuceneSearchEngine(ApplicationPaths, LogManager, LibraryManager)); SessionManager = new SessionManager(UserDataManager, ServerConfigurationManager, Logger, UserRepository, LibraryManager, UserManager); RegisterSingleInstance(SessionManager);