Skip to content

Commit

Permalink
imp - Refresh the "Now playing" correctly
Browse files Browse the repository at this point in the history
---

We need to refresh the "Now playing" segment correctly.

---

Type: imp
Breaking: False
Doc Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed May 30, 2024
1 parent 02eb3e3 commit 061bc1f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion BassBoom.Cli/CliBase/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ internal static void Exit()
{
exiting = true;
advance = false;
PlaybackTools.Stop();
if (FileTools.IsOpened)
PlaybackTools.Stop();
}

internal static void Switch(string musicPath)
Expand Down
6 changes: 5 additions & 1 deletion BassBoom.Cli/CliBase/Equalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
using Terminaux.Inputs;
using System.Collections.Generic;
using Terminaux.Inputs.Styles.Selection;
using Terminaux.Base.Extensions;

namespace BassBoom.Cli.CliBase
{
Expand Down Expand Up @@ -146,7 +147,10 @@ private static string HandleDraw()
drawn.Append(PlayerControls.RenderSongName(Common.CurrentCachedInfo.MusicPath));
}
else
drawn.Append(CenteredTextColor.RenderCentered(1, "Not playing. Music player is idle.", ConsoleColors.White, ConsoleColors.Black));
drawn.Append(
TextWriterWhereColor.RenderWhere(ConsoleClearing.GetClearLineToRightSequence(), 0, 1) +
CenteredTextColor.RenderCentered(1, "Not playing. Music player is idle.", ConsoleColors.White)
);

// Now, print the list of bands and their values.
var choices = new List<InputChoiceInfo>();
Expand Down
6 changes: 5 additions & 1 deletion BassBoom.Cli/CliBase/PlayerControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
using System.Text;
using System.Threading;
using Terminaux.Base.Buffered;
using Terminaux.Base.Extensions;
using Terminaux.Colors.Data;
using Terminaux.Inputs;
using Terminaux.Inputs.Styles.Infobox;
using Terminaux.Writer.ConsoleWriters;
using Terminaux.Writer.FancyWriters;

namespace BassBoom.Cli.CliBase
Expand Down Expand Up @@ -273,7 +275,9 @@ internal static string RenderSongName(string musicPath)
var (musicName, musicArtist, _) = GetMusicNameArtistGenre(musicPath);

// Print the music name
return CenteredTextColor.RenderCentered(1, "Now playing: {0} - {1}", ConsoleColors.White, ConsoleColors.Black, musicArtist, musicName);
return
TextWriterWhereColor.RenderWhere(ConsoleClearing.GetClearLineToRightSequence(), 0, 1) +
CenteredTextColor.RenderCentered(1, "Now playing: {0} - {1}", ConsoleColors.White, ConsoleColors.Black, musicArtist, musicName);
}

internal static (string musicName, string musicArtist, string musicGenre) GetMusicNameArtistGenre(string musicPath)
Expand Down
6 changes: 5 additions & 1 deletion BassBoom.Cli/CliBase/RadioControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
using System.Text;
using System.Threading;
using Terminaux.Base.Buffered;
using Terminaux.Base.Extensions;
using Terminaux.Colors.Data;
using Terminaux.Inputs.Styles.Infobox;
using Terminaux.Writer.ConsoleWriters;
using Terminaux.Writer.FancyWriters;

namespace BassBoom.Cli.CliBase
Expand Down Expand Up @@ -126,7 +128,9 @@ internal static string RenderStationName()
string icy = PlaybackTools.RadioNowPlaying;

// Print the music name
return CenteredTextColor.RenderCentered(1, "Now playing: {0}", ConsoleColors.White, ConsoleColors.Black, icy);
return
TextWriterWhereColor.RenderWhere(ConsoleClearing.GetClearLineToRightSequence(), 0, 1) +
CenteredTextColor.RenderCentered(1, "Now playing: {0}", ConsoleColors.White, ConsoleColors.Black, icy);
}

internal static void RemoveCurrentStation()
Expand Down

0 comments on commit 061bc1f

Please sign in to comment.