Skip to content

Commit

Permalink
Stop using the root logger (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
C0rn3j authored Dec 16, 2024
1 parent 684db50 commit c118310
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions playsound3/playsound3.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,31 +94,31 @@ def _prepare_path(sound: str | Path) -> str:

def _select_linux_backend() -> Callable[[str], None]:
"""Select the best available audio backend for Linux systems."""
logging.info("Selecting the best available audio backend for Linux systems.")
logger.info("Selecting the best available audio backend for Linux systems.")

try:
subprocess.run(["gst-play-1.0", "--version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)
logging.info("Using gst-play-1.0 as the audio backend.")
logger.info("Using gst-play-1.0 as the audio backend.")
return _playsound_gst_play
except FileNotFoundError:
pass

try:
subprocess.run(["ffplay", "-version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)
logging.info("Using ffplay as the audio backend.")
logger.info("Using ffplay as the audio backend.")
return _playsound_ffplay
except FileNotFoundError:
pass

try:
subprocess.run(["aplay", "--version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)
subprocess.run(["mpg123", "--version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)
logging.info("Using aplay and mpg123 as the audio backend.")
logger.info("Using aplay and mpg123 as the audio backend.")
return _playsound_alsa
except FileNotFoundError:
pass

logging.info("No suitable audio backend found.")
logger.info("No suitable audio backend found.")
raise PlaysoundException("No suitable audio backend found. Install gstreamer or ffmpeg!")


Expand Down

0 comments on commit c118310

Please sign in to comment.