diff --git a/slsk-batchdl/Download.cs b/slsk-batchdl/Download.cs
index 1b3906e..d167f81 100644
--- a/slsk-batchdl/Download.cs
+++ b/slsk-batchdl/Download.cs
@@ -28,6 +28,8 @@ static class Download
string origPath = filePath;
filePath += ".incomplete";
+ Printing.WriteLine($"Downloading: {track} to '{filePath}'", debugOnly: true);
+
var transferOptions = new TransferOptions(
stateChanged: (state) =>
{
diff --git a/slsk-batchdl/FileManager.cs b/slsk-batchdl/FileManager.cs
index c3d12e8..00f8d04 100644
--- a/slsk-batchdl/FileManager.cs
+++ b/slsk-batchdl/FileManager.cs
@@ -33,7 +33,7 @@ public class FileManager
if (tle.defaultFolderName != null)
{
- parent = Path.Join(parent, tle.defaultFolderName.ReplaceInvalidChars(Config.I.invalidReplaceStr, removeSlash: false));
+ parent = Path.Join(parent, tle.defaultFolderName);
}
if (tle.source.Type == TrackType.Album && !string.IsNullOrEmpty(remoteCommonDir))
@@ -44,7 +44,7 @@ public class FileManager
parent = Path.Join(parent, dirname, Path.GetDirectoryName(relpath) ?? "");
}
- return Path.Join(parent, name);
+ return Path.Join(parent, name).CleanPath(Config.I.invalidReplaceStr);
}
public void SetRemoteCommonDir(string? remoteCommonDir)
diff --git a/slsk-batchdl/Program.cs b/slsk-batchdl/Program.cs
index 2007c4e..02d9951 100644
--- a/slsk-batchdl/Program.cs
+++ b/slsk-batchdl/Program.cs
@@ -493,7 +493,7 @@ static partial class Program
PrintAlbum(tracks);
}
- var semaphore = new SemaphoreSlim(999); // Needs to be uncapped due to a bug that causes album downloads to fail after some time
+ var semaphore = new SemaphoreSlim(Config.I.concurrentProcesses == -2 ? 1 : 999); // Needs to be uncapped due to a bug that causes album downloads to fail after some time
using var cts = new CancellationTokenSource();
try
diff --git a/slsk-batchdl/Utils.cs b/slsk-batchdl/Utils.cs
index 9c349b6..b61a1b9 100644
--- a/slsk-batchdl/Utils.cs
+++ b/slsk-batchdl/Utils.cs
@@ -272,6 +272,34 @@ public static class Utils
return str;
}
+ public static string CleanPath(this string fullPath, string replaceWith)
+ {
+ fullPath = Utils.NormalizedPath(fullPath);
+
+ string[] pathParts = fullPath.Split('/');
+
+ foreach (char badChar in Path.GetInvalidPathChars())
+ {
+ if (badChar != ':')
+ {
+ pathParts[0] = pathParts[0].Replace(badChar.ToString(), replaceWith);
+ }
+ }
+
+ var chars = Path.GetInvalidFileNameChars();
+
+ for (int i = 1; i < pathParts.Length; i++)
+ {
+ foreach (char badChar in chars)
+ {
+ pathParts[i] = pathParts[i].Replace(badChar.ToString(), replaceWith);
+ }
+ }
+
+ return string.Join('/', pathParts);
+ }
+
+
public static string ReplaceSpecialChars(this string str, string replaceStr)
{
if (str.Length == 0)
diff --git a/slsk-batchdl/slsk-batchdl.csproj b/slsk-batchdl/slsk-batchdl.csproj
index 7efdf46..10c6f13 100644
--- a/slsk-batchdl/slsk-batchdl.csproj
+++ b/slsk-batchdl/slsk-batchdl.csproj
@@ -27,7 +27,7 @@
-
+