Function: toCommonMetadata()
function toCommonMetadata(metadata: TagMap): CommonMetadata;
Defined in: packages/player/src/common-metadata.ts:150
Normalise a raw mpv tag map into CommonMetadata.
Parameters
| Parameter | Type | Description |
|---|---|---|
metadata | TagMap | The map from Player.getMetadata(). |
Returns
The normalised view. Fields with no usable tag are absent, never empty strings.
Remarks
The whole mapping table, so nothing here is a mystery. The left column is matched case-insensitively, in order, and the first non-empty tag wins:
| field | tags, in priority order |
|---|---|
title | title, icy-title |
artist | artist, author, performer |
album | album |
albumArtist | album_artist, albumartist, album artist, tpe2 |
trackNumber / trackCount | track, tracknumber, trck (+ tracktotal, totaltracks) |
discNumber / discCount | disc, discnumber, tpos (+ disctotal, totaldiscs) |
year | date, year, originaldate, originalyear, tyer |
genre | genre, icy-genre |
composer | composer |
comment | comment, description |
station | icy-name |
streamTitle | icy-title |
bitrateKbps | icy-br |
Everything else in the file is still in getMetadata(); this is a
convenience over that map, not a filter on it. It reads the map it is given
and performs no I/O, which is what makes it testable with a plain object —
and why it is exported rather than hidden inside the player.