To implement metadata plugin:
- Read the introduction to extensions and plugins.
- Create new public class inheriting from MetadataPlugin abstract class.
- Add implementation for mandatory abstract members.
|Id||Unique plugin id.|
|SupportedFields||Returns list of metadata fields this plugin can generally provide.|
|GetMetadataProvider||Returns metadata provider class for specific metadata request.|
OnDemandMetadataProvider is an object to be returned from
GetMetadataProvider method. Playnite uses it to request specific metadata fields based on user's metadata download settings. Override specific
Get* methods based on what your plugin can provide. The class also contains another implementation of
AvailableFields property, which should return list available fields for specific request.
IDisposable and object is disposed automatically once metadata are processed completely for a single game.
MetadataRequestOptions is passed into every
GetMetadataProvider request for each specific game. Most important fields are
IsBackgroundDownloadindicates whether the download is being processed in background. By either automatically started download for newly imported games or manually initiated bulk download. When set to false it indicates that download is for manually initiated request from game edit dialog.
GameDatacontains game that should be updated we new metadata.
Some fields like
Tags and others that are globally stored as static values and shared between games are referenced by metadata sources via
MetadataProperty. Based on what type is used to reference metadata, Playnite will use different method to assign final data.
Available property types:
|MetadataNameProperty||Playnite will assign field value based on a name (Playnite 8 behavior). If fields with the same name exists in game library, it's reused.|
|MetadataIdProperty||Playnite will assign field value based on objects database ID. Use if you want to reference specific object already existing in the game library.|
|MetadataSpecProperty||Playnite will assign filed value based on specification identifier. Currently only available for Platforms and Regions. Identifier matches based on an ID or a Name.|
MetadataIdProperty should be used only when directly referencing existing items from game library. Do not add metadata fields into the library manually and then reference those added items via
MetadataIdProperty. In majority of cases only
MetadataSpecProperty should be used. Playnite will automatically add new items to the library when specified items don't exist and will automatically reference existing items if specified items already exist, including handling of duplicates and indirect duplicates like "single player" vs "single-player".
Playnite's IGDB integration is implemented as a metadata plugin. You can see the source on GitHub.