Skip to content

Enhance console application with media volume status and custom title support - #371

Merged
Tapanila merged 3 commits into
version-3from
copilot/fix-d9b58832-a297-4f37-8537-934d329ef38a
Aug 20, 2025
Merged

Enhance console application with media volume status and custom title support#371
Tapanila merged 3 commits into
version-3from
copilot/fix-d9b58832-a297-4f37-8537-934d329ef38a

Conversation

Copilot AI commented Aug 19, 2025

Copy link
Copy Markdown

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 status command and interactive mode "Get media status" now display media stream volume information alongside the existing device volume information.

Command-line example:

$ sharpcaster "Living Room TV" status

Device: Living Room TV
Volume: 75% (Muted: False)          # Device volume
Media State: Playing
Title: Big Buck Bunny
Current Time: 45.2s
Duration: 120.0s
Progress: 37.7%
Media Volume: 80% (Muted: False)    # NEW: Media stream volume

Interactive mode enhancement:
The status table in Media Controls → "Get media status" now includes:

  • Media Volume: Shows the media stream volume level
  • Media Muted: Shows whether the media stream is muted

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:

? Select media to cast: Custom URL
? Enter media URL: https://example.com/my-video.mp4
? Enter media title (or press Enter for default): My Awesome Video
✅ Media loaded and playing successfully!

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:

  • ✅ Media Controls menu
  • ✅ Queue Management menu

Technical Details

  • Null-safe implementation: Uses proper null-conditional operators (?.) to handle cases where media volume information might not be available
  • Consistent formatting: Media volume uses the same percentage formatting (:P0) as device volume for consistency
  • Error handling: Gracefully displays "Not available" when media volume information is unavailable
  • UI consistency: Interactive mode uses Spectre.Console styling patterns matching the existing codebase

User Impact

These enhancements provide users with:

  1. Complete media information: Both device and media stream volume levels are now visible
  2. Better customization: Custom titles for personal media improve organization and identification
  3. Improved user experience: More informative status displays and intuitive navigation

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

  • New Features
    • When casting a custom URL, you can now enter a custom media title; pressing Enter uses the default “Custom Media.”
    • Media status displays now include media-specific volume (as a percentage) and mute state (Yes/No). If media volume data isn’t available, a clear “Not available” message is shown.
    • These updates appear in both the media controls view and console status output for clearer, more informative playback feedback.

Copilot AI and others added 2 commits August 19, 2025 18:37
…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 AI changed the title [WIP] Some 'enhancement' wishes/suggestions for the Console: add the media volume and mute status to the show media status command allow the writing title for a custom URL on media load make "back to main menu" entry in cast menu Enhance console application with media volume status and custom title support Aug 19, 2025
Copilot AI requested a review from Tapanila August 19, 2025 18:41
@Tapanila

Copy link
Copy Markdown
Owner

@copilot can you try to build again

@Tapanila
Tapanila marked this pull request as ready for review August 19, 2025 18:48
Copilot AI review requested due to automatic review settings August 19, 2025 18:48
@coderabbitai

coderabbitai Bot commented Aug 19, 2025

Copy link
Copy Markdown

Walkthrough

Adds 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

Cohort / File(s) Summary of Changes
Media casting prompt
SharpCaster.Console/Controllers/MediaController.cs
Custom URL flow now prompts for a media title; defaults to “Custom Media” on empty input.
Media status display
SharpCaster.Console/Controllers/MediaController.cs, SharpCaster.Console/Services/CommandExecutor.cs
Status UI now shows media-specific volume (as percentage) and mute state when available; otherwise shows “Not available” for volume.

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.
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit taps the console keys,
“Name your tune,” the prompt now pleads.
Volume whispers, mute replies—
Numbers blink like firefly skies.
Hop, cast, play—status true,
Burrows hum with clearer view. 🐇🎵

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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch copilot/fix-d9b58832-a297-4f37-8537-934d329ef38a

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI commented Aug 19, 2025

Copy link
Copy Markdown
Author

@copilot can you try to build again

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:

  • ✅ Restores successfully with 1 warning (version constraint on xRetry.v3)
  • ✅ Builds successfully with expected warnings (null reference annotations, unused variables)
  • ✅ Tests execute properly (failures are expected due to no Chromecast devices in test environment)

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:

  • 224.0.0.251
  • aka.ms
    • Triggering command: curl -I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Tapanila

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 19, 2025

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 8452cd9 and f7660a4.

📒 Files selected for processing (2)
  • SharpCaster.Console/Controllers/MediaController.cs (2 hunks)
  • SharpCaster.Console/Services/CommandExecutor.cs (1 hunks)

@Tapanila
Tapanila merged commit 45f5699 into version-3 Aug 20, 2025
3 checks passed
@Tapanila
Tapanila deleted the copilot/fix-d9b58832-a297-4f37-8537-934d329ef38a branch August 20, 2025 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants