index: Index MusicBrainz album IDs from music files.

Index "MusicBrainz Album ID" ID3v2 frames as
"musicbrainzalbumid" media tags to facilitate downloading
cover art from coverartarchive.org.

Change-Id: Ie81017dd6f76ec355ee0d1daedfb7180cb70ad59
This commit is contained in:
Daniel Erat 2014-05-05 20:45:58 -07:00
parent 81cfa6f39f
commit aa391ecdd1
4 changed files with 12 additions and 10 deletions

Binary file not shown.

View File

@ -406,6 +406,7 @@ func Index(t *testing.T, initIdx func() *index.Index) {
{"artist", "Test Artist"},
{"album", "Test Album"},
{"genre", "(20)Alternative"},
{"musicbrainzalbumid", "00000000-0000-0000-0000-000000000000"},
{"year", "1992"},
{"track", "1"},
{"disc", "2"},

View File

@ -567,15 +567,16 @@ func indexMusic(r types.SizeReaderAt, wholeRef blob.Ref, mm *mutationMap) {
// Note: if you add to this map, please update
// pkg/search/query.go's MediaTagConstraint Tag docs.
tags := map[string]string{
"title": tag.Title(),
"artist": tag.Artist(),
"album": tag.Album(),
"genre": tag.Genre(),
"year": yearStr,
"track": trackStr,
"disc": discStr,
"mediaref": mediaRef.String(),
"durationms": durationStr,
"title": tag.Title(),
"artist": tag.Artist(),
"album": tag.Album(),
"genre": tag.Genre(),
"musicbrainzalbumid": tag.CustomFrames()["MusicBrainz Album Id"],
"year": yearStr,
"track": trackStr,
"disc": discStr,
"mediaref": mediaRef.String(),
"durationms": durationStr,
}
for tag, value := range tags {

View File

@ -333,7 +333,7 @@ type FileConstraint struct {
type MediaTagConstraint struct {
// Tag is the tag to match.
// For ID3, this includes: title, artist, album, genre, year, track, disc, mediaref, durationms.
// For ID3, this includes: title, artist, album, genre, musicbrainzalbumid, year, track, disc, mediaref, durationms.
Tag string `json:"tag"`
String *StringConstraint `json:"string,omitempty"`