Jump to content

What is MetadataRefreshOptions of ILibraryManager.UpdateItem?


Recommended Posts

pünktchen
Posted

@Luke ILibraryManager.UpdateItem

void UpdateItem(BaseItem item, BaseItem parent, ItemUpdateType updateReason, MetadataRefreshOptions metadataRefreshOptions);

has a new parameter MetadataRefreshOptions that needs some argument

public MetadataRefreshOptions(IFileSystem fileSystem);
public MetadataRefreshOptions(IDirectoryService directoryService);
public MetadataRefreshOptions(MetadataRefreshOptions copy);

Where do i get "copy"? Isn't this an infinite loop?

Posted

It's to pass the current library scan options all the way through the save operation. For today's purposes, you can pass in null. I will add back the overload for the method that doesn't use that so that you can just omit it altogether.

  • Like 1
  • 3 months later...
Posted

Hey @Luke, I see that when I use the latest MediaBrowser.Server.Core (4.7.3), that now has the extra MetadataRefreshOptions parameter, when I pass through null when updating a collection, it removes the images from the item. So basically I add and remove items from a collection via AddCollectionInfo and RemoveCollection on the base item and then call UpdateItems with UpdateItemType.None. This used to work without issue before the update. I'm not sure what I can pass here. Is that the best way to create/edit collections to begin with. (sorry can't find much docs). Thanks in advance.

Posted
4 hours ago, ShaneP said:

Hey @Luke, I see that when I use the latest MediaBrowser.Server.Core (4.7.3), that now has the extra MetadataRefreshOptions parameter, when I pass through null when updating a collection, it removes the images from the item. So basically I add and remove items from a collection via AddCollectionInfo and RemoveCollection on the base item and then call UpdateItems with UpdateItemType.None. This used to work without issue before the update. I'm not sure what I can pass here. Is that the best way to create/edit collections to begin with. (sorry can't find much docs). Thanks in advance.

You can't do that. I would pass in UpdateItemType.Edit since that's what you actually did.

But instead of all of that I would use the dedicated ICollectionManager in MediaBrowser.Controller.Collections

Posted
1 hour ago, Luke said:

You can't do that. I would pass in UpdateItemType.Edit since that's what you actually did.

But instead of all of that I would use the dedicated ICollectionManager in MediaBrowser.Controller.Collections

Thanks @Luke that work like a charm (ICollectionManager)!

  • Thanks 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...