Split track metadata from file metadata
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
Currently beets treats every track as exactly one physical file. That is, both sets of information end up in one table in the database and are used combined in the code (more or less).
Examples of track metadata include artist name, track title, album name, musicbrainz ids, etc, whereas examples for file metadata include format, sample rate, location, etc.
From my perspective it would be beneficial for a number of features to split file metadata from track metadata, but at the core it all revolves around "duplicates".
Not every duplicate is a duplicate. Maybe someone wants to keep both Vorbis/MP3/AAC and FLAC versions of releases in his collection. That means we have different file metadata for every file (obviously), but the track metadata is the same. Keeping it separate could mean we only need to fetch remote metadata (echonest, musicbrainz, etc) once, and writing it to multiple files. (I think currently we fetch it for every track, even if we've already fetched it before. I might be wrong though). It also means more logical name collision handling. Right now if I have a FLAC and a Vorbis incarnation of a release in my collection, album disambiguation kicks in as it sees them as potentially conflicting, although there really shouldn't be (unless I'm missing something).
When having multiple versions of a track available, it would be really neat to then play with "suitability", i.e. creating playlists based on what suits the intended use case best. Like for example prefering FLAC over lossy when playing audio on the local computer, but prefering lossy over FLAC when streaming, or disregarding FLAC completely when copying to an MP3 player that doesn't support it. I'm sure some people can come up with other use cases :-)
There's also a nice side effect for potential future video support. Sometimes it's handy to keep not only the video file itself, but also an audio version of the track at hand. Again the track metadata doesn't change, but splitting off the file metadata would eventually allow us to keep a video file next to an audio file, and you could again play around with when to prefer which incarnation of the track.
Contributor guide
Research direction
Start by tracing how beets currently stores and uses track and file metadata together, then examine the duplicate and album-disambiguation behavior described in the issue. Research the database model and the code paths that fetch remote metadata, handle name collisions, and select files. The work is done only when the separation and its effects on these behaviors have a defined, tested design.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100