ARver/arver/disc/utils.py
arcctgx 17ab6a8d97 handle data tracks in disc ID calculation
Calculation of AccurateRip disc ID seems to work correctly for pure
audio, mixed-mode and enhanced CDs (including "copy controlled" ones).
Finally!

MusicBrainz disc ID is calculated from track offsets using discid as
well. When the CD TOC is read from MusicBrainz by disc ID query it is
actually recalculated, but I don't think it's a big deal. It's a good
consistency check anyway.

Change argument names and correct one docstring in disc.id module.

There seems to be a bug regarding the length of last audio track
preceding a data track in enhanced CDs: get_last_lsn() method seems to
include the 11400 sectors gap before the data track in the track length.
And this means the MusicBrainz disc ID is not calculated correctly for
enhanced CDs now... Not sure how to handle this yet.
2023-08-15 15:30:44 +02:00

12 lines
401 B
Python

"""Disc-related definitions and helpers also useful elsewhere in ARver."""
LEAD_IN_FRAMES = 150
FRAMES_PER_SECOND = 75
def frames_to_msf(frames: int) -> str:
"""Convert integer number of CD frames to time as mm:ss.ff string."""
min_ = frames // FRAMES_PER_SECOND // 60
sec = frames // FRAMES_PER_SECOND % 60
frm = frames % FRAMES_PER_SECOND
return f'{min_}:{sec:02d}.{frm:02d}'