
The statement is used to attempt to establish a mapping between the track metadata returned by a Discogs Metadata for Release or MusicBrainz Metadata for Release statement and the current set of files. If the metadata was downloaded as a key-value list you must specify the named variable which contains the metadata. If the metadata was downloaded as a container, you must specify the name of the container.
You establish the same criteria as in the Discogs or MusicBrainz wizards. You can specify the source of the file based metadata used for mapping in one of three ways:
track number title
track number - title
track number . title
You can also choose to use a tracks's duration to assist in the mapping.
The Title Truncation pattern can be used to remove the tail of a Title field. If you are placing featuring information on Title fields, the artist information can hinder matching against titles in the online metadata. For example if you use Feat. as the start of your featuring specifications, you would specify Feat. in the Title Truncation field.
A percentage score of a match is evaluated based on a fuzzy comparison between the downloaded metadata title and:
A track variable is specified to receive the result of a mapping. The index is a 0 based index into the Track List item in the extracted metadata. If not mapped the variable will be set to -1.
A track variable is specified to receive the score. A value of 0 through 100 is returned. If not mapped the variable will be set to 0.
If the metadata cannot be parsed or if a required template cannot be found, the action test state will be set to false. Otherwise, it will be set to true.
Escape sequences described in Escape Sequences can be used in any text field.
The statement is not valid during grouped execution.
A few items to think about:
Here's a simplistic example as to how to extract the metadata:
' Get metadata for a release
Discogs Metadata for Release "1737909" to container 'metadata'
' Map the metadata to the active files
Map Metadata to Files metadata in container 'metadata', mode(Tag Embedded Metadata), index(V0), score(V1), Use(Title, Artist, Track, Disc, Duration)
' Set the action test state for each file which was mapped
Test if the integer value of the Variable 0 field >= 0 (Set test state and per file test state)
' Extract the Title metadata for a mapped file
Run inline action 'Extract Title' grouped if per file test state is true
Start Extract Title
Extract (Node) data from the container item at 'metadata.Track List[\v0].Title' to named variable 'extracted title'
if true
Copy named variable 'extracted title' to the Title field
endifWhile initially designed to work with the metadata returned by the Discogs Metadata for Release and MusicBrainz Metadata for Release statements, you can also construct your own metadata list. This is done in a variety of actions on the resources web page.
The only required field is the Track list array. Each Track list item can contain the following items: Artist, Title, Track number, Disc number and Length. If you are constructing a container the numeric fields can be Numbers or Strings. Omitted items will be treated as empty or 0.
If you want to include a test for a perfect filename match for data you have constructed you can do so if the mode is Tag Embedded Metadata. Add an item named __filename__ to the Track list items. If a track's filename is an exact match for the __filename__ item, it will always be mapped to that item. The track's score will be 100%. The double leading and trailing underscores were chosen to ensure that the item will not collide with any possible future Discogs or MusicBrainz returned metadata.
If you want to consider album metadata when mapping, add an item named __album__ to the Track list items. The double leading and trailing underscores were chosen to ensure that the item will not collide with any possible future Discogs or MusicBrainz returned metadata.