diff --git a/README.md b/README.md
index 2fc7ea3..fae0086 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ See the [examples](#examples-1).
- [Searching](#searching)
- [File conditions](#file-conditions)
- [Name format](#name-format)
- - [Skip existing](#skip-existing)
+ - [Skip-existing](#skip-existing)
- [Configuration](#configuration)
- [Examples](#examples-1)
- [Notes](#notes)
@@ -42,43 +42,32 @@ Usage: sldl [OPTIONS]
```
General Options
-p, --path Download directory
- --input-type Force set input type, [csv|youtube|spotify|bandcamp|string]
+ --input-type [csv|youtube|spotify|bandcamp|string|list]
--name-format Name format for downloaded tracks. See --help name-format
-
+
-n, --number Download the first n tracks of a playlist
-o, --offset Skip a specified number of tracks
-r, --reverse Download tracks in reverse order
-c, --config Set config file location. Set to 'none' to ignore config
- --profile Configuration profile(s) to use. See --help "config".
+ --profile Configuration profile(s) to use. See --help ""config"".
--concurrent-downloads Max concurrent downloads (default: 2)
--m3u Create an m3u8 playlist file in the output directory
- 'none' (default for string input): Do not create
+ 'none' (default for string inputs): Do not create
'index' (default): Write a single line for sldl to index
all downloaded files, required for skip-existing=m3u
'all': Write the index and a list of paths and fails
--m3u-path Override default m3u path
-
+
-s, --skip-existing Skip if a track matching file conditions is found in the
output folder or your music library (if provided)
--skip-mode [name|tag|m3u|name-cond|tag-cond|m3u-cond]
- See --help "skip-existing".
+ See --help ""skip-existing"".
--music-dir Specify to also skip downloading tracks found in a music
library. Use with --skip-existing
--skip-not-found Skip searching for tracks that weren't found on Soulseek
during the last run. Fails are read from the m3u file.
- --skip-existing-pref-cond Use preferred instead of necessary conds for skip-existing
-
- --display-mode Changes how searches and downloads are displayed:
- 'single' (default): Show transfer state and percentage
- 'double': Transfer state and a large progress bar
- 'simple': No download bars or changing percentages
- --print Print tracks or search results instead of downloading:
- 'tracks': Print all tracks to be downloaded
- 'tracks-full': Print extended information about all tracks
- 'results': Print search results satisfying file conditions
- 'results-full': Print search results including full paths
- --debug Print extra debug info
-
+ --skip-existing-pref-cond Use preferred instead of necessary conds for skip-existing
+
--listen-port Port for incoming connections (default: 49998)
--on-complete Run a command whenever a file is downloaded.
Available placeholders: {path} (local save path), {title},
@@ -89,6 +78,14 @@ Usage: sldl [OPTIONS]
E.g: '1:' will only run the command if the file is
downloaded successfully. Prepend 's:' to use the system
shell to execute the command.
+
+ --print Print tracks or search results instead of downloading:
+ 'tracks': Print all tracks to be downloaded
+ 'tracks-full': Print extended information about all tracks
+ 'results': Print search results satisfying file conditions
+ 'results-full': Print search results including full paths
+ --no-progress Disable progress bars/percentages, only simple printing
+ --debug Print extra debug info
```
```
Searching
@@ -454,7 +451,7 @@ extractor Name of the extractor used (CSV/Spotify/YouTube/
default-folder Default sldl folder name (usually the playlist name)
```
-## Skip existing
+## Skip-existing
sldl can skip downloads that exist in the output directory or a specified directory configured
with --music-dir.
@@ -606,7 +603,7 @@ sldl --profile wishlist
## Notes
- For macOS builds you can use publish.sh to build the app. Download dotnet from https://dotnet.microsoft.com/en-us/download/dotnet/6.0, then run `chmod +x publish.sh && sh publish.sh`. For intel macs, uncomment the x64 and comment the arm64 section in publish.sh.
-- The printed output may appear duplicated, overlap, or not update on some configurations (new windows terminal, git bash). Use another terminal or `--display-mode simple` in case of issues.
+- The printed output may appear duplicated, overlap, or not update on some configurations (new windows terminal, git bash). Use another terminal or `--no-progress` in case of issues.
## Docker
diff --git a/slsk-batchdl/Config.cs b/slsk-batchdl/Config.cs
index ebbdab4..9279dde 100644
--- a/slsk-batchdl/Config.cs
+++ b/slsk-batchdl/Config.cs
@@ -74,6 +74,7 @@ public class Config
public bool useRandomLogin = false;
public bool noBrowseFolder = false;
public bool skipExistingPrefCond = false;
+ public bool noProgress = false;
public int downrankOn = -1;
public int ignoreOn = -2;
public int minAlbumTrackCount = -1;
@@ -97,7 +98,6 @@ public class Config
public Track regexReplaceBy = new();
public AlbumArtOption albumArtOption = AlbumArtOption.Default;
public M3uOption m3uOption = M3uOption.Index;
- public DisplayMode displayMode = DisplayMode.Single;
public InputType inputType = InputType.None;
public SkipMode skipMode = SkipMode.M3u;
public SkipMode skipModeMusicDir = SkipMode.Name;
@@ -133,8 +133,16 @@ public class Config
}
- public void Load(string[] args)
+ public void LoadAndParse(string[] args)
{
+ int helpIdx = Array.FindLastIndex(args, x => x == "--help" || x == "-h");
+ if (args.Length == 0 || helpIdx >= 0)
+ {
+ string option = helpIdx + 1 < args.Length ? args[helpIdx + 1] : "";
+ Help.PrintHelp(option);
+ Environment.Exit(0);
+ }
+
arguments = args.SelectMany(arg =>
{
if (arg.Length > 2 && arg[0] == '-')
@@ -223,7 +231,7 @@ public class Config
m3uOption = M3uOption.None;
else if (!hasConfiguredM3uMode && inputType == InputType.String)
m3uOption = M3uOption.None;
- else if (!hasConfiguredM3uMode && !Program.trackLists.Flattened(true, true).Skip(1).Any())
+ else if (!hasConfiguredM3uMode && Program.trackLists != null && !Program.trackLists.Flattened(true, true).Skip(1).Any())
m3uOption = M3uOption.None;
if (albumArtOnly && albumArtOption == AlbumArtOption.Default)
@@ -1091,16 +1099,9 @@ public class Config
case "--desperate":
setFlag(ref desperateSearch, ref i);
break;
- case "--dm":
- case "--display":
- case "--display-mode":
- displayMode = args[++i].ToLower().Trim() switch
- {
- "single" => DisplayMode.Single,
- "double" => DisplayMode.Double,
- "simple" => DisplayMode.Simple,
- _ => throw new ArgumentException($"Invalid display mode '{args[i]}'"),
- };
+ case "--np":
+ case "--no-progress":
+ setFlag(ref noProgress, ref i);
break;
case "--sm":
case "--skip-mode":
diff --git a/slsk-batchdl/Enums.cs b/slsk-batchdl/Enums.cs
index 85f18c9..8aa02cc 100644
--- a/slsk-batchdl/Enums.cs
+++ b/slsk-batchdl/Enums.cs
@@ -71,13 +71,6 @@ namespace Enums
Largest,
}
- public enum DisplayMode
- {
- Single,
- Double,
- Simple,
- }
-
public enum Verbosity
{
Silent,
diff --git a/slsk-batchdl/Help.cs b/slsk-batchdl/Help.cs
index cd734cf..3621681 100644
--- a/slsk-batchdl/Help.cs
+++ b/slsk-batchdl/Help.cs
@@ -43,18 +43,7 @@ public static class Help
library. Use with --skip-existing
--skip-not-found Skip searching for tracks that weren't found on Soulseek
during the last run. Fails are read from the m3u file.
- --skip-existing-pref-cond Use preferred instead of necessary conds for skip-existing
-
- --display-mode Changes how searches and downloads are displayed:
- 'single' (default): Show transfer state and percentage
- 'double': Transfer state and a large progress bar
- 'simple': No download bars or changing percentages
- --print Print tracks or search results instead of downloading:
- 'tracks': Print all tracks to be downloaded
- 'tracks-full': Print extended information about all tracks
- 'results': Print search results satisfying file conditions
- 'results-full': Print search results including full paths
- --debug Print extra debug info
+ --skip-existing-pref-cond Use preferred instead of necessary conds for skip-existing
--listen-port Port for incoming connections (default: 49998)
--on-complete Run a command whenever a file is downloaded.
@@ -66,6 +55,14 @@ public static class Help
E.g: '1:' will only run the command if the file is
downloaded successfully. Prepend 's:' to use the system
shell to execute the command.
+
+ --print Print tracks or search results instead of downloading:
+ 'tracks': Print all tracks to be downloaded
+ 'tracks-full': Print extended information about all tracks
+ 'results': Print search results satisfying file conditions
+ 'results-full': Print search results including full paths
+ --no-progress Disable progress bars/percentages, only simple printing
+ --debug Print extra debug info
Searching
--fast-search Begin downloading as soon as a file satisfying the preferred
@@ -428,7 +425,7 @@ public static class Help
";
const string skipExistingHelp = @"
- Skip existing
+ Skip-existing
sldl can skip downloads that exist in the output directory or a specified directory configured
with --music-dir.
diff --git a/slsk-batchdl/Printing.cs b/slsk-batchdl/Printing.cs
index 816a78e..1b2cbe2 100644
--- a/slsk-batchdl/Printing.cs
+++ b/slsk-batchdl/Printing.cs
@@ -312,8 +312,10 @@ public static class Printing
try { progress.Refresh(current, item); }
catch { }
}
- else if ((Config.I.displayMode == DisplayMode.Simple || Console.IsOutputRedirected) && print)
+ else if ((Config.I.noProgress || Console.IsOutputRedirected) && print)
+ {
Console.WriteLine(item);
+ }
}
@@ -342,16 +344,18 @@ public static class Printing
}
- public static ProgressBar? GetProgressBar(DisplayMode style)
+ public static ProgressBar? GetProgressBar()
{
lock (consoleLock)
{
- ProgressBar? progress = null;
- if (style == DisplayMode.Double)
- progress = new ProgressBar(PbStyle.DoubleLine, 100, Console.WindowWidth - 40, character: '―');
- else if (style != DisplayMode.Simple)
- progress = new ProgressBar(PbStyle.SingleLine, 100, Console.WindowWidth - 10, character: ' ');
- return progress;
+ if (!Config.I.noProgress)
+ {
+ return new ProgressBar(PbStyle.SingleLine, 100, Console.WindowWidth - 10, character: ' ');
+ }
+ else
+ {
+ return null;
+ }
}
}
}
diff --git a/slsk-batchdl/Program.cs b/slsk-batchdl/Program.cs
index 4c352a7..93fcdf2 100644
--- a/slsk-batchdl/Program.cs
+++ b/slsk-batchdl/Program.cs
@@ -36,15 +36,7 @@ static partial class Program
Console.ResetColor();
Console.OutputEncoding = System.Text.Encoding.UTF8;
- int helpIdx = Array.FindIndex(args, x => x == "--help" || x == "-h");
- if (args.Length == 0 || helpIdx >= 0)
- {
- string option = helpIdx + 1 < args.Length ? args[helpIdx + 1] : "";
- Help.PrintHelp(option);
- return;
- }
-
- Config.I.Load(args);
+ Config.I.LoadAndParse(args);
if (Config.I.input.Length == 0)
throw new ArgumentException($"No input provided");
diff --git a/slsk-batchdl/Search.cs b/slsk-batchdl/Search.cs
index 88e1bcb..1036339 100644
--- a/slsk-batchdl/Search.cs
+++ b/slsk-batchdl/Search.cs
@@ -27,7 +27,7 @@ static class Search
IEnumerable<(SlResponse response, SlFile file)>? orderedResults = null;
var responseData = new ResponseData();
- var progress = Printing.GetProgressBar(Config.I.displayMode);
+ var progress = Printing.GetProgressBar();
var results = new SlDictionary();
var fsResults = new SlDictionary();
using var searchCts = new CancellationTokenSource();
diff --git a/slsk-batchdl/Test.cs b/slsk-batchdl/Test.cs
index d03af03..9171747 100644
--- a/slsk-batchdl/Test.cs
+++ b/slsk-batchdl/Test.cs
@@ -109,7 +109,7 @@ namespace Test
File.WriteAllText(path, content);
- Config.I.Load(new string[] { "-c", path });
+ Config.I.LoadAndParse(new string[] { "-c", path });
var tle = new TrackListEntry(TrackType.Album);
Config.UpdateProfiles(tle);
@@ -133,7 +133,7 @@ namespace Test
File.WriteAllText(path, content);
- Config.I.Load(new string[] { "-c", path });
+ Config.I.LoadAndParse(new string[] { "-c", path });
Config.UpdateProfiles(tle);
Assert(Config.I.maxStaleTime == 999999 && !Config.I.useYtdlp);
@@ -152,7 +152,7 @@ namespace Test
"\nyt-dlp = true";
File.WriteAllText(path, content);
- Config.I.Load(new string[] { "-c", path });
+ Config.I.LoadAndParse(new string[] { "-c", path });
Config.UpdateProfiles(new TrackListEntry(TrackType.Normal));
Assert(Config.I.maxStaleTime == 50000 && Config.I.useYtdlp);