From 95afe143e8c6cd2dfa93cae3421d64b9885dfcba Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 22 May 2013 00:21:36 -0400 Subject: [PATCH] add refresh item api method --- MediaBrowser.Api/LibraryService.cs | 24 +++++++++- .../Providers/ProviderManager.cs | 47 ++----------------- 2 files changed, 26 insertions(+), 45 deletions(-) diff --git a/MediaBrowser.Api/LibraryService.cs b/MediaBrowser.Api/LibraryService.cs index 87bf08e63..1018053cc 100644 --- a/MediaBrowser.Api/LibraryService.cs +++ b/MediaBrowser.Api/LibraryService.cs @@ -96,6 +96,17 @@ namespace MediaBrowser.Api { } + [Route("/Items/{Id}/Refresh", "POST")] + [Api(Description = "Refreshes metadata for an item")] + public class RefreshItem : IReturnVoid + { + [ApiMember(Name = "IsForced", Description = "Indicates if a normal or forced refresh should occur.", IsRequired = true, DataType = "bool", ParameterType = "query", Verb = "POST")] + public bool IsForced { 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 +315,17 @@ 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); + + item.RefreshMetadata(CancellationToken.None, forceRefresh: request.IsForced); + } + /// /// Gets the specified request. /// @@ -467,7 +489,7 @@ namespace MediaBrowser.Api { var artists1 = item1.RecursiveChildren .OfType