fix(music): stop reading a kb/s bitrate as a hi-res sample rate

A lossy label such as "256 kb/s AAC" or "MP3 320 kb/s" no longer gets the per-track Hi-Res badge.
This commit is contained in:
imSp4rky
2026-11-01 18:14:03 -07:00
parent 67d3d4801f
commit a58da3f5d3
2 changed files with 24 additions and 1 deletions
+2 -1
View File
@@ -285,6 +285,7 @@ class MusicRenderer:
@staticmethod
def is_hires_quality(value: str) -> bool:
"""Return True for a label above 16-bit or 48 kHz; a "k" before "b" is a bitrate ("256 kb/s"), not a rate."""
lowered = value.lower()
bit_depth = None
sample_rate = None
@@ -293,7 +294,7 @@ class MusicRenderer:
if bit_match:
bit_depth = int(bit_match.group("bits"))
sample_match = re.search(r"(?P<rate>\d+(?:\.\d+)?)\s*k(?:hz)?", lowered)
sample_match = re.search(r"(?P<rate>\d+(?:\.\d+)?)\s*k(?!b)(?:hz)?", lowered)
if sample_match:
sample_rate = float(sample_match.group("rate"))