refactor: Simplify sound file path retrieval by consolidating stream sound handling
This commit is contained in:
@@ -276,21 +276,13 @@ class MusicPlayerService:
|
|||||||
def _get_sound_file_path(self, sound: Sound) -> Optional[str]:
|
def _get_sound_file_path(self, sound: Sound) -> Optional[str]:
|
||||||
"""Get the file path for a sound, preferring normalized version."""
|
"""Get the file path for a sound, preferring normalized version."""
|
||||||
try:
|
try:
|
||||||
if sound.type == "STR":
|
|
||||||
# Stream sounds
|
|
||||||
base_path = "sounds/stream"
|
base_path = "sounds/stream"
|
||||||
elif sound.type == "SAY":
|
base_normalized_path = "sounds/normalized/stream"
|
||||||
# Say sounds
|
|
||||||
base_path = "sounds/say"
|
|
||||||
else:
|
|
||||||
# Soundboard sounds
|
|
||||||
base_path = "sounds/soundboard"
|
|
||||||
|
|
||||||
# Check for normalized version first
|
# Check for normalized version first
|
||||||
if sound.is_normalized and sound.normalized_filename:
|
if sound.is_normalized and sound.normalized_filename:
|
||||||
normalized_path = os.path.join(
|
normalized_path = os.path.join(
|
||||||
"sounds/normalized",
|
base_normalized_path,
|
||||||
sound.type.lower(),
|
|
||||||
sound.normalized_filename,
|
sound.normalized_filename,
|
||||||
)
|
)
|
||||||
if os.path.exists(normalized_path):
|
if os.path.exists(normalized_path):
|
||||||
|
|||||||
Reference in New Issue
Block a user