Jump to content

C# Refresh/Fetch metadata for a BaseItem


pünktchen

Recommended Posts

pünktchen

If i have a BaseItem that only has a ProviderId, how can i refresh all other missing metadata,
what's the method that i have to use here?

Link to comment
Share on other sites

I would just call item.RefreshMetadata. When you construct your MetadataRefreshOptions, set the MetadataRefreshMode to FullRefresh.

Link to comment
Share on other sites

pünktchen
41 minutes ago, Luke said:

When you construct your MetadataRefreshOptions

Sorry for the noob question, but how can i initialize a new MetadataRefreshOptions object?
It would be easy with something like var options = new LibraryOptions() when there' s no need for an argument like here:

public class LibraryOptions
{
    public LibraryOptions();
}

but for MetadataRefreshOptions i don't how to do that, because the needed argument is also the object i want to initialize:

public class MetadataRefreshOptions : ImageRefreshOptions
{
    public MetadataRefreshOptions(MetadataRefreshOptions copy);
}

And i connot find any existing method that would return MetadataRefreshOptions.

Link to comment
Share on other sites

pünktchen

The solution for MetadataRefreshOptions is to add IFileSystem to the plugin constructor:

public class ServerEntryPoint : IServerEntryPoint
{
    public static ServerEntryPoint Instance { get; private set; }

    public IFileSystem FileSystem;

    public ServerEntryPoint(IFileSystem fileSystem)
    {
        Instance = this;
        FileSystem = fileSystem;
    }
}

and then add that whole FileSystem as argument to initialize new MetadataRefreshOptions:

var options = new MetadataRefreshOptions(ServerEntryPoint.Instance.FileSystem)

 

  • Thanks 1
Link to comment
Share on other sites

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...