Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

genre query directory entry for artist with missing ID results in URI that returns all albums in genre #9

Open
mfremont opened this issue Oct 16, 2017 · 1 comment

Comments

@mfremont
Copy link

When an album is missing a MusicBrainz artist ID, and that artist is included in the results of a genre query, the directory entry corresponding to that artist in the query results has a URI that returns all albums in the genre, regardless of artist.

For example, if I import the following albums into an empty library

  1. Miles Davis, The New Miles Davis Quintet (Prestige: CD OJCCD-006-2)
  2. Miles Davis, Kind of Blue (Columbia: CD CD40579)
  3. John Coltrane, A Love Supreme (impulse: CD B0000610-02)

and because there is not an exact match for The New Miles Davis Quintet in the MusicBrainz results, I select "use as is" on import, that album will not have an associated MusicBrainz artist ID.

The beets-local request/response for a jazz genre query is then:

{
  "id": 12,
  "jsonrpc": "2.0",
  "method": "core.library.browse",
  "params": {
    "uri": "beetslocal:genre?genre=Jazz"
  }
}

{
  "id": 12,
  "jsonrpc": "2.0",
  "result": [
    {
      "__model__": "Ref",
      "name": "John Coltrane",
      "type": "directory",
      "uri": "beetslocal:artist?genre=Jazz&artist=b625448e-bf4a-41c3-a421-72ad46cdb831"
    },
    {
      "__model__": "Ref",
      "name": "Miles Davis",
      "type": "directory",
      "uri": "beetslocal:artist?genre=Jazz&artist="
    },
    {
      "__model__": "Ref",
      "name": "Miles Davis",
      "type": "directory",
      "uri": "beetslocal:artist?genre=Jazz&artist=561d854a-6a28-4aa7-8c99-323e6ce46c2a"
    }
  ]
}

The URI included in the first entry for Miles Davis has an artist query param with no value. When this URI is requested when the user clicks on this artist entry in the Moped or Musicbox web UI, the result is a response that includes all of the albums in the genre:

{
  "id": 13,
  "jsonrpc": "2.0",
  "method": "core.library.browse",
  "params": {
    "uri": "beetslocal:artist?genre=Jazz&artist="
  }
}

{
  "id": 13,
  "jsonrpc": "2.0",
  "result": [
    {
      "__model__": "Ref",
      "name": "A Love Supreme",
      "type": "album",
      "uri": "beetslocal:album?album=3"
    },
    {
      "__model__": "Ref",
      "name": "Kind of Blue",
      "type": "album",
      "uri": "beetslocal:album?album=2"
    },
    {
      "__model__": "Ref",
      "name": "The New Miles Davis Quintet",
      "type": "album",
      "uri": "beetslocal:album?album=1"
    }
  ]
}

The query/response results are the same with Moped and Musicbox Webclient.

Since beets supports imports without re-tagging, and I encountered the problem of no suitable match twice in a sample of approximately 12 albums, it would be beneficial if beet-local was able to handle this scenario.

Software versions:

  • Mopidy (2.1.0)
  • Mopidy-BeetsLocal (0.0.9)
  • Mopidy-Moped (0.7.1)
  • Mopidy-MusicBox-Webclient (2.4.0)
  • beets 1.4.5 (installed via pip)
  • python 2.7.13
  • lubuntu 17.04
@mfremont
Copy link
Author

I have been able to replicate this behavior by calling BeetsLocalLibraryProvider.browse() in the REPL with the URIs and a beets database that contains just the three albums from the example above.

The general scenario is one in which the beets database includes tracks that have been tagged with a genre but mb_albumartistid is blank. This occurs when music is imported into the beets library but there is not an exact match against MusicBrainz or any of the other configured discography libraries, and the user selects the "Use as is" prompt during import.

The net result is that when BeetsLocalLibraryProvider.browse() is called to return the list of artists for that genre, an album with a blank mb_albumartistid will result in an entry whose URI has a genre param but the artist param will be missing its value, like this example: beetslocal:artist?genre=Jazz&artist=

When the user clicks through this entry corresponding to beetslocal:artist?genre=Jazz&artist=, BeetsLocalLibraryProvider._browse_album() calls beets.library.Library.albums() with the query "mb_albumartistid='' genre:'Jazz'". This beets Library method then returns all albums tagged with the specified genre.

If the goal is to facilitate browsing by artist within a genre, this problem becomes more pronounced as the number of albums in a genre increases.

One possible way to mitigate the scenario where mb_albumartistid is blank is to use the albumartist text as a key in those situations.

For example:

   {
      "id": 12,
      "jsonrpc": "2.0",
      "result": [
        {
          "__model__": "Ref",
          "name": "John Coltrane",
          "type": "directory",
          "uri": "beetslocal:artist?genre=Jazz&albumartistid=b625448e-bf4a-41c3-a421-72ad46cdb831"
        },
        {
          "__model__": "Ref",
          "name": "Miles Davis",
          "type": "directory",
          "uri": "beetslocal:artist?genre=Jazz&albumartist=Miles+Davis"
        },
        {
          "__model__": "Ref",
          "name": "Miles Davis",
          "type": "directory",
          "uri": "beetslocal:artist?genre=Jazz&albumartistid=561d854a-6a28-4aa7-8c99-323e6ce46c2a"
        }
      ]
    }

This results in two "Miles Davis" entries, so the the next step is to consider whether albumartist should simply be used as the key for beetslocal:artist URIs instead of mb_albumartistid. This would eliminate the apparent duplicate "Miles Davis" entires in this example and produce results that are reasonable from the user's perspective: all Miles Davis jazz albums.

One consequence of using only albumartist for the beets.library.Library.albums() query is that it returns substring matches:

  • albumartist:'Miles Davis' matches "Miles Davis", "Miles Davis & John Coltrane", and "Miles Davis Quartet", etc.
  • albumartist:'John Coltrane' matches "John Coltrane" and "Miles Davis & John Coltrane"
  • albumartist:'Dave Brubeck' matches "Dave Brubeck" (solo) and "Dave Brubeck Quartet"

Some users may see this is an advantage because "Miles Davis" as an entry leads one to all albums in which he is the "album artist", including various combos over the years. Depending upon the metadata tagging, there may also be entries for those specific combos like the "Miles Davis Quartet" and "Miles Davis Sextet", etc.

There are also scenarios in which a single mb_albumartistid is used even though the albumartist is different. Four albums by composer Arvo Pärt are an example of this:

  1. Litany: Arvo Pärt (ae0b2424-d4c5-4c54-82ac-fe3be5453270)
  2. Tabula Rasa: Arvo Pärt (ae0b2424-d4c5-4c54-82ac-fe3be5453270)
  3. Da Pacem: Arvo Pärt; Eesti Filharmoonia Kammerkoor, Paul Hillier (ae0b2424-d4c5-4c54-82ac-fe3be5453270)
  4. Te Deum: Arvo Pärt; Eesti Filharmoonia Kammerkoor, Tallinna Kammerorkester, Tõnu Kaljuste (ae0b2424-d4c5-4c54-82ac-fe3be5453270)

In these cases, the current code returns three artist directory entries

  1. Arvo Pärt
  2. Arvo Pärt; Eesti Filharmoonia Kammerkoor, Paul Hillier
  3. Arvo Pärt; Eesti Filharmoonia Kammerkoor, Tallinna Kammerorkester, Tõnu Kaljuste

each of which returns all four albums because the mb_albumartistid is the same despite the fact that the albumartist text is different.

Depending upon one's perspective, using albumartist for the album query might be viewed as an improvement compared to the result of clicking through one of the more specific "artist" entries only to see all four albums by the composer. The query albumartist:'Arvo Pärt' returns all four, but albumartist:'Arvo Pärt; Eesti Filharmoonia Kammerkoor, Paul Hillier' returns just Da Pacem. This is not a situation unique to this particular composer; in fact, it seems to be common among classical albums in my collection that have been tagged with the results of MusicBrainz matches.

Thoughts on the best approach to improve the user experience?

Would you be willing to consider a pull request on a mutually agreeable solution?

mfremont added a commit to mfremont/mopidy-beets-local that referenced this issue Mar 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant