| Total Complexity | 2 |
| Total Lines | 18 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """FFProbe Subject that runs ffprobe in python subprocess.""" |
||
| 2 | from software_patterns import Singleton |
||
| 3 | |||
| 4 | from ..run_cli import execute_command_in_subprocess |
||
| 5 | |||
| 6 | __all__ = ['FFProbeSubject'] |
||
| 7 | |||
| 8 | |||
| 9 | # Our implementation of the Subject class (see the Proxy pattern) |
||
| 10 | class FFProbeSubject(metaclass=Singleton): |
||
| 11 | """The standard FFProbe Subject class proxies the ffprobe CLI.""" |
||
| 12 | |||
| 13 | def __init__(self, ffprobe_binary: str): |
||
| 14 | self.ffprobe_binary = ffprobe_binary |
||
| 15 | |||
| 16 | def __call__(self, *args, **kwargs): |
||
| 17 | return execute_command_in_subprocess(self.ffprobe_binary, *args, **kwargs) |
||
| 18 |