diff --git a/MediaBrowser.Api/LibraryService.cs b/MediaBrowser.Api/LibraryService.cs
index a6e7598aaa..d5d90cdb25 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
+ {
+ }
+
///
/// Class LibraryService
///
@@ -46,13 +54,17 @@ namespace MediaBrowser.Api
///
private readonly IItemRepository _itemRepo;
+ private readonly ILibraryManager _libraryManager;
+
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The item repo.
- public LibraryService(IItemRepository itemRepo)
+ /// The library manager.
+ public LibraryService(IItemRepository itemRepo, ILibraryManager libraryManager)
{
_itemRepo = itemRepo;
+ _libraryManager = libraryManager;
}
///
@@ -67,6 +79,15 @@ namespace MediaBrowser.Api
return ToOptimizedResult(result);
}
+ ///
+ /// Posts the specified request.
+ ///
+ /// The request.
+ public void Post(RefreshLibrary request)
+ {
+ _libraryManager.ValidateMediaLibrary(new Progress(), CancellationToken.None);
+ }
+
///
/// Gets the critic reviews async.
///