Fix for all folders using aunique when a non-standard key is used #4559
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is a tentative quick and dirty fix for an error that I've come across. When attempting to add the key
composer
to the keys of theaunique
function in the configuration file, a strange error occurs: every folder and file will trigger theaunique
function (so that theaunique
string is included in the folder name). This happens even when there are no conceivable duplicates, or even any other items in the library at all.Going through the code, this seems to be because, when searching for the
composer
field, the album object at that point returns no value for thecomposer
field. It does before hand but that information is dropped along the way inside thewrapper_func
function. Because of that, the final key field used to create the query at this line is empty, and so beets thinks the album needs disambiguation because the length ofambiguous_items
is 0, instead of 1.So, my fix is just to include 0 and negative numbers in that if statement. It's a quick and dirty fix and works but I think the better solution would be to find out why the other fields for the album information have been dropped and to fix that. Any hints for where to go or help would be much appreciated!
To Do
docs/
to describe it.)docs/changelog.rst
near the top of the document.)