From 1007f242002b77db50e004a5a937395fe60f9289 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 16 Sep 2013 22:08:18 -0400 Subject: reduce task allocations by making IBN api synchronous --- MediaBrowser.Controller/Entities/BaseItem.cs | 3 +- MediaBrowser.Controller/Entities/Folder.cs | 10 +++--- MediaBrowser.Controller/Library/ILibraryManager.cs | 37 +++++++++------------- 3 files changed, 22 insertions(+), 28 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index f81485867b..07e363c4c9 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.Extensions; +using System.Runtime.InteropServices; +using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index d7e1db7432..252b4d0a8b 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -235,7 +235,7 @@ namespace MediaBrowser.Controller.Entities { try { - return LibraryManager.GetPerson(i).Result; + return LibraryManager.GetPerson(i); } catch (IOException ex) { @@ -263,7 +263,7 @@ namespace MediaBrowser.Controller.Entities { try { - return LibraryManager.GetArtist(i).Result; + return LibraryManager.GetArtist(i); } catch (IOException ex) { @@ -307,7 +307,7 @@ namespace MediaBrowser.Controller.Entities { try { - return LibraryManager.GetStudio(i).Result; + return LibraryManager.GetStudio(i); } catch (IOException ex) { @@ -347,7 +347,7 @@ namespace MediaBrowser.Controller.Entities { try { - return LibraryManager.GetGenre(i).Result; + return LibraryManager.GetGenre(i); } catch (Exception ex) { @@ -383,7 +383,7 @@ namespace MediaBrowser.Controller.Entities { try { - return LibraryManager.GetYear(i).Result; + return LibraryManager.GetYear(i); } catch (IOException ex) { diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 678050ca41..3419bf5e08 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.Library /// The files. /// The parent. /// List{``0}. - List ResolvePaths(IEnumerable files, Folder parent) + List ResolvePaths(IEnumerable files, Folder parent) where T : BaseItem; /// @@ -54,58 +54,51 @@ namespace MediaBrowser.Controller.Library /// Gets a Person /// /// The name. - /// if set to true [allow slow providers]. /// Task{Person}. - Task GetPerson(string name, bool allowSlowProviders = false); + Person GetPerson(string name); /// /// Gets the artist. /// /// The name. - /// if set to true [allow slow providers]. /// Task{Artist}. - Task GetArtist(string name, bool allowSlowProviders = false); + Artist GetArtist(string name); /// /// Gets a Studio /// /// The name. - /// if set to true [allow slow providers]. /// Task{Studio}. - Task GetStudio(string name, bool allowSlowProviders = false); + Studio GetStudio(string name); /// /// Gets a Genre /// /// The name. - /// if set to true [allow slow providers]. /// Task{Genre}. - Task GetGenre(string name, bool allowSlowProviders = false); + Genre GetGenre(string name); /// /// Gets the genre. /// /// The name. - /// if set to true [allow slow providers]. /// Task{MusicGenre}. - Task GetMusicGenre(string name, bool allowSlowProviders = false); + MusicGenre GetMusicGenre(string name); /// /// Gets the game genre. /// /// The name. - /// if set to true [allow slow providers]. /// Task{GameGenre}. - Task GetGameGenre(string name, bool allowSlowProviders = false); - + GameGenre GetGameGenre(string name); + /// /// Gets a Year /// /// The value. - /// if set to true [allow slow providers]. /// Task{Year}. /// - Task GetYear(int value, bool allowSlowProviders = false); + Year GetYear(int value); /// /// Validate and refresh the People sub-set of the IBN. @@ -163,10 +156,10 @@ namespace MediaBrowser.Controller.Library /// The prescan tasks. /// The postscan tasks. /// The savers. - void AddParts(IEnumerable rules, - IEnumerable pluginFolders, - IEnumerable resolvers, - IEnumerable introProviders, + void AddParts(IEnumerable rules, + IEnumerable pluginFolders, + IEnumerable resolvers, + IEnumerable introProviders, IEnumerable itemComparers, IEnumerable prescanTasks, IEnumerable postscanTasks, @@ -260,7 +253,7 @@ namespace MediaBrowser.Controller.Library /// The progress. /// Task. Task ValidateGenres(CancellationToken cancellationToken, IProgress progress); - + /// /// Validates the studios. /// @@ -268,7 +261,7 @@ namespace MediaBrowser.Controller.Library /// The progress. /// Task. Task ValidateStudios(CancellationToken cancellationToken, IProgress progress); - + /// /// Occurs when [item added]. /// -- cgit v1.2.3