Function aliases

Source
pub fn aliases(said: impl Iterator<Item = Said>, chosen: &[Chosen]) -> Aliases
Expand description

Reads the aliases out of everything the scan saw and everything the owner said.

said is every unambiguous (identifier, name) pair in the library, in any order; a file contributes one for its artist and one for its album artist when each is unambiguous, and nothing when it is not. chosen is what the person typed.

The two are resolved together, not one on top of the other. Laying a person’s statement over a finished table is where this goes wrong: if the files elect o osbourne — perfectly possible, the count decides — and the person says o osbourne gives way to Ozzy, overwriting one row leaves the other standing and the two names point at each other for ever. Every statement, from either source, is therefore read as these spellings are one artist; the spellings are gathered into groups; and each group elects one survivor, which cannot loop because there is exactly one per group.