Skip to content

Commit

Permalink
add - doc - Added Radio Mode to the BassBoom addon
Browse files Browse the repository at this point in the history
---

We've added the radio mode to the BassBoom addon.

---

Type: add
Breaking: False
Doc Required: True
Part: 1/1
  • Loading branch information
AptiviCEO committed May 31, 2024
1 parent 99ffdc3 commit bd6bf12
Show file tree
Hide file tree
Showing 20 changed files with 1,360 additions and 506 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="MSTest.Sdk/3.4.1">
<Project Sdk="MSTest.Sdk/3.4.3">

<PropertyGroup>
<OutputPath>..\KSTest\</OutputPath>
Expand Down
2 changes: 1 addition & 1 deletion private/Nitrocid.LocaleCheck/Nitrocid.LocaleCheck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Terminaux" Version="4.0.0.2" />
<PackageReference Include="Terminaux" Version="4.0.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Nitrocid.LocaleTools\Nitrocid.LocaleTools.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion private/Nitrocid.LocaleClean/Nitrocid.LocaleClean.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Terminaux" Version="4.0.0.2" />
<PackageReference Include="Terminaux" Version="4.0.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Nitrocid.LocaleTools\Nitrocid.LocaleTools.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion private/Nitrocid.LocaleTrim/Nitrocid.LocaleTrim.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Terminaux" Version="4.0.0.2" />
<PackageReference Include="Terminaux" Version="4.0.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Nitrocid.LocaleTools\Nitrocid.LocaleTools.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions private/Nitrocid.Tests/Nitrocid.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="MSTest.Sdk/3.4.1">
<Project Sdk="MSTest.Sdk/3.4.3">

<PropertyGroup>
<OutputPath>KSTest\</OutputPath>
Expand Down Expand Up @@ -61,7 +61,7 @@

<ItemGroup>
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="Terminaux" Version="4.0.0.2" />
<PackageReference Include="Terminaux" Version="4.0.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
19 changes: 16 additions & 3 deletions public/Nitrocid.Addons/Nitrocid.Extras.BassBoom/BassBoomInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@
using Nitrocid.Files.Paths;
using Nitrocid.Modifications;
using System.Linq;
using Terminaux.Colors;
using Terminaux.Colors.Data;
using Nitrocid.Shell.ShellBase.Switches;

namespace Nitrocid.Extras.BassBoom
{
internal class BassBoomInit : IAddon
{
internal static Version mpgVer;
internal static Version outVer;
internal static Color white = new(ConsoleColors.White);
private readonly ExtensionHandler[] handlers = [
new(".mp3", "Mp3BassBoom", PlayerHandler.Handle, PlayerHandler.InfoHandle),
new(".mp2", "Mp3BassBoom", PlayerHandler.Handle, PlayerHandler.InfoHandle),
Expand All @@ -80,10 +86,13 @@ internal class BassBoomInit : IAddon

new CommandInfo("musicplayer", /* Localizable */ "Opens an interactive music player",
[
new CommandArgumentInfo(new[]
{
new CommandArgumentInfo(
[
new CommandArgumentPart(false, "musicFile"),
})
],
[
new SwitchInfo("r", /* Localizable */ "Opens the radio station player instead")
])
], new MusicPlayerCommand()),

new CommandInfo("playlyric", /* Localizable */ "Plays a lyric file",
Expand Down Expand Up @@ -135,6 +144,10 @@ void IAddon.StartAddon()
if (!InitBasolia.BasoliaInitialized)
InitBasolia.Init(PathsManagement.AddonsPath + "/Extras.BassBoom");
ExtensionHandlerTools.extensionHandlers.AddRange(handlers);

// Initialize versions
mpgVer = InitBasolia.MpgLibVersion;
outVer = InitBasolia.OutLibVersion;
}

void IAddon.StopAddon()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

using Terminaux.Writer.ConsoleWriters;
using Nitrocid.Extras.BassBoom.Player;
using Nitrocid.Files;
using Nitrocid.Files.Operations.Querying;
using Nitrocid.Kernel.Debugging;
using Nitrocid.Languages;
using Nitrocid.Shell.ShellBase.Commands;
using System;
using System.Linq;

namespace Nitrocid.Extras.BassBoom.Commands
{
Expand All @@ -42,28 +42,27 @@ public override int Execute(CommandParameters parameters, ref string variableVal
try
{
// First, prompt for the music path if no arguments are provided.
bool isRadio = parameters.SwitchesList.Contains("-r");
if (parameters.ArgumentsList.Length != 0)
{
string musicPath = FilesystemTools.NeutralizePath(parameters.ArgumentsList[0]);
string musicPath = parameters.ArgumentsList[0];

// Check for existence.
if (string.IsNullOrEmpty(musicPath))
{
TextWriterColor.Write(Translate.DoTranslation("Music file not specified."));
return 30;
}
if (!Checking.FileExists(musicPath))
if (string.IsNullOrEmpty(musicPath) || (!isRadio && !Checking.FileExists(musicPath)))
{
TextWriterColor.Write(Translate.DoTranslation("Music file '{0}' doesn't exist."), musicPath);
return 31;
}
if (!PlayerTui.musicFiles.Contains(musicPath))
PlayerTui.musicFiles.Add(musicPath);
PlayerControls.PopulateMusicFileInfo(musicPath);
if (!isRadio)
PlayerTui.passedMusicPaths.Add(musicPath);
}

// Now, open an interactive TUI
PlayerTui.PlayerLoop();
Common.exiting = false;
if (isRadio)
Radio.RadioLoop();
else
PlayerTui.PlayerLoop();
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<!-- Extras.BassBoom addon Platform Information End -->

<ItemGroup>
<PackageReference Include="BassBoom.Basolia" Version="0.0.6.1" />
<PackageReference Include="BassBoom.Basolia" Version="0.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit bd6bf12

Please sign in to comment.