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.
This commit is contained in:
jo 2022-01-21 09:07:27 +01:00 committed by Kyle Robbertze
parent bf7b0d44fb
commit ceab19271d
8 changed files with 141 additions and 77 deletions

View file

@ -0,0 +1,24 @@
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