Enhance console application with media volume status and custom title support - #371
Conversation
…or custom URLs Co-authored-by: Tapanila <1529210+Tapanila@users.noreply.github.com>
…or consistency Co-authored-by: Tapanila <1529210+Tapanila@users.noreply.github.com>
|
@copilot can you try to build again |
WalkthroughAdds a user prompt for custom media title in CastMediaAsync and extends status displays to include media volume and mute state in both MediaController and CommandExecutor. No public API signatures changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Console as Console UI
participant MediaCtrl as MediaController
participant Caster as Cast Device
User->>Console: Select "Cast Custom URL"
Console->>MediaCtrl: CastMediaAsync()
MediaCtrl->>User: Prompt: "Enter media title (or Enter for default)"
User-->>MediaCtrl: Title (or empty)
MediaCtrl->>MediaCtrl: Use provided title or "Custom Media"
MediaCtrl->>Caster: Start casting with URL + title
Caster-->>MediaCtrl: Acknowledgement
User->>Console: Show Media Status
Console->>MediaCtrl: ShowMediaControlsAsync()
MediaCtrl->>Caster: Get media status
Caster-->>MediaCtrl: Status { Volume?, Muted? }
MediaCtrl->>Console: Render status with Media Volume% and Muted (or Not available)
Note over Console,MediaCtrl: CommandExecutor shows the same Media Volume/Muted in its status output.
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the SharpCaster console application with improved media information display and user customization options. The changes focus on providing more comprehensive media status information and better user control over custom media casting.
- Adds media volume and mute status display to both command-line and interactive status commands
- Enables custom title input for custom URL media casting instead of hardcoded "Custom Media"
- Enhances status displays with consistent formatting and proper null-safe handling
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| SharpCaster.Console/Services/CommandExecutor.cs | Adds media volume display to command-line status output with null-safe handling |
| SharpCaster.Console/Controllers/MediaController.cs | Implements custom title prompt for URLs and adds media volume to interactive status table |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Build completed successfully! I installed .NET 9 SDK (9.0.303) and runtime to resolve the NETSDK1045 error that was occurring due to the environment having only .NET 8.0.118 while the projects target .NET 9.0. The solution now:
All projects (Sharpcaster, SharpCaster.Console, Sharpcaster.Test) compile and link correctly for both .NET 9.0 and .NET Standard 2.0 targets. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
SharpCaster.Console/Services/CommandExecutor.cs (1)
508-517: Use user-friendly "Yes/No" for muted state and add a placeholder when unavailable (optional).Current output prints True/False for mute. Consider matching the interactive UI by printing Yes/No. Also, when media volume is unavailable, consider adding a corresponding "Media Muted: Not available" line for symmetry.
Apply this diff:
// Display media volume and mute status if (mediaStatus.Volume != null) { - System.Console.WriteLine($"Media Volume: {mediaStatus.Volume.Level:P0} (Muted: {mediaStatus.Volume.Muted})"); + System.Console.WriteLine($"Media Volume: {mediaStatus.Volume.Level:P0} (Muted: {(mediaStatus.Volume.Muted ? "Yes" : "No")})"); } else { System.Console.WriteLine("Media Volume: Not available"); + System.Console.WriteLine("Media Muted: Not available"); }Note: You might also consider applying the same Yes/No treatment to the device mute display for consistency.
SharpCaster.Console/Controllers/MediaController.cs (2)
69-74: Simplify prompt: remove AllowEmpty to rely on the default and avoid empty-string titles.DefaultValue already enables “press Enter to accept default.” Keeping AllowEmpty allows an actual empty string (or whitespace) title to slip through, which is usually unintended.
Apply this diff:
title = AnsiConsole.Prompt( new TextPrompt<string>("[yellow]Enter media title (or press Enter for default):[/]") .PromptStyle("green") - .AllowEmpty() .DefaultValue("Custom Media"));If you want to also guard against whitespace-only input, you could post-process:
title = string.IsNullOrWhiteSpace(title) ? "Custom Media" : title;
418-427: Add “Media Muted” placeholder when volume is unavailable for consistency.When status.Volume is null, the UI omits the mute row. Adding a “Media Muted: Not available” row improves symmetry and clarity.
Apply this diff:
// Display media volume and mute status if (status.Volume != null) { statusTable.AddRow("[cyan]Media Volume[/]", $"[white]{status.Volume.Level:P0}[/]"); statusTable.AddRow("[cyan]Media Muted[/]", status.Volume.Muted == true ? "[red]Yes[/]" : "[green]No[/]"); } else { statusTable.AddRow("[cyan]Media Volume[/]", "[dim]Not available[/]"); + statusTable.AddRow("[cyan]Media Muted[/]", "[dim]Not available[/]"); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
SharpCaster.Console/Controllers/MediaController.cs(2 hunks)SharpCaster.Console/Services/CommandExecutor.cs(1 hunks)
This PR implements three user-requested enhancements to the SharpCaster console application to improve the user experience and provide more complete media information.
Changes Made
1. Media Volume and Mute Status in Status Commands
Both the command-line
statuscommand and interactive mode "Get media status" now display media stream volume information alongside the existing device volume information.Command-line example:
Interactive mode enhancement:
The status table in Media Controls → "Get media status" now includes:
2. Custom Title Input for Custom URLs
When casting custom URLs in interactive mode, users can now specify a custom title instead of being limited to the hardcoded "Custom Media" title.
User flow:
The title prompt allows empty input and defaults to "Custom Media" for backward compatibility.
3. Navigation Menu Verification
Verified that all cast-related menus already have proper "Back to main menu" options:
Technical Details
?.) to handle cases where media volume information might not be available:P0) as device volume for consistencyUser Impact
These enhancements provide users with:
The changes maintain backward compatibility and follow existing code patterns for error handling and UI consistency.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Summary by CodeRabbit