refactor: Simplify sound file path retrieval by consolidating stream sound handling

This commit is contained in:
JSC
2025-07-12 22:53:07 +02:00
parent 688b95b6af
commit 64074685a3

View File

@@ -276,21 +276,13 @@ class MusicPlayerService:
def _get_sound_file_path(self, sound: Sound) -> Optional[str]:
"""Get the file path for a sound, preferring normalized version."""
try:
if sound.type == "STR":
# Stream sounds
base_path = "sounds/stream"
elif sound.type == "SAY":
# Say sounds
base_path = "sounds/say"
else:
# Soundboard sounds
base_path = "sounds/soundboard"
base_normalized_path = "sounds/normalized/stream"
# Check for normalized version first
if sound.is_normalized and sound.normalized_filename:
normalized_path = os.path.join(
"sounds/normalized",
sound.type.lower(),
base_normalized_path,
sound.normalized_filename,
)
if os.path.exists(normalized_path):