music_album_creation.ffmpeg.ffprobe.ffprobe_proxy   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A FFProbeSubjectType.__call__() 0 2 1
A FFProbeSubjectType.__init__() 0 2 1
A FFProbeProxy.__call__() 0 5 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 FFProbeSubjectType(Protocol):
20
    def __init__(self, ffprobe_binary: str):
21
        ...
22
23
    def __call__(self, *ffprobe_cli_args, **subprocess_settings) -> CLIResult:
24
        ...
25
26
27
class FFProbeProxy(Proxy[FFProbeSubjectType]):
28
    """Proxy class for the ffprobe CLI."""
29
30
    def __call__(self, *ffprobe_cli_args: str, **subprocess_settings: Any) -> CLIResult:
31
        logger.info(
32
            "Running ffmpeg: %s", json.dumps(list(ffprobe_cli_args), indent=4, sort_keys=True)
33
        )
34
        return self._proxy_subject(*ffprobe_cli_args, **subprocess_settings)
35