sintonia/analyzer/libretime_analyzer/utils.py
jo ceab19271d feat(analyzer): analyze replaygain using ffmpeg
- remove pycairo pip install
- fix py36 compatibility
- reraise when executable was not found

BREAKING CHANGE: The analyzer requires 'ffmpeg'. The 'rgain3' python package and it's system dependencies can be removed.
2022-01-24 12:54:31 +02:00

24 lines
655 B
Python

from subprocess import PIPE, CalledProcessError, CompletedProcess, run
from loguru import logger
def run_(*args, **kwargs) -> CompletedProcess:
try:
return run(
args,
check=True,
stdout=PIPE,
stderr=PIPE,
universal_newlines=True,
**kwargs,
)
except OSError as exception: # executable was not found
cmd = args[0]
logger.warning(f"Failed to run: {cmd} - {exception}. Is {cmd} installed?")
raise exception
except CalledProcessError as exception: # returned an error code
logger.error(exception)
raise exception