Skip to content
sampsyo edited this page Feb 9, 2012 · 22 revisions

Refactoring Plans

  • Shrink the interface size of the metadata backend API by unifying ID lookups with string-based lookups. Currently, beets.autotag.hooks has four functions per that abstract DB lookups: _album_for_id, _track_for_id, _album_candidates, and _item_candidates. It would be nice to collapse this into just two functions, especially as we look at adding new (non-MB) backends via a plugin API.
  • Stop using a namespace package for beets plugins. This is causing headaches because pip-installed packages have problems with namespace packages. Flask has moved away from a flaskext package, so it might be wise to use Armin's example there.
  • Remove or fix mb_artist_id tagging (which currently arbitrarily picks the first credit). A user mentioned that other taggers (Jaikoz and MediaMonkey) fill this field with a null-separated list of IDs, which seems much more useful.
  • Build a performance analyzer for the pipeline module to help optimize the importer pipeline stage decomposition.
  • Is difflib.ratio() a Levenshtein distance implementation? If so, replace our hand-rolled one and see if it's faster.
  • Experiment with a NoSQL-style database. Two good candidates include sqlitedict and sqlite3dbm.
  • Move config and state files into a directory: ~/.config/beets on Unix, ~/Application Support/beets on Mac OS X, something else on Windows.
  • Move to YAML for the config file. Probably at the same time, build a nice, declarative system for configuration including the following:
    • Declare defaults in a straightforward way (probably using a standalone "default.yaml").
    • Declaratively specify command-line options (probably using argparse) that override config file options. Make it easy to add both at once.
    • Find a reasonable way to just pass a big config object around instead of messing around with all these Library() parameters and the ImportConfig object.
    • It would be great if the config file could be loaded before the command line is fully parsed. This would let plugins' configure() methods run with debug mode enabled.
  • Asynchronous import decisions. This is an idea due to martian on IRC. When importing, don't necessarily force a user's decision immediately. Importing is a multi-step process: add to library, look up in MB, make decisions, and copy/write files. This way, a fast process could index everything and then decisions could be made offline. Possibly using an alternate interface, maybe a GUI.
  • Resolve some strange behavior w.r.t. album-level fields and the update command. When there's an item with an inconsistent item-level field (i.e., two different items in the album have different values for the same album-level field) that is not written by the autotagger, it will get clobbered back to the uniform value even after beet update. The effect is that just importing and then immediately running update shows changes! That's confusing. The importer should probably enforce that all album-level fields are uniform.
  • Album art should be moved to a plugin. In addition to its current, automatic functionality, the plugin should be able to be run as a command (fetching art post-import for albums that are missing it).
Clone this wiki locally