Skip to content

Commit 90b1969

Browse files
authored
v0.2.0 - interactive mode (#1)
* interactive mode
1 parent 633a496 commit 90b1969

File tree

7 files changed

+505
-6
lines changed

7 files changed

+505
-6
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Thumbs.db
1010
# IDE
1111
.vscode/
1212
.idea/
13+
.kiro/
1314
*.swp
1415
*.swo
1516

@@ -29,4 +30,4 @@ src/vendor/
2930
temp/
3031

3132
# Keep important files
32-
!LICENSE
33+
!LICENSE

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,34 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.0] - 2024-12-10
9+
10+
### Added
11+
- **Interactive Mode**: Step-by-step wizard for media generation
12+
- Media type selection (video/audio) with clear prompts
13+
- Parameter configuration with validation and default values
14+
- Configuration summary and confirmation before generation
15+
- Real-time progress feedback during media creation
16+
- Robust input handling with error recovery
17+
- Support for both experienced and novice users
18+
19+
- **Enhanced User Experience**
20+
- User-friendly prompts with clear instructions
21+
- Input validation with helpful error messages
22+
- Default value suggestions for quick configuration
23+
- Graceful handling of invalid input with retry options
24+
25+
### Enhanced
26+
- **CLI Interface**: Maintained full backward compatibility
27+
- **Error Handling**: Improved error messages and recovery
28+
- **Cross-platform Support**: Enhanced terminal compatibility
29+
30+
### Technical
31+
- **Input System**: Redesigned input handling using std.io.getStdIn().reader()
32+
- **Validation**: Comprehensive input validation and sanitization
33+
- **Memory Management**: Improved memory handling for interactive sessions
34+
- **Testing**: Added comprehensive unit and integration tests for interactive mode
35+
836
## [0.1.0] - 2025-10-11
937

1038
### Added

README.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ A fast, cross-platform command-line utility for generating test media files with
1111

1212
- 🎬 **Video generation** with animated countdown timer
1313
- 🎵 **Audio generation** with customizable sine wave test tones
14+
- 🧙‍♂️ **Interactive mode** - Step-by-step wizard for easy configuration
1415
- 🎯 **Multiple formats** - MP4, AVI, MOV, MKV, MP3, WAV, AAC, FLAC
1516
- ⚙️ **Highly configurable** - resolution, bitrate, duration, codecs, frequency
1617
- 🚀 **Cross-platform** - Windows, macOS, Linux (Intel & ARM)
@@ -37,6 +38,14 @@ Download the latest release for your platform:
3738

3839
### Basic Usage
3940

41+
#### Interactive Mode (Recommended for New Users)
42+
```bash
43+
# Launch interactive wizard - guided setup with prompts
44+
./media-gen i
45+
```
46+
*Perfect for beginners or when exploring different options. The wizard guides you through each step with helpful prompts and default values.*
47+
48+
#### Command Line Interface (CLI)
4049
```bash
4150
# Generate a 10-second countdown video
4251
./media-gen video --duration 10 --output countdown.mp4
@@ -50,6 +59,21 @@ Download the latest release for your platform:
5059
# Show help
5160
./media-gen help
5261
```
62+
*Ideal for automation, scripting, or when you know exactly what parameters you need.*
63+
64+
#### When to Use Each Approach
65+
66+
- **Use Interactive Mode** when:
67+
- You're new to media-gen
68+
- You want to explore different configuration options
69+
- You prefer guided setup with validation
70+
- You need help understanding available parameters
71+
72+
- **Use CLI Mode** when:
73+
- You're automating media generation
74+
- You know the exact parameters you need
75+
- You're writing scripts or batch operations
76+
- You prefer direct command execution
5377

5478
## 📖 Usage Guide
5579

@@ -285,9 +309,9 @@ chmod +x media-gen
285309
### Getting Help
286310

287311
- 📖 Check this README for usage examples
288-
- � Breowse [EXAMPLES.md](EXAMPLES.md) for comprehensive scenarios
289-
- [Reqport bugs](https://github.com/DimazzzZ/media-gen/issues)
290-
- [Rtequest features](https://github.com/DimazzzZ/media-gen/issues)
312+
- Browse [EXAMPLES.md](EXAMPLES.md) for comprehensive scenarios
313+
- [Report bugs](https://github.com/DimazzzZ/media-gen/issues)
314+
- [Request features](https://github.com/DimazzzZ/media-gen/issues)
291315
- 💬 [Start a discussion](https://github.com/DimazzzZ/media-gen/discussions)
292316

293317
## 📄 License
@@ -302,4 +326,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
302326

303327
---
304328

305-
**Made with ❤️ for developers who need reliable test media files**
329+
**Made with ❤️ for developers who need reliable test media files**

src/cli.zig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub fn printHelp() !void {
3535
print("Commands:\n", .{});
3636
print(" video Generate video file with countdown timer\n", .{});
3737
print(" audio Generate audio file with test tones\n", .{});
38+
print(" i, interactive Interactive mode - guided setup\n", .{});
3839
print(" help Show this help message\n\n", .{});
3940
print("Video options:\n", .{});
4041
print(" --width <width> Video width (default: 1920)\n", .{});
@@ -66,6 +67,12 @@ pub fn parseAndExecute(allocator: std.mem.Allocator, args: [][:0]u8) !void {
6667
return;
6768
}
6869

70+
if (std.mem.eql(u8, args[1], "i") or std.mem.eql(u8, args[1], "interactive")) {
71+
const interactive = @import("interactive.zig");
72+
try interactive.run(allocator);
73+
return;
74+
}
75+
6976
if (std.mem.eql(u8, args[1], "video")) {
7077
var config = VideoConfig{};
7178
try parseVideoArgs(args[2..], &config);

src/generators/audio.zig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ const cli = @import("../cli.zig");
44
const ffmpeg = @import("../ffmpeg.zig");
55

66
pub fn generate(allocator: std.mem.Allocator, config: cli.AudioConfig) !void {
7+
try generateWithProgress(allocator, config, false);
8+
}
9+
10+
pub fn generateWithProgress(allocator: std.mem.Allocator, config: cli.AudioConfig, show_progress: bool) !void {
711
print("Generating audio with parameters:\n", .{});
812
print(" Duration: {}s\n", .{config.duration});
913
print(" Sample rate: {}Hz\n", .{config.sample_rate});
@@ -78,6 +82,12 @@ pub fn generate(allocator: std.mem.Allocator, config: cli.AudioConfig) !void {
7882
}
7983

8084
// Execute FFmpeg command
85+
if (show_progress) {
86+
print("🎵 Running FFmpeg encoder...\n", .{});
87+
print("⏳ Please wait, encoding {d}s audio...\n", .{config.duration});
88+
}
89+
90+
// Run FFmpeg
8191
const result = std.process.Child.run(.{
8292
.allocator = allocator,
8393
.argv = cmd_args,

src/generators/video.zig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ const cli = @import("../cli.zig");
44
const ffmpeg = @import("../ffmpeg.zig");
55

66
pub fn generate(allocator: std.mem.Allocator, config: cli.VideoConfig) !void {
7+
try generateWithProgress(allocator, config, false);
8+
}
9+
10+
pub fn generateWithProgress(allocator: std.mem.Allocator, config: cli.VideoConfig, show_progress: bool) !void {
711
print("Generating video with parameters:\n", .{});
812
print(" Resolution: {}x{}\n", .{ config.width, config.height });
913
print(" Duration: {}s\n", .{config.duration});
1014
print(" FPS: {}\n", .{config.fps});
1115
print(" Bitrate: {s}\n", .{config.bitrate});
1216
print(" Format: {s}\n", .{config.format});
1317
print(" Codec: {s}\n", .{config.codec});
14-
1518
print(" Output: {s}\n", .{config.output});
1619

1720
// Create input filter with countdown timer - black background with large white numbers
@@ -41,6 +44,12 @@ pub fn generate(allocator: std.mem.Allocator, config: cli.VideoConfig) !void {
4144
};
4245

4346
// Execute FFmpeg command
47+
if (show_progress) {
48+
print("🎬 Running FFmpeg encoder...\n", .{});
49+
print("⏳ Please wait, encoding {d}s video...\n", .{config.duration});
50+
}
51+
52+
// Run FFmpeg
4453
const result = std.process.Child.run(.{
4554
.allocator = allocator,
4655
.argv = &cmd_args,

0 commit comments

Comments
 (0)