diff --git a/MediaBrowser.Api/LibraryService.cs b/MediaBrowser.Api/LibraryService.cs index 87bf08e63..f1e9e6f9a 100644 --- a/MediaBrowser.Api/LibraryService.cs +++ b/MediaBrowser.Api/LibraryService.cs @@ -96,6 +96,20 @@ namespace MediaBrowser.Api { } + [Route("/Items/{Id}/Refresh", "POST")] + [Api(Description = "Refreshes metadata for an item")] + public class RefreshItem : IReturnVoid + { + [ApiMember(Name = "Forced", Description = "Indicates if a normal or forced refresh should occur.", IsRequired = true, DataType = "bool", ParameterType = "query", Verb = "POST")] + public bool Forced { get; set; } + + [ApiMember(Name = "Recursive", Description = "Indicates if the refresh should occur recursively.", IsRequired = true, DataType = "bool", ParameterType = "query", Verb = "POST")] + public bool Recursive { get; set; } + + [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] + public string Id { get; set; } + } + [Route("/Items/Counts", "GET")] [Api(Description = "Gets counts of various item types")] public class GetItemCounts : IReturn @@ -304,6 +318,26 @@ namespace MediaBrowser.Api return ToOptimizedResult(result); } + /// + /// Posts the specified request. + /// + /// The request. + public void Post(RefreshItem request) + { + var item = DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager); + + var folder = item as Folder; + + if (folder != null) + { + folder.ValidateChildren(new Progress(), CancellationToken.None, request.Recursive, request.Forced); + } + else + { + item.RefreshMetadata(CancellationToken.None, forceRefresh: request.Forced); + } + } + /// /// Gets the specified request. /// @@ -467,7 +501,7 @@ namespace MediaBrowser.Api { var artists1 = item1.RecursiveChildren .OfType