Skip to content

Conversation

@rtoijala
Copy link

@rtoijala rtoijala commented Oct 2, 2019

When adding a random album, the album artist intuitively should
be the same for all added songs. Currently, this is not so,
so when adding e.g. 'Greatest Hits' you can get many different albums.

Fix this by randomly selecting one album artist whose songs to add.
See comment inside the code for (insignificant) limitations.

Fixes Github issue #159.
This replaces pull request #198, since I some time ago deleted the repo that was based on.

@arybczak
Copy link
Collaborator

It looks like this isn't going to work if the album artist tag is missing 🤔

When adding a random album, the album artist intuitively should
be the same for all added songs. Currently, this is not so,
so when adding e.g. 'Greatest Hits' you can get many different albums.

Fix this by randomly selecting one album artist whose songs to add.
See comment inside the code for (insignificant) limitations.

Fixes Github issue ncmpcpp#159.
@rtoijala
Copy link
Author

I rebased on top of 0.9.2 since that is the version I could easily compile and run using the Arch Linux PKGBUILD.

I updated the logic around missing album artist tags. It now works in a way I consider sensible:

  • If an album has no album artists, we consider it to have the empty string as the album artist. This means that if there are two such albums with the same name, they are treated as one larger album. We cannot in code distinguish between albums of the same name if they have no album artists.
  • We collect the set of album artists (including the empty string if there are albums without album artists).
  • We pick one album artist form that set.
  • We add all songs with the chosen album name and album artist (again treating no albums artists as the empty string).
  • If there is only one album artist for the album name, we just add all the songs for that album.

I have tested this with databases with all album artists present, with no album artists present, and with some album artists present and some missing.

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

Successfully merging this pull request may close these issues.

2 participants