aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/LibraryService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-05-12 21:46:36 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-05-12 21:46:36 -0400
commitb96b2e69c23cff03e11ab5c222ec98f3fe89586c (patch)
tree9ae8b9fdc99f4ca5a13117d130f4ee3fe8db806f /MediaBrowser.Api/LibraryService.cs
parentb79c1c7b0827844d79a62db2f7eca3125fa3d9ba (diff)
fixes #258 - Provide a "Refresh This" Function
Diffstat (limited to 'MediaBrowser.Api/LibraryService.cs')
-rw-r--r--MediaBrowser.Api/LibraryService.cs27
1 files changed, 24 insertions, 3 deletions
diff --git a/MediaBrowser.Api/LibraryService.cs b/MediaBrowser.Api/LibraryService.cs
index a6e7598aa..d5d90cdb2 100644
--- a/MediaBrowser.Api/LibraryService.cs
+++ b/MediaBrowser.Api/LibraryService.cs
@@ -1,4 +1,6 @@
-using MediaBrowser.Controller.Persistence;
+using System.Threading;
+using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Querying;
using ServiceStack.ServiceHost;
using System;
@@ -36,6 +38,12 @@ namespace MediaBrowser.Api
public int? Limit { get; set; }
}
+ [Route("/Library/Refresh", "POST")]
+ [Api(Description = "Starts a library scan")]
+ public class RefreshLibrary : IReturnVoid
+ {
+ }
+
/// <summary>
/// Class LibraryService
/// </summary>
@@ -46,13 +54,17 @@ namespace MediaBrowser.Api
/// </summary>
private readonly IItemRepository _itemRepo;
+ private readonly ILibraryManager _libraryManager;
+
/// <summary>
- /// Initializes a new instance of the <see cref="LibraryService"/> class.
+ /// Initializes a new instance of the <see cref="LibraryService" /> class.
/// </summary>
/// <param name="itemRepo">The item repo.</param>
- public LibraryService(IItemRepository itemRepo)
+ /// <param name="libraryManager">The library manager.</param>
+ public LibraryService(IItemRepository itemRepo, ILibraryManager libraryManager)
{
_itemRepo = itemRepo;
+ _libraryManager = libraryManager;
}
/// <summary>
@@ -68,6 +80,15 @@ namespace MediaBrowser.Api
}
/// <summary>
+ /// Posts the specified request.
+ /// </summary>
+ /// <param name="request">The request.</param>
+ public void Post(RefreshLibrary request)
+ {
+ _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
+ }
+
+ /// <summary>
/// Gets the critic reviews async.
/// </summary>
/// <param name="request">The request.</param>