History:Calculate Track Times
From MusicBrainz Wiki
Jump to navigationJump to search
Proposal for a better Track Times Calculation
There is a need to improve the mechanism that calculates the release track times. See also:
- Bug #1044690 - Different times in release page & TOC page
- Bug #956249 - No track lengths re-association when moving discid
- RFE #1336306 - always recalculate track times for disc id add/move/delete
- mailing list thread "Disc IDs and track lengths"
Current Mechanism
- If a release is imported from FreeDB, the track times are imported with it.
- If a release is added manually, the track times are set to ??
- If a DiscID is added to a release with all track times set to ??, the track times are set from the DiscID.
Causes of Incorrect Track Times
- AutoInsertFromFreeDB MultiSessionCDs affected by the MultiSessionCDBug.
- Releases which were manually added and then given the wrong DiscID.
- FreeDB imported releases (with track times) that someone has later done a AddTrackEdit (aka FrankenAlbums!!). These will have time ?? for the extra track, but adding a DiscID will not set the track time, since the other tracks have a time.
Problems with Current Mechanism
- Currently the only way of fixing an incorrect track time is an ugly, time consuming workaround - reimporting the disc from FreeDB with the correct times, then merging the old release into the new.
- It's not easy to audit the source of track times (e.g. due to moving DiscIDs or merging releases).
Proposed Mechanism
I propose a very simple change to the code:
When a release has exactly one DiscID, recalcuate the track times.
So this would be triggered:
- When the first DiscID is added to any release.
- When the second-to-last DiscID is removed from a release.
- When two releases are merged (though assuming the first two rules have been applied, this would be redundant, since the track time the merging release already overwrites the "mergee").
Features
- Nice and simple to code (and test)!
- Track times from TRMs are still ignored (they're unreliable anyway).
- DiscIDs trump FreeDB import in calculation of track times (but since we've got the DiscID, we don't need FreeDB).
- Moving DiscIDs to or from a release automatically recalculates the track times.
Enhancements
In order to clean up the existing track times, could we have one-off script run to recalulate the times for all releases with a single DiscID?
It might also be handy to have new EditType to SetTrackTimesFromDiscID to allow manual selection of the correct DiscID.