aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-16 22:08:18 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-16 22:08:18 -0400
commit1007f242002b77db50e004a5a937395fe60f9289 (patch)
treeabfb4cd7f92fb23ddcc4368bd6bc3297fa73ef96 /MediaBrowser.Controller
parentaaecc99d631e7ddfad2e5e3f171f8e0824fb2859 (diff)
reduce task allocations by making IBN api synchronous
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs3
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs10
-rw-r--r--MediaBrowser.Controller/Library/ILibraryManager.cs37
3 files changed, 22 insertions, 28 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index f81485867..07e363c4c 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 d7e1db743..252b4d0a8 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 678050ca4..3419bf5e0 100644
--- a/MediaBrowser.Controller/Library/ILibraryManager.cs
+++ b/MediaBrowser.Controller/Library/ILibraryManager.cs
@@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="files">The files.</param>
/// <param name="parent">The parent.</param>
/// <returns>List{``0}.</returns>
- List<T> ResolvePaths<T>(IEnumerable<FileSystemInfo> files, Folder parent)
+ List<T> ResolvePaths<T>(IEnumerable<FileSystemInfo> files, Folder parent)
where T : BaseItem;
/// <summary>
@@ -54,58 +54,51 @@ namespace MediaBrowser.Controller.Library
/// Gets a Person
/// </summary>
/// <param name="name">The name.</param>
- /// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
/// <returns>Task{Person}.</returns>
- Task<Person> GetPerson(string name, bool allowSlowProviders = false);
+ Person GetPerson(string name);
/// <summary>
/// Gets the artist.
/// </summary>
/// <param name="name">The name.</param>
- /// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
/// <returns>Task{Artist}.</returns>
- Task<Artist> GetArtist(string name, bool allowSlowProviders = false);
+ Artist GetArtist(string name);
/// <summary>
/// Gets a Studio
/// </summary>
/// <param name="name">The name.</param>
- /// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
/// <returns>Task{Studio}.</returns>
- Task<Studio> GetStudio(string name, bool allowSlowProviders = false);
+ Studio GetStudio(string name);
/// <summary>
/// Gets a Genre
/// </summary>
/// <param name="name">The name.</param>
- /// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
/// <returns>Task{Genre}.</returns>
- Task<Genre> GetGenre(string name, bool allowSlowProviders = false);
+ Genre GetGenre(string name);
/// <summary>
/// Gets the genre.
/// </summary>
/// <param name="name">The name.</param>
- /// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
/// <returns>Task{MusicGenre}.</returns>
- Task<MusicGenre> GetMusicGenre(string name, bool allowSlowProviders = false);
+ MusicGenre GetMusicGenre(string name);
/// <summary>
/// Gets the game genre.
/// </summary>
/// <param name="name">The name.</param>
- /// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
/// <returns>Task{GameGenre}.</returns>
- Task<GameGenre> GetGameGenre(string name, bool allowSlowProviders = false);
-
+ GameGenre GetGameGenre(string name);
+
/// <summary>
/// Gets a Year
/// </summary>
/// <param name="value">The value.</param>
- /// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
/// <returns>Task{Year}.</returns>
/// <exception cref="System.ArgumentOutOfRangeException"></exception>
- Task<Year> GetYear(int value, bool allowSlowProviders = false);
+ Year GetYear(int value);
/// <summary>
/// Validate and refresh the People sub-set of the IBN.
@@ -163,10 +156,10 @@ namespace MediaBrowser.Controller.Library
/// <param name="prescanTasks">The prescan tasks.</param>
/// <param name="postscanTasks">The postscan tasks.</param>
/// <param name="savers">The savers.</param>
- void AddParts(IEnumerable<IResolverIgnoreRule> rules,
- IEnumerable<IVirtualFolderCreator> pluginFolders,
- IEnumerable<IItemResolver> resolvers,
- IEnumerable<IIntroProvider> introProviders,
+ void AddParts(IEnumerable<IResolverIgnoreRule> rules,
+ IEnumerable<IVirtualFolderCreator> pluginFolders,
+ IEnumerable<IItemResolver> resolvers,
+ IEnumerable<IIntroProvider> introProviders,
IEnumerable<IBaseItemComparer> itemComparers,
IEnumerable<ILibraryPrescanTask> prescanTasks,
IEnumerable<ILibraryPostScanTask> postscanTasks,
@@ -260,7 +253,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="progress">The progress.</param>
/// <returns>Task.</returns>
Task ValidateGenres(CancellationToken cancellationToken, IProgress<double> progress);
-
+
/// <summary>
/// Validates the studios.
/// </summary>
@@ -268,7 +261,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="progress">The progress.</param>
/// <returns>Task.</returns>
Task ValidateStudios(CancellationToken cancellationToken, IProgress<double> progress);
-
+
/// <summary>
/// Occurs when [item added].
/// </summary>