Holzhaus / beets-extrafiles

A plugin for beets that copies additional files and directories during the import process.
MIT License
46 stars 10 forks source link

Reorder configuration data structure #17

Open FichteFoll opened 4 years ago

FichteFoll commented 4 years ago

The current configuration is structured as follows:

extrafiles:
  patterns:
    artworkdir:
      - '[sS]cans/'
      - '[aA]rtwork/'
  paths:
      artworkdir: $albumpath/artwork

Here, patterns and paths are keyed by a user-defined name to relate the two different setting parts to each other.

However, they live in a 1:1 relation (or 1:0 if no path is specified) and there is no option apply a path format to multiple patterns, so it would be cleaner to combine them into a single element and get rid of the name abstraction as follows:

extrafiles:
  rules:
    - patterns:
        - '[sS]cans/'
        - '[aA]rtwork/'
      path: $albumpath/artwork

This way, all the options relevant to one pattern group are closely next to each other, which makes the configuration easier to read (less jumping around) and easier to write (no way to misspell the group name).

Another advantage is that rules can be cleanly matched in order and don't depend on however the order of the internal dictionary happens to be (which should be in parse order for Python 3.6+ but is undefined for older versions).

Please correct me if I made a wrong conclusion from the README or source.