1
0
Fork 0
mirror of https://github.com/fiso64/slsk-batchdl.git synced 2024-12-22 14:32:40 +00:00

set album concurrent-dls to 999 due to #56

This commit is contained in:
fiso64 2024-09-05 16:28:37 +02:00
parent b15bb01c89
commit 39c8863a23
7 changed files with 39 additions and 37 deletions

View file

@ -427,7 +427,7 @@ tag1 is null, use tag2. String literals enclosed in parentheses are ignored in t
- "{artist( - )title|filename}" - "{artist( - )title|filename}"
If artist and title are not null, name it 'Artist - Title', otherwise use the original If artist and title are not null, name it 'Artist - Title', otherwise use the original
filename. filename.
- "{albumartist(/)album(/)track(. )title|(missing-tags/)filename}" - "{albumartist(/)album(/)track(. )title|(missing-tags/)foldername(/)filename}"
Sort files into artist/album folders if all tags are present, otherwise put them in Sort files into artist/album folders if all tags are present, otherwise put them in
the 'missing-tags' folder. the 'missing-tags' folder.
@ -582,7 +582,7 @@ sldl "artist=MC MENTAL" --aggregate --album --interactive
Create a file named `wishlist.txt`, and add some items as detailed in [Input types: List](#list): Create a file named `wishlist.txt`, and add some items as detailed in [Input types: List](#list):
```bash ```bash
echo "title=My Favorite Song, artist=Artist" >> wishlist.txt echo "title=My Favorite Song, artist=Artist" >> wishlist.txt
echo "album=Album" "format=mp3" >> wishlist.txt echo "album=Album, album-track-count=5" "format=mp3" >> wishlist.txt
``` ```
Add a profile to your `sldl.conf`: Add a profile to your `sldl.conf`:
``` ```
@ -603,7 +603,7 @@ sldl --profile wishlist
## Notes ## 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. - 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.
- `--display single` and especially `double` can cause the printed lines to be duplicated or overwritten on some configurations. Use `simple` if that's an issue. - `--display single` and especially `double` can cause the printed lines to be duplicated or overwritten on some configurations (new windows terminal, git bash). Use another terminal or `--display-mode simple` in case of issues.
## Docker ## Docker

View file

@ -109,7 +109,7 @@ public class DownloadWrapper
{ {
public string savePath; public string savePath;
public string displayText = ""; public string displayText = "";
public int downloadRotatingBarState = 0; public int barState = 0;
public Soulseek.File file; public Soulseek.File file;
public Transfer? transfer; public Transfer? transfer;
public SearchResponse response; public SearchResponse response;
@ -145,8 +145,6 @@ public class DownloadWrapper
public void UpdateText() public void UpdateText()
{ {
downloadRotatingBarState++;
downloadRotatingBarState %= bars.Length;
float? percentage = bytesTransferred / (float)file.Size; float? percentage = bytesTransferred / (float)file.Size;
queued = (transfer?.State & TransferStates.Queued) != 0; queued = (transfer?.State & TransferStates.Queued) != 0;
string bar; string bar;
@ -166,9 +164,13 @@ public class DownloadWrapper
state = "Queued (R)"; state = "Queued (R)";
else else
state = "Queued (L)"; state = "Queued (L)";
bar = " ";
} }
else if ((transfer.State & TransferStates.Initializing) != 0) else if ((transfer.State & TransferStates.Initializing) != 0)
{
state = "Initialize"; state = "Initialize";
bar = " ";
}
else if ((transfer.State & TransferStates.Completed) != 0) else if ((transfer.State & TransferStates.Completed) != 0)
{ {
var flag = transfer.State & (TransferStates.Succeeded | TransferStates.Cancelled var flag = transfer.State & (TransferStates.Succeeded | TransferStates.Cancelled
@ -178,15 +180,23 @@ public class DownloadWrapper
if (flag == TransferStates.Succeeded) if (flag == TransferStates.Succeeded)
success = true; success = true;
bar = "";
} }
else else
{ {
state = transfer.State.ToString(); state = transfer.State.ToString();
if ((transfer.State & TransferStates.InProgress) != 0) if ((transfer.State & TransferStates.InProgress) != 0)
{
downloading = true; downloading = true;
barState = (barState + 1) % bars.Length;
bar = bars[barState] + " ";
}
else
{
bar = " ";
}
} }
bar = success ? "" : bars[downloadRotatingBarState] + " ";
} }
else else
{ {

View file

@ -240,18 +240,20 @@ public class FileManager
case "filename": case "filename":
res = Utils.GetFileNameWithoutExtSlsk(slfile?.Filename ?? ""); break; res = Utils.GetFileNameWithoutExtSlsk(slfile?.Filename ?? ""); break;
case "foldername": case "foldername":
if (remoteCommonDir == null || slfile == null) if (string.IsNullOrEmpty(remoteCommonDir) || slfile == null)
{ {
res = Utils.GetBaseNameSlsk(Utils.GetDirectoryNameSlsk(slfile?.Filename ?? "")); if (!string.IsNullOrEmpty(remoteCommonDir))
return true; res = Path.GetFileName(Utils.NormalizedPath(remoteCommonDir));
else
res = Path.GetDirectoryName(Utils.NormalizedPath(slfile.Filename));
} }
else else
{ {
string d = Path.GetDirectoryName(Utils.NormalizedPath(slfile.Filename)); string d = Path.GetDirectoryName(Utils.NormalizedPath(slfile.Filename));
string r = Path.GetFileName(remoteCommonDir); string r = Path.GetFileName(remoteCommonDir);
res = Path.Join(r, Path.GetRelativePath(remoteCommonDir, d)); res = Path.Join(r, Path.GetRelativePath(remoteCommonDir, d));
return true;
} }
return true;
case "extractor": case "extractor":
res = Config.I.inputType.ToString(); break; res = Config.I.inputType.ToString(); break;
case "default-folder": case "default-folder":

View file

@ -401,7 +401,7 @@ public static class Help
""{artist( - )title|filename}"" ""{artist( - )title|filename}""
If artist and title are not null, name it 'Artist - Title', otherwise use the original If artist and title are not null, name it 'Artist - Title', otherwise use the original
filename. filename.
""{albumartist(/)album(/)track(. )title|(missing-tags/)filename}"" ""{albumartist(/)album(/)track(. )title|(missing-tags/)foldername(/)filename}""
Sort files into artist/album folders if all tags are present, otherwise put them in Sort files into artist/album folders if all tags are present, otherwise put them in
the 'missing-tags' folder. the 'missing-tags' folder.

View file

@ -298,7 +298,7 @@ public static class Printing
if (lastIndex != -1) if (lastIndex != -1)
{ {
int secondLastIndex = gcp.LastIndexOf('\\', lastIndex - 1); int secondLastIndex = gcp.LastIndexOf('\\', lastIndex - 1);
gcp = secondLastIndex == -1 ? gcp[(lastIndex + 1)..] : gcp[(secondLastIndex + 1)..]; gcp = secondLastIndex == -1 ? gcp : gcp[(secondLastIndex + 1)..];
} }
return (gcp, res); return (gcp, res);

View file

@ -501,7 +501,7 @@ static partial class Program
PrintAlbum(tracks); PrintAlbum(tracks);
} }
var semaphore = new SemaphoreSlim(Config.I.concurrentProcesses); var semaphore = new SemaphoreSlim(999); // Needs to be uncapped due to a bug that causes album downloads to fail after some time
using var cts = new CancellationTokenSource(); using var cts = new CancellationTokenSource();
try try

View file

@ -15,25 +15,6 @@ using SlFile = Soulseek.File;
using SlDictionary = System.Collections.Concurrent.ConcurrentDictionary<string, (Soulseek.SearchResponse, Soulseek.File)>; using SlDictionary = System.Collections.Concurrent.ConcurrentDictionary<string, (Soulseek.SearchResponse, Soulseek.File)>;
using System.Diagnostics;
class TimerReporter
{
private Stopwatch stopwatch;
public TimerReporter()
{
stopwatch = new Stopwatch();
stopwatch.Start();
}
public void Report(string message = "")
{
Console.WriteLine($"Time elapsed: {stopwatch.ElapsedMilliseconds} ms. {message}");
stopwatch.Restart();
}
}
static class Search static class Search
{ {
public static RateLimitedSemaphore? searchSemaphore; public static RateLimitedSemaphore? searchSemaphore;
@ -604,7 +585,16 @@ static class Search
int newFiles = 0; int newFiles = 0;
try try
{ {
var allFiles = await GetAllFilesInFolder(response.Username, folder, cancellationToken); List<(string dir, SlFile file)> allFiles;
try
{
allFiles = await GetAllFilesInFolder(response.Username, folder, cancellationToken);
}
catch (Exception e)
{
Console.WriteLine($"Error: Error getting all files in directory '{folder}: {e}'");
return 0;
}
if (allFiles.Count > tracks.Count) if (allFiles.Count > tracks.Count)
{ {