Skip to content

Commit

Permalink
add - doc - Added saving to playlist (only paths)
Browse files Browse the repository at this point in the history
---

We've added a new common keystroke that allows you to save the current queue to the playlist file.

---

Type: add
Breaking: False
Doc Required: True
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Sep 19, 2024
1 parent 3d5839d commit 1e6e205
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions BassBoom.Cli/CliBase/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
using SpecProbe.Software.Platform;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
Expand Down Expand Up @@ -317,6 +318,27 @@ internal static void HandleKeypressCommon(ConsoleKeyInfo keystroke, Screen playe
redraw = true;
playerScreen.RequireRefresh();
break;
case ConsoleKey.F1:
string path = InfoBoxInputColor.WriteInfoBoxInput("Enter a path to the playlist file that you would like to save");
playerScreen.RequireRefresh();
if (string.IsNullOrEmpty(path))
{
redraw = true;
playerScreen.RequireRefresh();
break;
}

// Check for extension
string extension = Path.GetExtension(path);
if (extension != ".m3u" && extension != ".m3u8")
path += ".m3u";

// Get a list of paths and write the file
string[] paths = cachedInfos.Select((csi) => csi.MusicPath).ToArray();
File.WriteAllLines(path, paths);
redraw = true;
playerScreen.RequireRefresh();
break;
case ConsoleKey.Q:
Exit();
break;
Expand Down
1 change: 1 addition & 0 deletions BassBoom.Cli/CliBase/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ internal static class Player
new("Seek to repeat checkpoint", ConsoleKey.C, ConsoleModifiers.Shift),
new("Disco Mode!", ConsoleKey.L),
new("Enable volume boost", ConsoleKey.V),
new("Save to playlist", ConsoleKey.F1),
new("Open the equalizer", ConsoleKey.E),
new("Device and driver information", ConsoleKey.D),
new("Set device and driver", ConsoleKey.D, ConsoleModifiers.Control),
Expand Down
1 change: 1 addition & 0 deletions BassBoom.Cli/CliBase/Radio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ internal static class Radio
new("Remove all radio stations", ConsoleKey.R, ConsoleModifiers.Control),
new("Disco Mode!", ConsoleKey.L),
new("Enable volume boost", ConsoleKey.V),
new("Save to playlist", ConsoleKey.F1),
new("Open the equalizer", ConsoleKey.E),
new("Device and driver information", ConsoleKey.D),
new("Set device and driver", ConsoleKey.D, ConsoleModifiers.Control),
Expand Down

0 comments on commit 1e6e205

Please sign in to comment.