Jump to content

Saving a remote image within a IRemoteMetadataProvider


Recommended Posts

ExpedientFalcon
Posted

I have a plugin with a IRemoteMetadataProvider where I am trying to save an image file to a season item. I found a thread here recommending to use IProviderManager.SaveImage, but the code in that thread does not work since newer versions of this function require an IDirectoryService to be passed in. The issue I am seeing is that it seems my IRemoteMetadataProvider class can't access an IDirectoryService, even when I attempt to dependency inject it. I receive this error on server startup:

Quote

No registration for type MySeasonProvider could be found and an implicit registration could not be made. The constructor of type MySeasonProvider contains the parameter with name 'directoryService' and type IDirectoryService, but IDirectoryService is not registered. For IDirectoryService to be resolved, it must be registered in the container.

Is there an extra step I need to take to make this work, or possibly I need to save the image from some place other than inside IRemoteMetadataProvider.GetMetadata?

Posted

Hi, the image provider doesn’t save images, rather it tells the core server what images are available and the core server will decide  what to save based on settings in library setup.

ExpedientFalcon
Posted

Thanks, given that, if I know the URL of the remote image I want to save, in this case as the primary image for a season, how should I go about setting that in the MetadataResult that gets returned from the RemoteMetadataProvider? I have tried `result.Item.SetImage`, which does not seem to work, and `result.Item.AddImage` and `result.Images` seem to require the image to already be on the local filesystem.

Posted

There’s no way to do that from the metadata provider.

 Is there a problem with just letting server settings handle it?

ExpedientFalcon
Posted

In that case, I think I need to move back one level and ask: How do I go about letting the server know which URL to pull the image from?

Posted
2 minutes ago, ExpedientFalcon said:

In that case, I think I need to move back one level and ask: How do I go about letting the server know which URL to pull the image from?

An image provider can’t do that. It can only tell the core server what is available.

 But if your list only returns one image and your library settings only have one image provider checked, then that should get it done.

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