sampsyo/beets — pull request #1082 by greenpart (2014-11-13 15:37:36+00:00)
Title: ProximitySortPlugin for distance-based sorting

This plugin allows to find values close to some point. For example DJ can look for tracks with bpm 120 and around. My rationale is to find closest values of self-defined flex field.

Sort plugin hook is based on query plugin idea. Providing something after `+` or `-` in the sort term will force appropriate plugin to handle this sorting. ProximitySortPlugin registers itself on the `^` symbol.
In this case `beet ls bpm+^90` command will list tracks with bpm 90, 89, 91, 88, 92, etc.

ProximitySortPlugin sorts fixed fields in DB. Flex and computed fields sorted using python.