deepctl-cmd-ffprobe 0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- deepctl_cmd_ffprobe/__init__.py +6 -0
- deepctl_cmd_ffprobe/command.py +190 -0
- deepctl_cmd_ffprobe/models.py +10 -0
- deepctl_cmd_ffprobe-0.0.2.dist-info/METADATA +64 -0
- deepctl_cmd_ffprobe-0.0.2.dist-info/RECORD +8 -0
- deepctl_cmd_ffprobe-0.0.2.dist-info/WHEEL +5 -0
- deepctl_cmd_ffprobe-0.0.2.dist-info/entry_points.txt +2 -0
- deepctl_cmd_ffprobe-0.0.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"""FFprobe configuration command for deepctl."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import shutil
|
|
7
|
+
import subprocess
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from deepctl_core import AuthManager, BaseCommand, BaseResult, Config, DeepgramClient
|
|
11
|
+
from deepctl_shared_utils import (
|
|
12
|
+
get_ffprobe_path,
|
|
13
|
+
print_ffprobe_install_instructions,
|
|
14
|
+
)
|
|
15
|
+
from rich.console import Console
|
|
16
|
+
|
|
17
|
+
from .models import FfprobeResult
|
|
18
|
+
|
|
19
|
+
console = Console()
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class FfprobeCommand(BaseCommand):
|
|
23
|
+
"""Manage ffprobe configuration for audio analysis."""
|
|
24
|
+
|
|
25
|
+
name = "ffprobe"
|
|
26
|
+
help = (
|
|
27
|
+
"Show ffprobe status or configure a custom path. "
|
|
28
|
+
"ffprobe is used for audio analysis in transcribe and debug commands."
|
|
29
|
+
)
|
|
30
|
+
short_help = "Configure ffprobe"
|
|
31
|
+
|
|
32
|
+
requires_auth = False
|
|
33
|
+
requires_project = False
|
|
34
|
+
ci_friendly = True
|
|
35
|
+
|
|
36
|
+
examples = [
|
|
37
|
+
"dg ffprobe",
|
|
38
|
+
"dg ffprobe --path /opt/homebrew/bin/ffprobe",
|
|
39
|
+
"dg ffprobe --path $(which ffprobe)",
|
|
40
|
+
"dg ffprobe --reset",
|
|
41
|
+
]
|
|
42
|
+
agent_help = (
|
|
43
|
+
"Show ffprobe detection status or set a custom path. "
|
|
44
|
+
"ffprobe (part of FFmpeg) is used for audio file analysis. "
|
|
45
|
+
"Use --path to store a custom binary path, --reset to clear it."
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
def get_arguments(self) -> list[dict[str, Any]]:
|
|
49
|
+
"""Get command arguments and options."""
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
"names": ["--path"],
|
|
53
|
+
"help": "Set custom ffprobe binary path",
|
|
54
|
+
"type": str,
|
|
55
|
+
"is_option": True,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"names": ["--reset"],
|
|
59
|
+
"help": "Clear stored path, revert to auto-detection",
|
|
60
|
+
"is_flag": True,
|
|
61
|
+
"is_option": True,
|
|
62
|
+
},
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
def handle(
|
|
66
|
+
self,
|
|
67
|
+
config: Config,
|
|
68
|
+
auth_manager: AuthManager,
|
|
69
|
+
client: DeepgramClient,
|
|
70
|
+
**kwargs: Any,
|
|
71
|
+
) -> BaseResult:
|
|
72
|
+
"""Handle ffprobe command."""
|
|
73
|
+
path = kwargs.get("path")
|
|
74
|
+
reset = kwargs.get("reset", False)
|
|
75
|
+
|
|
76
|
+
if path and reset:
|
|
77
|
+
console.print("[red]Error:[/red] Cannot use --path and --reset together")
|
|
78
|
+
return BaseResult(
|
|
79
|
+
status="error",
|
|
80
|
+
message="Cannot use --path and --reset together",
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
if reset:
|
|
84
|
+
return self._handle_reset(config)
|
|
85
|
+
|
|
86
|
+
if path:
|
|
87
|
+
return self._handle_set_path(config, path)
|
|
88
|
+
|
|
89
|
+
return self._handle_status(config)
|
|
90
|
+
|
|
91
|
+
def _handle_set_path(self, config: Config, path: str) -> BaseResult:
|
|
92
|
+
"""Store a custom ffprobe path."""
|
|
93
|
+
# Validate the path
|
|
94
|
+
if not os.path.isfile(path):
|
|
95
|
+
console.print(f"[red]Error:[/red] File not found: {path}")
|
|
96
|
+
return BaseResult(status="error", message=f"File not found: {path}")
|
|
97
|
+
|
|
98
|
+
if not os.access(path, os.X_OK):
|
|
99
|
+
console.print(f"[red]Error:[/red] File is not executable: {path}")
|
|
100
|
+
return BaseResult(status="error", message=f"File is not executable: {path}")
|
|
101
|
+
|
|
102
|
+
# Store in config
|
|
103
|
+
config._config.tools.ffprobe_path = path
|
|
104
|
+
config.save()
|
|
105
|
+
|
|
106
|
+
version = self._get_version(path)
|
|
107
|
+
console.print(f"[green]✓[/green] ffprobe path stored: {path}")
|
|
108
|
+
if version:
|
|
109
|
+
console.print(f" Version: {version}")
|
|
110
|
+
|
|
111
|
+
return FfprobeResult(
|
|
112
|
+
status="success",
|
|
113
|
+
message=f"ffprobe path set to {path}",
|
|
114
|
+
stored_path=path,
|
|
115
|
+
version=version,
|
|
116
|
+
available=True,
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
def _handle_reset(self, config: Config) -> BaseResult:
|
|
120
|
+
"""Clear stored ffprobe path."""
|
|
121
|
+
config._config.tools.ffprobe_path = None
|
|
122
|
+
config.save()
|
|
123
|
+
|
|
124
|
+
console.print("[green]✓[/green] Stored ffprobe path cleared")
|
|
125
|
+
|
|
126
|
+
# Show auto-detected path
|
|
127
|
+
auto_path = shutil.which("ffprobe")
|
|
128
|
+
if auto_path:
|
|
129
|
+
console.print(f" Auto-detected: {auto_path}")
|
|
130
|
+
else:
|
|
131
|
+
console.print(" [yellow]ffprobe not found in PATH[/yellow]")
|
|
132
|
+
|
|
133
|
+
return FfprobeResult(
|
|
134
|
+
status="success",
|
|
135
|
+
message="Stored ffprobe path cleared",
|
|
136
|
+
detected_path=auto_path,
|
|
137
|
+
available=auto_path is not None,
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
def _handle_status(self, config: Config) -> BaseResult:
|
|
141
|
+
"""Show ffprobe status."""
|
|
142
|
+
stored_path = config.get("tools.ffprobe_path")
|
|
143
|
+
auto_path = shutil.which("ffprobe")
|
|
144
|
+
effective_path = get_ffprobe_path(config)
|
|
145
|
+
|
|
146
|
+
if stored_path:
|
|
147
|
+
console.print(f" Stored path: {stored_path}")
|
|
148
|
+
if auto_path:
|
|
149
|
+
console.print(f" Auto-detected: {auto_path}")
|
|
150
|
+
|
|
151
|
+
if effective_path:
|
|
152
|
+
version = self._get_version(effective_path)
|
|
153
|
+
console.print(f" Active path: [green]{effective_path}[/green]")
|
|
154
|
+
if version:
|
|
155
|
+
console.print(f" Version: {version}")
|
|
156
|
+
console.print("\n[green]✓[/green] ffprobe is available")
|
|
157
|
+
|
|
158
|
+
return FfprobeResult(
|
|
159
|
+
status="success",
|
|
160
|
+
message="ffprobe is available",
|
|
161
|
+
stored_path=stored_path,
|
|
162
|
+
detected_path=auto_path,
|
|
163
|
+
version=version,
|
|
164
|
+
available=True,
|
|
165
|
+
)
|
|
166
|
+
else:
|
|
167
|
+
print_ffprobe_install_instructions()
|
|
168
|
+
|
|
169
|
+
return FfprobeResult(
|
|
170
|
+
status="error",
|
|
171
|
+
message="ffprobe not found",
|
|
172
|
+
available=False,
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
def _get_version(self, ffprobe_path: str) -> str | None:
|
|
176
|
+
"""Get ffprobe version string."""
|
|
177
|
+
try:
|
|
178
|
+
result = subprocess.run(
|
|
179
|
+
[ffprobe_path, "-version"],
|
|
180
|
+
capture_output=True,
|
|
181
|
+
text=True,
|
|
182
|
+
timeout=5,
|
|
183
|
+
)
|
|
184
|
+
if result.returncode == 0:
|
|
185
|
+
# First line is typically "ffprobe version X.Y.Z ..."
|
|
186
|
+
first_line = result.stdout.strip().split("\n")[0]
|
|
187
|
+
return first_line
|
|
188
|
+
except (subprocess.TimeoutExpired, OSError):
|
|
189
|
+
pass
|
|
190
|
+
return None
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deepctl-cmd-ffprobe
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: FFprobe configuration command for deepctl
|
|
5
|
+
Author-email: Deepgram <devrel@deepgram.com>
|
|
6
|
+
Maintainer-email: Deepgram <devrel@deepgram.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Keywords: deepgram,cli,ffprobe,audio,config
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: deepctl-core>=0.1.10
|
|
18
|
+
Requires-Dist: deepctl-shared-utils>=0.1.10
|
|
19
|
+
Requires-Dist: click>=8.0.0
|
|
20
|
+
Requires-Dist: rich>=13.0.0
|
|
21
|
+
Requires-Dist: pydantic>=2.0.0
|
|
22
|
+
|
|
23
|
+
# deepctl-cmd-ffprobe
|
|
24
|
+
|
|
25
|
+
> Part of [deepctl](https://github.com/deepgram/cli) — Official Deepgram CLI
|
|
26
|
+
|
|
27
|
+
FFprobe configuration command for deepctl
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
This package is included with deepctl and does not need to be installed separately.
|
|
32
|
+
|
|
33
|
+
### Install deepctl
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Install with pip
|
|
37
|
+
pip install deepctl
|
|
38
|
+
|
|
39
|
+
# Or install with uv
|
|
40
|
+
uv tool install deepctl
|
|
41
|
+
|
|
42
|
+
# Or install with pipx
|
|
43
|
+
pipx install deepctl
|
|
44
|
+
|
|
45
|
+
# Or run without installing
|
|
46
|
+
uvx deepctl --help
|
|
47
|
+
pipx run deepctl --help
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Commands
|
|
51
|
+
|
|
52
|
+
| Command | Entry Point |
|
|
53
|
+
|---------|-------------|
|
|
54
|
+
| `deepctl ffprobe` | `deepctl_cmd_ffprobe.command:FfprobeCommand` |
|
|
55
|
+
|
|
56
|
+
## Dependencies
|
|
57
|
+
|
|
58
|
+
- `click>=8.0.0`
|
|
59
|
+
- `rich>=13.0.0`
|
|
60
|
+
- `pydantic>=2.0.0`
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
MIT — see [LICENSE](../../LICENSE)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
deepctl_cmd_ffprobe/__init__.py,sha256=3eEcc91Th0_CXbjVvTUf84silZRqMHRZdI2kO-ZZ0Nw,167
|
|
2
|
+
deepctl_cmd_ffprobe/command.py,sha256=kbdwheOUHiaO2iSloG5whysxoMQ-1mdEzVXwbF1ARrI,6040
|
|
3
|
+
deepctl_cmd_ffprobe/models.py,sha256=VnteyE8BwC2B2tkpQjClqv-8DzP1PLZQn4Uja0LLNY4,237
|
|
4
|
+
deepctl_cmd_ffprobe-0.0.2.dist-info/METADATA,sha256=fMuHW2CtEPVzZJX1CUCzRG3v63sGPlS-Kc6lc9KMdnQ,1537
|
|
5
|
+
deepctl_cmd_ffprobe-0.0.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
6
|
+
deepctl_cmd_ffprobe-0.0.2.dist-info/entry_points.txt,sha256=ou9pLAJ-nPfmHmc1YXaJp4f3QHBRUAzMojIy4FcqU1g,72
|
|
7
|
+
deepctl_cmd_ffprobe-0.0.2.dist-info/top_level.txt,sha256=XTEF_ttbyl-aE8Fz9k3T7n1goc76-0wxSKHaNA4OFYI,20
|
|
8
|
+
deepctl_cmd_ffprobe-0.0.2.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
deepctl_cmd_ffprobe
|