web-scrobbler/metadata-filter

Support custom fields

alexesprit opened this issue · 0 comments

Currently the MetadataFilter supports only 4 song fields: artist, track, album, and albumArtist. This list cannot be extended (there's a hacky way to extend, though).

I suggest to add support for custom fields, but I have some questions regarding implementation and usage.

  1. How to define custom fields?
    I suggest to pass them in a filter set:
const filter = new MetadataFilter({
    artist: fn1Ref, custom: fn2Ref,
});

filter.filterField('custom', 'Text to filter'); // Will cal the `fn2Ref` function

We can also pass a list of supported fields as a constructor parameter, but I don't like this way.

  1. How should we handle a special all field in case when a custom field is used?
    I have no idea how to "adapt" this property, so I don't mind if we remove it.

I want to use this feature to filter track art URLs in Web Scrobbler, but we could also use this one for other things. But I still doubt if we need support for custom fields.

Any thoughts on this?