Skip to content

Commit 45f5699

Browse files
CopilotTapanila
andauthored
Enhance console application with media volume status and custom title support (#371)
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:** ```bash $ 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. <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/Tapanila/SharpCaster/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Tapanila <1529210+Tapanila@users.noreply.github.com>
1 parent 088de35 commit 45f5699

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

SharpCaster.Console/Controllers/MediaController.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ public async Task CastMediaAsync()
6666
.PromptStyle("green")
6767
.ValidationErrorMessage("[red]Please enter a valid URL[/]")
6868
.Validate(url => Uri.TryCreate(url, UriKind.Absolute, out _)));
69-
title = "Custom Media";
69+
title = AnsiConsole.Prompt(
70+
new TextPrompt<string>("[yellow]Enter media title (or press Enter for default):[/]")
71+
.PromptStyle("green")
72+
.AllowEmpty()
73+
.DefaultValue("Custom Media"));
7074
break;
7175
default:
7276
throw new InvalidOperationException("Invalid URL choice");
@@ -411,6 +415,17 @@ await AnsiConsole.Status().StartAsync($"{(newMediaMuteState ? "Muting" : "Unmuti
411415
statusTable.AddRow("[cyan]Progress[/]", $"[white]{progress:F1}%[/]");
412416
}
413417

418+
// Display media volume and mute status
419+
if (status.Volume != null)
420+
{
421+
statusTable.AddRow("[cyan]Media Volume[/]", $"[white]{status.Volume.Level:P0}[/]");
422+
statusTable.AddRow("[cyan]Media Muted[/]", status.Volume.Muted == true ? "[red]Yes[/]" : "[green]No[/]");
423+
}
424+
else
425+
{
426+
statusTable.AddRow("[cyan]Media Volume[/]", "[dim]Not available[/]");
427+
}
428+
414429
AnsiConsole.Write(statusTable);
415430
}
416431
else

SharpCaster.Console/Services/CommandExecutor.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,16 @@ private async Task<int> ShowStatusAsync()
505505
var progress = (mediaStatus.CurrentTime / mediaStatus.Media.Duration.Value) * 100;
506506
System.Console.WriteLine($"Progress: {progress:F1}%");
507507
}
508+
509+
// Display media volume and mute status
510+
if (mediaStatus.Volume != null)
511+
{
512+
System.Console.WriteLine($"Media Volume: {mediaStatus.Volume.Level:P0} (Muted: {mediaStatus.Volume.Muted})");
513+
}
514+
else
515+
{
516+
System.Console.WriteLine("Media Volume: Not available");
517+
}
508518
}
509519
else
510520
{

0 commit comments

Comments
 (0)