Skip to content

Commit

Permalink
fix: explain why we catch RuntimeErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
maximmaxim345 committed Jan 30, 2025
1 parent 00394a4 commit 24b5f33
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions music_assistant/helpers/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from __future__ import annotations

import asyncio
import contextlib
import logging
import os
import re
Expand Down Expand Up @@ -227,11 +226,15 @@ def get_stream_dsp_details(

if player.provider.startswith("player_group"):
if group_preventing_dsp:
with contextlib.suppress(RuntimeError):
try:
# We need a bit of a hack here since only the leader knows the correct output format
provider = mass.get_provider(player.provider)
if provider:
output_format = provider._get_sync_leader(player).output_format
except RuntimeError:
# _get_sync_leader will raise a RuntimeError if this group has no players
# just ignore this and continue without output_format
LOGGER.warning("Unable to get the sync group leader for %s", queue_id)
else:
# We only add real players (so skip the PlayerGroups as they only sync containing players)
details = get_player_dsp_details(mass, player)
Expand Down

0 comments on commit 24b5f33

Please sign in to comment.