Custom tag mappings when reading and writing metadata
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
Beets currently has a predefined mapping between fields in the database and the tags they're written to for the different file formats. In some cases a field is read from or written to multiple tags (e.g. `tracktotal` is written to `TRACKTOTAL`, `TRACKC`, and `TOTALTRACKS` Vorbis comment fields which I understand is to be compatible with a variety of music software.
Many users would like to have more control over which fields are written to files and what tag names are used when doing so. This can be achieved by introducing a new configuration where the user can specify their desired mapping.
I think the biggest concern if this is to be implemented is the difference between the various audio file formats. While Vorbis comments allow free form tags, ASF, MP3 and MP4 storage styles have a more strict structure. My recommendation would be to support this custom mapping only for Vorbis comments and follow the default mapping for the other storage styles. While this will introduce a disparity between the different formats, I don't think the more restrictive formats should hold beets back from supporting a very useful customization.
While the plan for this feature request is to customize the mappings for the standard fields beets knows about, it can serve as the foundation for allowing writing (and reading) flexible attributes to files. That would make it easier for implementing issues such as #122.
I have done a small prototype where I modified the storage styles used by the MediaField descriptor assigned to the lyrics field mediafile.py based on a configuration. It seems to work as far as I can tell. I was able to write the lyrics field to a custom tag of my choosing (one, multiple or zero tags) for a FLAC file.
Contributor guide
Assessment
This issue has not been assessed yet.