Test Failed
Pull Request — master (#2)
by Konstantinos
04:46 queued 02:32
created

music_album_creation.ffmpeg.ffmpeg.ffmpeg_proxy   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 22
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A FFMpegSubjectType.__call__() 0 2 1
A FFMpegSubjectType.__init__() 0 2 1
A FFMPEGProxy.__call__() 0 7 1
1
import json
2
import logging
3
from typing import Any, Protocol
4
5
from software_patterns import Proxy
6
7
__all__ = ['FFProbeProxy']
8
9
10
logger = logging.getLogger(__name__)
11
12
13
class CLIResult(Protocol):
14
    exit_code: int
15
    stdout: str
16
    stderr: str
17
18
19
class FFMpegSubjectType(Protocol):
20
    def __init__(self, ffmpeg_binary: str):
21
        ...
22
23
    def __call__(self, *ffmpeg_cli_args, **subprocess_settings) -> CLIResult:
24
        ...
25
26
27
class FFMPEGProxy(Proxy[FFMpegSubjectType]):
28
    """Proxy class for the ffmpeg CLI."""
29
30
    def __call__(self, *ffmpeg_cli_args: str, **subprocess_settings: Any) -> CLIResult:
31
        logger.error(
32
            "Running ffmpeg: %s", json.dumps(list(ffmpeg_cli_args), indent=4, sort_keys=True)
33
        )
34
        res = self._proxy_subject(*ffmpeg_cli_args, **subprocess_settings)
35
        # logger.info("FFMPEG:\n%s", res.stderr)
36
        return res
37