deepctl-cmd-ffprobe 0.0.2__tar.gz → 0.0.3__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepctl-cmd-ffprobe
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: FFprobe configuration command for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "deepctl-cmd-ffprobe"
7
- version = "0.0.2" # x-release-please-version
7
+ version = "0.0.3" # x-release-please-version
8
8
  description = "FFprobe configuration command for deepctl"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -7,16 +7,35 @@ import shutil
7
7
  import subprocess
8
8
  from typing import Any
9
9
 
10
- from deepctl_core import AuthManager, BaseCommand, BaseResult, Config, DeepgramClient
10
+ from deepctl_core import (
11
+ AuthManager,
12
+ BaseCommand,
13
+ BaseResult,
14
+ Config,
15
+ DeepgramClient,
16
+ get_console,
17
+ get_output_format,
18
+ get_status_console,
19
+ )
11
20
  from deepctl_shared_utils import (
12
21
  get_ffprobe_path,
13
22
  print_ffprobe_install_instructions,
14
23
  )
15
- from rich.console import Console
16
24
 
17
25
  from .models import FfprobeResult
18
26
 
19
- console = Console()
27
+ # Two channels, deliberately (#104):
28
+ # console -> stdout, the human rendering of the FfprobeResult.
29
+ # Written only in default (human) output mode, so
30
+ # `dg -o json ffprobe | jq` sees the payload alone.
31
+ # status_console -> stderr, always: errors and install instructions.
32
+ console = get_console()
33
+ status_console = get_status_console()
34
+
35
+
36
+ def _human_output() -> bool:
37
+ """True when stdout is for a person, not a parser."""
38
+ return get_output_format() == "default"
20
39
 
21
40
 
22
41
  class FfprobeCommand(BaseCommand):
@@ -74,7 +93,9 @@ class FfprobeCommand(BaseCommand):
74
93
  reset = kwargs.get("reset", False)
75
94
 
76
95
  if path and reset:
77
- console.print("[red]Error:[/red] Cannot use --path and --reset together")
96
+ status_console.print(
97
+ "[red]Error:[/red] Cannot use --path and --reset together"
98
+ )
78
99
  return BaseResult(
79
100
  status="error",
80
101
  message="Cannot use --path and --reset together",
@@ -92,11 +113,11 @@ class FfprobeCommand(BaseCommand):
92
113
  """Store a custom ffprobe path."""
93
114
  # Validate the path
94
115
  if not os.path.isfile(path):
95
- console.print(f"[red]Error:[/red] File not found: {path}")
116
+ status_console.print(f"[red]Error:[/red] File not found: {path}")
96
117
  return BaseResult(status="error", message=f"File not found: {path}")
97
118
 
98
119
  if not os.access(path, os.X_OK):
99
- console.print(f"[red]Error:[/red] File is not executable: {path}")
120
+ status_console.print(f"[red]Error:[/red] File is not executable: {path}")
100
121
  return BaseResult(status="error", message=f"File is not executable: {path}")
101
122
 
102
123
  # Store in config
@@ -104,9 +125,10 @@ class FfprobeCommand(BaseCommand):
104
125
  config.save()
105
126
 
106
127
  version = self._get_version(path)
107
- console.print(f"[green]✓[/green] ffprobe path stored: {path}")
108
- if version:
109
- console.print(f" Version: {version}")
128
+ if _human_output():
129
+ console.print(f"[green]✓[/green] ffprobe path stored: {path}")
130
+ if version:
131
+ console.print(f" Version: {version}")
110
132
 
111
133
  return FfprobeResult(
112
134
  status="success",
@@ -121,14 +143,14 @@ class FfprobeCommand(BaseCommand):
121
143
  config._config.tools.ffprobe_path = None
122
144
  config.save()
123
145
 
124
- console.print("[green]✓[/green] Stored ffprobe path cleared")
125
-
126
146
  # Show auto-detected path
127
147
  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]")
148
+ if _human_output():
149
+ console.print("[green]✓[/green] Stored ffprobe path cleared")
150
+ if auto_path:
151
+ console.print(f" Auto-detected: {auto_path}")
152
+ else:
153
+ console.print(" [yellow]ffprobe not found in PATH[/yellow]")
132
154
 
133
155
  return FfprobeResult(
134
156
  status="success",
@@ -143,17 +165,19 @@ class FfprobeCommand(BaseCommand):
143
165
  auto_path = shutil.which("ffprobe")
144
166
  effective_path = get_ffprobe_path(config)
145
167
 
146
- if stored_path:
147
- console.print(f" Stored path: {stored_path}")
148
- if auto_path:
149
- console.print(f" Auto-detected: {auto_path}")
168
+ if _human_output():
169
+ if stored_path:
170
+ console.print(f" Stored path: {stored_path}")
171
+ if auto_path:
172
+ console.print(f" Auto-detected: {auto_path}")
150
173
 
151
174
  if effective_path:
152
175
  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")
176
+ if _human_output():
177
+ console.print(f" Active path: [green]{effective_path}[/green]")
178
+ if version:
179
+ console.print(f" Version: {version}")
180
+ console.print("\n[green]✓[/green] ffprobe is available")
157
181
 
158
182
  return FfprobeResult(
159
183
  status="success",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepctl-cmd-ffprobe
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: FFprobe configuration command for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>