bakes82 167 Posted January 6, 2025 Posted January 6, 2025 Im trying to refresh the meta/images of a bunch of items, but the .RefreshMetadata doesn't seem to do anything, so then I also included an update item and again it doesnt seem to do anything. If I go to the UI select them then click refresh/download new images, it will work. var foundItems = new List<long>(); foreach (var searchId in searchIds) { var foundItem = mediaItems.Where(x => x.GetProviderId(MetadataProviders.Imdb) != null && x.GetProviderId(MetadataProviders.Imdb) .Equals(searchId) || x.GetProviderId(MetadataProviders.Tvdb) != null && x.GetProviderId(MetadataProviders.Tvdb) .Equals(searchId)) .ToList(); if (foundItem.Any()) { foreach (var baseItem in foundItem) { _logger.Info($"Found Item {baseItem?.Id} {baseItem?.Name} {baseItem?.Path}"); if (baseItem != null) { foundItems.Add(baseItem.InternalId); if (collection.RefreshMetaDataOfFoundItems && DateTime.UtcNow - (collection.LastDateTimeMetaDataRefreshed ?? DateTime.MinValue) > TimeSpan.FromDays(7)) { var metadataOptions = collection.DownloadNewImages ? new MetadataRefreshOptions(new DirectoryService(BaseItem.Logger, BaseItem.FileSystem)) { MetadataRefreshMode = MetadataRefreshMode.FullRefresh, ReplaceAllImages = true, ImageRefreshMode = MetadataRefreshMode.FullRefresh } : new MetadataRefreshOptions(new DirectoryService(BaseItem.Logger, BaseItem.FileSystem)) { MetadataRefreshMode = MetadataRefreshMode.FullRefresh }; await baseItem.RefreshMetadata(metadataOptions, CancellationToken.None); //baseItem.UpdateToRepository(ItemUpdateType.ImageUpdate); _libraryManager.UpdateItem(baseItem, baseItem.Parent, ItemUpdateType.ImageUpdate); } } } if (collection.RefreshMetaDataOfFoundItems && DateTime.UtcNow - (collection.LastDateTimeMetaDataRefreshed ?? DateTime.MinValue) > TimeSpan.FromDays(7)) collection.LastDateTimeMetaDataRefreshed = DateTime.UtcNow; } else { _logger.Info($"NOT Found Item {searchId}"); } } return foundItems;
Luke 42077 Posted January 7, 2025 Posted January 7, 2025 Hi there, what makes you think it doesn't do anything?
bakes82 167 Posted January 7, 2025 Author Posted January 7, 2025 Because it's very easy to see if it was downloading new images since I have 0 on the items, but if I manually refresh the meta w/download option they will appear after a screen refresh ....
Luke 42077 Posted January 7, 2025 Posted January 7, 2025 Well how does it compare when you do it manually in the UI?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now