From 04bc137fb30b82e699bc8ea5d84479f01ad6c6ca Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 1 Dec 2013 01:25:05 -0500 Subject: [PATCH] make dontfetchmeta changes recursive --- MediaBrowser.Api/ItemUpdateService.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index 95876f1a5..48d292bbc 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -105,13 +105,27 @@ namespace MediaBrowser.Api Task.WaitAll(task); } - private Task UpdateItem(UpdateItem request) + private async Task UpdateItem(UpdateItem request) { var item = _dtoService.GetItemByDtoId(request.ItemId); + var newEnableInternetProviders = request.EnableInternetProviders ?? true; + var dontFetchMetaChanged = item.DontFetchMeta != !newEnableInternetProviders; + UpdateItem(request, item); - return _libraryManager.UpdateItem(item, ItemUpdateType.MetadataEdit, CancellationToken.None); + await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); + + if (dontFetchMetaChanged && item.IsFolder) + { + var folder = (Folder)item; + + foreach (var child in folder.RecursiveChildren.ToList()) + { + child.DontFetchMeta = !newEnableInternetProviders; + await _libraryManager.UpdateItem(child, ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); + } + } } public void Post(UpdatePerson request)