diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-05-20 23:16:43 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-05-20 23:16:43 -0400 |
| commit | f3a7307ebb9a1a484a82563c4cfab6bf461c7631 (patch) | |
| tree | 9cfc2177081b9713215e4453b45e4213dc67c200 /MediaBrowser.Controller/Library | |
| parent | 96e8f053b56a385dc0f8c8e2c81fd0ac23794692 (diff) | |
reduce requests against tvdb by getting entire series metadata at once
Diffstat (limited to 'MediaBrowser.Controller/Library')
| -rw-r--r-- | MediaBrowser.Controller/Library/ILibraryManager.cs | 11 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/ILibraryPrescanTask.cs | 20 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/TVUtils.cs | 20 |
3 files changed, 44 insertions, 7 deletions
diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 89d17758e..0917fa276 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -11,6 +11,9 @@ using System.Threading.Tasks; namespace MediaBrowser.Controller.Library { + /// <summary> + /// Interface ILibraryManager + /// </summary> public interface ILibraryManager { /// <summary> @@ -140,11 +143,13 @@ namespace MediaBrowser.Controller.Library /// <param name="resolvers">The resolvers.</param> /// <param name="introProviders">The intro providers.</param> /// <param name="itemComparers">The item comparers.</param> + /// <param name="prescanTasks">The prescan tasks.</param> void AddParts(IEnumerable<IResolverIgnoreRule> rules, IEnumerable<IVirtualFolderCreator> pluginFolders, IEnumerable<IItemResolver> resolvers, IEnumerable<IIntroProvider> introProviders, - IEnumerable<IBaseItemComparer> itemComparers); + IEnumerable<IBaseItemComparer> itemComparers, + IEnumerable<ILibraryPrescanTask> prescanTasks); /// <summary> /// Sorts the specified items. @@ -160,7 +165,7 @@ namespace MediaBrowser.Controller.Library /// <summary> /// Ensure supplied item has only one instance throughout /// </summary> - /// <param name="item"></param> + /// <param name="item">The item.</param> /// <returns>The proper instance to the item</returns> BaseItem GetOrAddByReferenceItem(BaseItem item); @@ -186,7 +191,7 @@ namespace MediaBrowser.Controller.Library /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> Task UpdateItem(BaseItem item, CancellationToken cancellationToken); - + /// <summary> /// Retrieves the item. /// </summary> diff --git a/MediaBrowser.Controller/Library/ILibraryPrescanTask.cs b/MediaBrowser.Controller/Library/ILibraryPrescanTask.cs new file mode 100644 index 000000000..6a48ba777 --- /dev/null +++ b/MediaBrowser.Controller/Library/ILibraryPrescanTask.cs @@ -0,0 +1,20 @@ +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Library +{ + /// <summary> + /// An interface for tasks that run prior to the media library scan + /// </summary> + public interface ILibraryPrescanTask + { + /// <summary> + /// Runs the specified progress. + /// </summary> + /// <param name="progress">The progress.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task.</returns> + Task Run(IProgress<double> progress, CancellationToken cancellationToken); + } +} diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs index 8bd1c270d..6a220c6d7 100644 --- a/MediaBrowser.Controller/Library/TVUtils.cs +++ b/MediaBrowser.Controller/Library/TVUtils.cs @@ -1,7 +1,7 @@ -using System.Globalization; -using MediaBrowser.Controller.Resolvers; +using MediaBrowser.Controller.Resolvers; using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Text.RegularExpressions; @@ -243,7 +243,7 @@ namespace MediaBrowser.Controller.Library /// </summary> /// <param name="fullPath">The full path.</param> /// <returns>System.String.</returns> - public static string SeasonNumberFromEpisodeFile(string fullPath) + public static int? GetSeasonNumberFromEpisodeFile(string fullPath) { string fl = fullPath.ToLower(); foreach (var r in EpisodeExpressions) @@ -253,7 +253,19 @@ namespace MediaBrowser.Controller.Library { Group g = m.Groups["seasonnumber"]; if (g != null) - return g.Value; + { + var val = g.Value; + + if (!string.IsNullOrWhiteSpace(val)) + { + int num; + + if (int.TryParse(val, NumberStyles.Integer, UsCulture, out num)) + { + return num; + } + } + } return null; } } |
