Skip to content

Commit

Permalink
expose musicbrainz metadata if available
Browse files Browse the repository at this point in the history
  • Loading branch information
tpeacock19 authored and hoyon committed Sep 10, 2022
1 parent 6f07b20 commit 8974cb7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions mpris.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,25 @@ static GVariant *create_metadata(UserData *ud)
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/Album", "xesam:album");
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/Genre", "xesam:genre");

/* Musicbrainz metadata mappings
(https://picard-docs.musicbrainz.org/en/appendices/tag_mapping.html) */

// IDv3 metadata format
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/MusicBrainz Artist Id", "mb:artistId");
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/MusicBrainz Track Id", "mb:recordingId");
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/MusicBrainz Album Artist Id", "mb:releaseArtistId");
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/MusicBrainz Album Id", "mb:releaseId");
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/MusicBrainz Release Track Id", "mb:trackId");
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/MusicBrainz Work Id", "mb:workId");

// Vorbis & APEv2 metadata format
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/MUSICBRAINZ_ARTISTID", "mb:artistId");
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/MUSICBRAINZ_TRACKID", "mb:recordingId");
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/MUSICBRAINZ_ALBUMARTISTID", "mb:releaseArtistId");
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/MUSICBRAINZ_ALBUMID", "mb:releaseId");
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/MUSICBRAINZ_RELEASETRACKID", "mb:trackId");
add_metadata_item_string(ud->mpv, &dict, "metadata/by-key/MUSICBRAINZ_WORKID", "mb:workId");

add_metadata_item_string_list(ud->mpv, &dict, "metadata/by-key/uploader", "xesam:artist");
add_metadata_item_string_list(ud->mpv, &dict, "metadata/by-key/Artist", "xesam:artist");
add_metadata_item_string_list(ud->mpv, &dict, "metadata/by-key/Album_Artist", "xesam:albumArtist");
Expand Down

0 comments on commit 8974cb7

Please sign in to comment.