fixes #258 - Provide a "Refresh This" Function

pull/702/head
Luke Pulverenti 12 years ago
parent b79c1c7b08
commit b96b2e69c2

@ -1,4 +1,6 @@
using MediaBrowser.Controller.Persistence; using System.Threading;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Querying; using MediaBrowser.Model.Querying;
using ServiceStack.ServiceHost; using ServiceStack.ServiceHost;
using System; using System;
@ -36,6 +38,12 @@ namespace MediaBrowser.Api
public int? Limit { get; set; } public int? Limit { get; set; }
} }
[Route("/Library/Refresh", "POST")]
[Api(Description = "Starts a library scan")]
public class RefreshLibrary : IReturnVoid
{
}
/// <summary> /// <summary>
/// Class LibraryService /// Class LibraryService
/// </summary> /// </summary>
@ -46,13 +54,17 @@ namespace MediaBrowser.Api
/// </summary> /// </summary>
private readonly IItemRepository _itemRepo; private readonly IItemRepository _itemRepo;
private readonly ILibraryManager _libraryManager;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="LibraryService" /> class. /// Initializes a new instance of the <see cref="LibraryService" /> class.
/// </summary> /// </summary>
/// <param name="itemRepo">The item repo.</param> /// <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; _itemRepo = itemRepo;
_libraryManager = libraryManager;
} }
/// <summary> /// <summary>
@ -67,6 +79,15 @@ namespace MediaBrowser.Api
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
/// <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> /// <summary>
/// Gets the critic reviews async. /// Gets the critic reviews async.
/// </summary> /// </summary>

Loading…
Cancel
Save