Switching presets now restores the user's prior edits to that preset instead of factory defaults. Edits are stashed per preset name under the quality_profile_presets preference; 'custom'/unknown names are not stashed. Adds a /reset endpoint + "Reset to defaults" UI link to drop a preset's saved edits. - DB: set_quality_profile stashes per-preset; get_quality_preset returns the customized form by default, _factory_quality_preset for the raw defaults; reset_quality_preset forgets a preset's edits. - web_server: apply-preset carries the global search_mode across switches; new preset/<name>/reset endpoint. - UI: target edits now save via debouncedSaveQualityProfile (profile-only, no full settings re-init/flicker); preset switch suppresses the global auto-save listener; help text + reset link. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
"""Quality presets — the built-in ranked-target ladders behind the preset
|
|
buttons. `audiophile` must be STRICT hi-res (no 16-bit, no lossy, fallback off)
|
|
so a user who wants "24-bit only" gets it in one click; `balanced` keeps the
|
|
fuller ladder (16-bit + MP3) with fallback on.
|
|
"""
|
|
|
|
from database.music_database import MusicDatabase
|
|
|
|
|
|
def _preset(name):
|
|
# _factory_quality_preset is pure (no self/DB) — call unbound to avoid setup.
|
|
return MusicDatabase._factory_quality_preset(None, name)
|
|
|
|
|
|
def _labels(profile):
|
|
return [t['label'] for t in profile['ranked_targets']]
|
|
|
|
|
|
def test_audiophile_is_strict_24bit_only():
|
|
p = _preset('audiophile')
|
|
assert p['fallback_enabled'] is False
|
|
labels = _labels(p)
|
|
assert all('24-bit' in l for l in labels) # only 24-bit FLAC
|
|
assert 'FLAC 16-bit' not in labels
|
|
assert not any('MP3' in l for l in labels)
|
|
|
|
|
|
def test_balanced_still_includes_16bit_and_mp3():
|
|
p = _preset('balanced')
|
|
labels = _labels(p)
|
|
assert 'FLAC 16-bit' in labels
|
|
assert any('MP3' in l for l in labels)
|
|
assert p['fallback_enabled'] is True
|