I’ve been implementing a meta data agent for the DVD Profiler movie collection manager and managed to get it working very nicely as a standalone primary agent. However it would be even better if I could combine the meta data with other existing sources. Especially what are lacking in the DVD Profiler data are the fanarts/backdrops.
I thought that the “contributes to”/“accepts from” mechanism would be perfect for the job. But I discovered two major problems:
1. The search method of a contributing (non-primary) agent is NOT called if the primary agent fails to find a match
In my case I have a collection of ~1000 movies of which about half are children’s movies with localised title names. So the IMDB/Freebase agent does not find a match for these and thus my contributing agent’s search method is never called. Since I have all my movies in the DVD Profiler database, a match would always be found.
It seems that the mechanism has been written with an assumption that the contributing agents are dependent on the primary agent’s matching. Taking a look on the Freebase agent chain, you can easily see that the contributing agents (eg. TheMovieDB) use the IMDB ID to derive their own search ID. Nothing wrong with this but it would even better if the contributing agents could make their own shot on getting a match.
I know that there is the fallback_agent attribute which can be set in case the agent is unable to find a match. But this is now hardcoded in the agent’s source code and should at least be made configurable in similar way to the agent chain itself.
So what if I made my agent the primary one? Well, this fails because all the existing contributing agents assume that the primary metadata id is an IMDB id. And the IMDB/Freebase cannot be used as the first contributing, non-primary, agent due to problem number 2 (see below).
2. Media object is not populated in contributing agents search method
When the search method of a contributing agent is called the media object does not contain media information like the filename of the media (media.items[0].parts[0].file). This seems like a bug to me since the media information is provided correctly in the update method. This problem effectively prevents using primary agents as contributing ones.
It would be perfect if three changes could be made to contributing agent framework:
- Call search functions of contributing agents also when there is no match with the primary agent
- Provide correctly populated media object to contributing agent’s search method
- Add fallback_agent as a configuration item for an agent. This is optional in case number 1 cannot be implemented.