Skip to content

Tag Mapping

AF-1 edited this page May 7, 2023 · 1 revision

You can use CTI's Tag mapping parameter to combine information from tags and store it in a new virtual tag.
Since I haven't modified tag mapping, the CustomScan rules still apply:

Create a virtual tag

There are three ways to create a virtual tag:

  • oneof - Selects information from one of several specified tags. The information will be taken from the first tag that exists.
  • combine - Concatenates information from several tags into a single tag.
  • as - Takes information from one tag. This can be used to rename tags or extract parts of a tag into a virtual tag.



For each tag in the above described ways, you can also specify how the information from a tag should be used:

  • exp - Extract information from the tag using a regular expression with a catch group.
  • text - Use the specified text instead of the tag value if the tag exists.




Example

If you have an example file with these tags (and values):

ARTIST = Lisa Stansfield
ALBUMARTIST = Whitney Houston
DATE = 1992-01-01
COMMENT = Songs-DB_Custom1: Soundtrack
GENRE = Pop 

Some example tag mappings

To get all artists

ALLARTISTS=combine ALBUMARTIST|ARTIST(text= and )|ARTIST|TRACKARTIST(text= and )|TRACKARTIST

The result for our example file will be: ALLARTISTS="Whitney Houston and Lisa Stansfield"

To get the decade

DECADE=combine DATE(exp=^(\d\d\d))|DATE(text=0)

The result for our example file will be: DECADE="1990"

To extract the custom tag information from MediaMonkey from the COMMENT tag

CUSTOM1=as COMMENT(exp=^Songs-DB_Custom1:\s*(.+)$)

The result for our example file will be: CUSTOM1="Soundtrack"

To extract the YEAR from the DATE tag:

YEAR=as DATE(exp=^(\d\d\d\d))

The result for our example file will be: YEAR="1992"

To extract the composer from the COMPOSER tag if it exists else from the ARTIST tag

COMPOSER=oneof COMPOSER|ARTIST

The result for our example file will be: COMPOSER="Lisa Stansfield".