chore(analyzer): move ffmpeg and utils modules to pipeline
This commit is contained in:
parent
120f24b1a4
commit
c6124b4012
5 changed files with 5 additions and 5 deletions
24
analyzer/libretime_analyzer/pipeline/_utils.py
Normal file
24
analyzer/libretime_analyzer/pipeline/_utils.py
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue