Jump to content

Recommended Posts

Posted

In my plugin I have successfully implemented Movie and Series Providers without any issues based on the examples from the Anime plugin.

Now I am trying to do the same for people with no success. I have tried it first by implementing IRemoteMetadataProvider and when that didn't work I tested ILocalMetadataProvider also with no success. 

While debugging with breakpoints on the GetMetadata and GetSearchResults methods it seems like they are simply never called. Not while adding a person, not while manually refreshing the metadata and not while using the identify search.

 

For reference these are my classes, stripped down to the minimum for testing:

IRemoteMetadataProvider

    class MediaServerDBPersonProvider : IRemoteMetadataProvider<Person, PersonLookupInfo>
    {

        private readonly ILogger _log;
        private readonly IHttpClient _httpClient;
        private readonly IApplicationPaths _paths;
        private readonly IDirectoryService _directoryService;
        public static string provider_name = ProviderNames.MediaServerDB;
        public string Name => "MediaServerDB";

        public MediaServerDBPersonProvider(IHttpClient httpClient, ILogger log, IDirectoryService directoryService, IApplicationPaths paths)
        {
            _httpClient = httpClient;
            _log = log;
            _directoryService = directoryService;
            _paths = paths;
        }

        public Task<MetadataResult<Person>> GetMetadata(PersonLookupInfo info, CancellationToken cancellationToken)
        {
            return Task.FromResult<MetadataResult<Person>>(new MetadataResult<Person>());
        }

        public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(PersonLookupInfo searchInfo, CancellationToken cancellationToken)
        {
            return Task.FromResult(Enumerable.Empty<RemoteSearchResult>());
        }

        public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
        {
            return _httpClient.GetResponse(new HttpRequestOptions
            {
                CancellationToken = cancellationToken,
                Url = url
            });
        }
    }

ILocalMetadataProvider

public class MediaServerDBLocalPersonProvider : ILocalMetadataProvider<Person>
    {
        private readonly ILogger _log;
        private readonly IApplicationPaths _paths;
        public static string provider_name = ProviderNames.MediaServerDB;

        public string Name => "MediaServerDB";

        public MediaServerDBLocalPersonProvider(IApplicationPaths appPaths, ILogManager logManager)
        {
            _log = logManager.GetLogger(Name);
            _paths = appPaths;
        }

        public Task<MetadataResult<Person>> GetMetadata(ItemInfo info, IDirectoryService directoryService, CancellationToken cancellationToken)
        {
            return Task.FromResult<MetadataResult<Person>>(new MetadataResult<Person>());
        }
    }

 

One thing I noticed is that while for Movies and Series the used providers depend on the configuration of the library, the providers used for people seem to have a different configuration as even with all remote providers disabled in the library emby is still fetching remote metadata for people. So maybe I need to configure my provider to be used for people somehow?

Any help would be appreciated.

Thanks!

Posted

Okay so after some more testing I managed to figure this out myself.

The issue was the dependency injection of IDirectoryService. After removing it from the constructor the methods are called as expected.

Seems like a bug to me. Or is there a good reason for IDirectoryService not to be supported for Person entities?

Posted

Hi, we don't do searches for people by name except manually when using the identify feature, so i would test using that.

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